aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/RestartingSystemViewVM.cs
blob: b1cb57fceb093a8b41969349d88f83dd96ade927 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.PPC.Common;
using Tango.PPC.Common.Application;
using Tango.PPC.Common.Navigation;
using Tango.PPC.Common.OS;

namespace Tango.PPC.UI.ViewModels
{
    public class RestartingSystemViewVM : PPCViewModel
    {
        private IOperationSystemManager _os;
        private INavigationManager _navigationManager;

        public RestartingSystemViewVM(IPPCApplicationManager applicationManager, IOperationSystemManager operationSystemManager, INavigationManager navigationManager)
        {
            _navigationManager = navigationManager;
            _os = operationSystemManager;
            applicationManager.SystemRestartRequired += ApplicationManager_SystemRestartRequired;
        }

        private void ApplicationManager_SystemRestartRequired(object sender, EventArgs e)
        {
            InvokeUI(() =>
            {
                _navigationManager.NavigateTo(NavigationView.RestartingSystemView);
            });
        }

        public async override void OnNavigatedTo()
        {
            base.OnNavigatedTo();
            await Task.Delay(2000);
            _os.Restart();
        }

        public override void OnApplicationStarted()
        {

        }
    }
}
class="w"> } } /// <inheritdoc/> public override object GetPattern(PatternInterface patternInterface) { if (patternInterface == PatternInterface.Value) return this; if (patternInterface == PatternInterface.Scroll) { ScrollViewer scrollViewer = this.TextEditor.ScrollViewer; if (scrollViewer != null) return UIElementAutomationPeer.CreatePeerForElement(scrollViewer); } return base.GetPattern(patternInterface); } internal void RaiseIsReadOnlyChanged(bool oldValue, bool newValue) { RaisePropertyChangedEvent(ValuePatternIdentifiers.IsReadOnlyProperty, Boxes.Box(oldValue), Boxes.Box(newValue)); } } }