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() { } } }