From 78c93e2ee1eddff67554edec9f956536a0b61482 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Mon, 25 Nov 2019 16:39:01 +0200 Subject: Working on Backup/Restore... --- .../Tango.PPC.UI/ViewModels/BackupRestoreViewVM.cs | 91 ---------------------- .../PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs | 11 --- 2 files changed, 102 deletions(-) delete mode 100644 Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/BackupRestoreViewVM.cs (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels') diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/BackupRestoreViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/BackupRestoreViewVM.cs deleted file mode 100644 index 416ece24b..000000000 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/BackupRestoreViewVM.cs +++ /dev/null @@ -1,91 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.Core.Commands; -using Tango.Core.DI; -using Tango.PPC.Common; -using Tango.PPC.Common.BackupRestore; -using Tango.PPC.UI.ViewsContracts; - -namespace Tango.PPC.UI.ViewModels -{ - public class BackupRestoreViewVM : PPCViewModel - { - private Stack _navigation_history; - private BackupRestoreView _currentView; - private bool _canNavigateBack; - - public enum BackupRestoreView - { - MainView, - BackupView, - RestoreView - } - - [TangoInject] - public IBackupManager BackupManager { get; set; } - - public RelayCommand NavigateCommand { get; set; } - - public RelayCommand NavigateBackCommand { get; set; } - - public BackupRestoreViewVM() - { - NavigateCommand = new RelayCommand(HandleNavigateCommand); - NavigateBackCommand = new RelayCommand(NavigateBack, () => _canNavigateBack); - - _navigation_history = new Stack(); - _canNavigateBack = true; - } - - public override void OnNavigatedTo() - { - base.OnNavigatedTo(); - - _navigation_history = new Stack(); - _currentView = BackupRestoreView.MainView; - } - - private void HandleNavigateCommand(string view) - { - var v = (BackupRestoreView)Enum.Parse(typeof(BackupRestoreView), view); - NavigateTo(v); - } - - private Task NavigateTo(BackupRestoreView view, bool pushHistory = true) - { - if (pushHistory) - { - _navigation_history.Push(_currentView); - } - - _currentView = view; - return View.NavigateTo(view); - } - - private async void NavigateBack() - { - _canNavigateBack = false; - InvalidateRelayCommands(); - - if (_navigation_history.Count > 0) - { - await NavigateTo(_navigation_history.Pop(), false); - } - else - { - await NavigationManager.NavigateBack(); - } - - _canNavigateBack = true; - InvalidateRelayCommands(); - } - - public override void OnApplicationStarted() - { - - } - } -} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs index 0b530c278..9e8a9fe34 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs @@ -111,11 +111,6 @@ namespace Tango.PPC.UI.ViewModels /// public RelayCommand UpdateCommand { get; set; } - /// - /// Gets or sets the backup restore command. - /// - public RelayCommand BackupRestoreCommand { get; set; } - /// /// Gets or sets the power command. /// @@ -151,12 +146,6 @@ namespace Tango.PPC.UI.ViewModels PowerCommand = new RelayCommand(() => IsPowerOpened = true); RestartApplicationCommand = new RelayCommand(RestartApplication); - - BackupRestoreCommand = new RelayCommand(() => - { - NavigationManager.NavigateTo(NavigationView.BackupRestoreView); - IsMenuOpened = false; - }); } #endregion -- cgit v1.3.1