diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-11-24 17:31:30 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-11-24 17:31:30 +0200 |
| commit | fcf154eb2ae88dcf1003ea6bd14c91cab1a616e9 (patch) | |
| tree | 8f6195057030e2d2fbbfd2d0090cfed5b5c61866 /Software/Visual_Studio/PPC/Tango.PPC.UI | |
| parent | 53b58d21f600ef55daefd363f6e93274a9e8c048 (diff) | |
| download | Tango-fcf154eb2ae88dcf1003ea6bd14c91cab1a616e9.tar.gz Tango-fcf154eb2ae88dcf1003ea6bd14c91cab1a616e9.zip | |
Backup Manager.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI')
15 files changed, 408 insertions, 17 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/BackupRestore/DefaultBackupManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/BackupRestore/DefaultBackupManager.cs index dace90b5c..1eeb848ed 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/BackupRestore/DefaultBackupManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/BackupRestore/DefaultBackupManager.cs @@ -3,10 +3,39 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.PPC.Common.Application; +using Tango.PPC.Common.BackupRestore; namespace Tango.PPC.UI.BackupRestore { - class DefaultBackupManager + public class DefaultBackupManager : IBackupManager { + public event EventHandler<BackupRestoreEventArgs> Progress; + + public DefaultBackupManager(IPPCApplicationManager applicationManager) + { + + } + + public Task CreateBackup(string filePath, BackupSettings settings) + { + throw new NotImplementedException(); + } + + public Task Restore(string filePath) + { + throw new NotImplementedException(); + } + + protected virtual void OnProgress(BackupRestoreStage stage, double progress = 0, double maxProgress = 100, bool isIntermediate = true) + { + Progress?.Invoke(this, new BackupRestoreEventArgs() + { + Stage = stage, + Progress = progress, + MaxProgress = maxProgress, + IsIntermediate = isIntermediate, + }); + } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Menu/backup.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Menu/backup.png Binary files differnew file mode 100644 index 000000000..158bab095 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Menu/backup.png diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/backup-big.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/backup-big.png Binary files differnew file mode 100644 index 000000000..3a712af49 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/backup-big.png diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/backup-restore.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/backup-restore.png Binary files differnew file mode 100644 index 000000000..15be3b163 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/backup-restore.png diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/restore.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/restore.png Binary files differnew file mode 100644 index 000000000..e60aaf425 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/restore.png diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs index a0338912f..77b09f638 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Navigation/DefaultNavigationManager.cs @@ -113,7 +113,27 @@ namespace Tango.PPC.UI.Navigation { LogManager.Log($"Navigating to: {view.ToString()}..."); - MainView.Instance.NavigationControl.NavigateTo(view.ToString()); + + var fromView = MainView.Instance.NavigationControl.SelectedElement; + FrameworkElement toView = null; + + toView = MainView.Instance.NavigationControl.NavigateTo(view.ToString(),() => + { + var fromVM = toView.DataContext as PPCViewModel; + + if (fromVM != null) + { + fromVM.OnNavigatedFrom(); + } + + var toVM = toView.DataContext as PPCViewModel; + + if (toVM != null) + { + toVM.OnNavigatedTo(); + } + }); + return Task.FromResult(true); } } @@ -398,24 +418,34 @@ namespace Tango.PPC.UI.Navigation _navigating_back = true; - String first = _navigationHistory.Pop(); - _preventHistory = true; - - - if (await NavigateTo(first)) + if (_navigationHistory.Count > 0) { - RaisePropertyChanged(nameof(CanNavigateBack)); - _preventHistory = false; - _navigating_back = false; - return true; + String first = _navigationHistory.Pop(); + _preventHistory = true; + + if (await NavigateTo(first)) + { + RaisePropertyChanged(nameof(CanNavigateBack)); + _preventHistory = false; + _navigating_back = false; + return true; + } + else + { + _navigationHistory.Push(first); + _preventHistory = false; + _navigating_back = false; + RaisePropertyChanged(nameof(CanNavigateBack)); + return false; + } } else { - _navigationHistory.Push(first); + await NavigateTo(NavigationView.HomeModule); + RaisePropertyChanged(nameof(CanNavigateBack)); _preventHistory = false; _navigating_back = false; - RaisePropertyChanged(nameof(CanNavigateBack)); - return false; + return true; } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index b279f1a92..fd068bd61 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -115,6 +115,7 @@ <Link>GlobalVersionInfo.cs</Link> </Compile> <Compile Include="Authentication\DefaultAuthenticationProvider.cs" /> + <Compile Include="BackupRestore\DefaultBackupManager.cs" /> <Compile Include="Connectivity\DefaultConnectivityProvider.cs" /> <Compile Include="Connectivity\WiFiAuthenticationView.xaml.cs"> <DependentUpon>WiFiAuthenticationView.xaml</DependentUpon> @@ -154,6 +155,7 @@ <Compile Include="Printing\DefaultPrintingManager.cs" /> <Compile Include="Threading\DefaultDispatcherProvider.cs" /> <Compile Include="ViewModelLocator.cs" /> + <Compile Include="ViewModels\BackupRestoreViewVM.cs" /> <Compile Include="ViewModels\EmergencyViewVM.cs" /> <Compile Include="ViewModels\ExternalBridgeViewVM.cs" /> <Compile Include="ViewModels\LayoutViewVM.cs" /> @@ -165,9 +167,13 @@ <Compile Include="ViewModels\MachineUpdateViewVM.cs" /> <Compile Include="ViewModels\NoPermissionsViewVM.cs" /> <Compile Include="ViewModels\RestartingSystemViewVM.cs" /> + <Compile Include="ViewsContracts\IBackupRestoreView.cs" /> <Compile Include="ViewsContracts\ILayoutView.cs" /> <Compile Include="ViewsContracts\IMachineSetupView.cs" /> <Compile Include="ViewsContracts\IMachineUpdateView.cs" /> + <Compile Include="Views\BackupRestoreView.xaml.cs"> + <DependentUpon>BackupRestoreView.xaml</DependentUpon> + </Compile> <Compile Include="Views\ExternalBridgeView.xaml.cs"> <DependentUpon>ExternalBridgeView.xaml</DependentUpon> </Compile> @@ -253,6 +259,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Views\BackupRestoreView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Views\ExternalBridgeView.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -349,6 +359,10 @@ </Content> <Resource Include="Images\cartridge_validation.png" /> <Resource Include="Images\machine-image.png" /> + <Resource Include="Images\Menu\backup.png" /> + <Resource Include="Images\backup-restore.png" /> + <Resource Include="Images\restore.png" /> + <Resource Include="Images\backup-big.png" /> <Content Include="Manifests\release.xml" /> <Content Include="Manifests\debug.xml" /> <None Include="packages.config" /> @@ -593,7 +607,7 @@ if $(ConfigurationName) == Release del *.xml</PostBuildEvent> </PropertyGroup> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs index 67b5dc19b..9fc482389 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs @@ -5,6 +5,7 @@ using Tango.Integration.ExternalBridge; using Tango.Logging; using Tango.PPC.Common.Application; using Tango.PPC.Common.Authentication; +using Tango.PPC.Common.BackupRestore; using Tango.PPC.Common.Connection; using Tango.PPC.Common.Connectivity; using Tango.PPC.Common.Diagnostics; @@ -24,6 +25,7 @@ using Tango.PPC.Common.Threading; using Tango.PPC.Common.UWF; using Tango.PPC.Common.Web; using Tango.PPC.UI.Authentication; +using Tango.PPC.UI.BackupRestore; using Tango.PPC.UI.Connectivity; using Tango.PPC.UI.Modules; using Tango.PPC.UI.Navigation; @@ -71,6 +73,7 @@ namespace Tango.PPC.UI TangoIOC.Default.Unregister<IUnifiedWriteFilterManager>(); TangoIOC.Default.Unregister<IOperationSystemManager>(); TangoIOC.Default.Unregister<PPCWebClient>(); + TangoIOC.Default.Unregister<IBackupManager>(); TangoIOC.Default.Register<PPCWebClient, PPCWebClient>(new PPCWebClient()); TangoIOC.Default.Register<IDispatcherProvider, DefaultDispatcherProvider>(new DefaultDispatcherProvider(Application.Current.Dispatcher)); @@ -93,8 +96,7 @@ namespace Tango.PPC.UI TangoIOC.Default.Register<IStorageProvider, DefaultStorageProvider>(); TangoIOC.Default.Register<IUnifiedWriteFilterManager, AlternativeUnifiedWriteFilterManager>(); TangoIOC.Default.Register<IOperationSystemManager, DefaultOperationSystemManager>(); - - //TangoIOC.Default.Register<TeamFoundationServiceExtendedClient>(new TeamFoundationServiceExtendedClient("https://twinetfs.visualstudio.com", String.Empty, "szzfokrceo4rhd4eqi5qpmxn3pa5iwl3q7tlqd36l2m7smz2ynoa")); + TangoIOC.Default.Register<IBackupManager, DefaultBackupManager>(); TangoIOC.Default.Register<LoadingViewVM>(); TangoIOC.Default.Register<MainViewVM>(); @@ -107,6 +109,7 @@ namespace Tango.PPC.UI TangoIOC.Default.Register<NoPermissionsViewVM>(); TangoIOC.Default.Register<RestartingSystemViewVM>(); TangoIOC.Default.Register<EmergencyViewVM>(); + TangoIOC.Default.Register<BackupRestoreViewVM>(); TangoIOC.Default.GetInstance<IPPCApplicationManager>().ContentRendered += (_, __) => @@ -114,6 +117,7 @@ namespace Tango.PPC.UI TangoIOC.Default.Register<ILayoutView, LayoutView>(LayoutView.Instance); TangoIOC.Default.Register<IMachineSetupView, MachineSetupView>(MachineSetupView.Instance); TangoIOC.Default.Register<IMachineUpdateView, MachineUpdateView>(MachineUpdateView.Instance); + TangoIOC.Default.Register<IBackupRestoreView, BackupRestoreView>(BackupRestoreView.Instance); }; //TangoIOC.Default.Register<LoadingViewVM>(); @@ -212,5 +216,13 @@ namespace Tango.PPC.UI return TangoIOC.Default.GetInstance<EmergencyViewVM>(); } } + + public static BackupRestoreViewVM BackupRestoreViewVM + { + get + { + return TangoIOC.Default.GetInstance<BackupRestoreViewVM>(); + } + } } }
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/BackupRestoreViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/BackupRestoreViewVM.cs new file mode 100644 index 000000000..416ece24b --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/BackupRestoreViewVM.cs @@ -0,0 +1,91 @@ +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<IBackupRestoreView> + { + private Stack<BackupRestoreView> _navigation_history; + private BackupRestoreView _currentView; + private bool _canNavigateBack; + + public enum BackupRestoreView + { + MainView, + BackupView, + RestoreView + } + + [TangoInject] + public IBackupManager BackupManager { get; set; } + + public RelayCommand<String> NavigateCommand { get; set; } + + public RelayCommand NavigateBackCommand { get; set; } + + public BackupRestoreViewVM() + { + NavigateCommand = new RelayCommand<string>(HandleNavigateCommand); + NavigateBackCommand = new RelayCommand(NavigateBack, () => _canNavigateBack); + + _navigation_history = new Stack<BackupRestoreView>(); + _canNavigateBack = true; + } + + public override void OnNavigatedTo() + { + base.OnNavigatedTo(); + + _navigation_history = new Stack<BackupRestoreView>(); + _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 9e8a9fe34..0b530c278 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LayoutViewVM.cs @@ -112,6 +112,11 @@ namespace Tango.PPC.UI.ViewModels public RelayCommand UpdateCommand { get; set; } /// <summary> + /// Gets or sets the backup restore command. + /// </summary> + public RelayCommand BackupRestoreCommand { get; set; } + + /// <summary> /// Gets or sets the power command. /// </summary> public RelayCommand PowerCommand { get; set; } @@ -146,6 +151,12 @@ namespace Tango.PPC.UI.ViewModels PowerCommand = new RelayCommand(() => IsPowerOpened = true); RestartApplicationCommand = new RelayCommand(RestartApplication); + + BackupRestoreCommand = new RelayCommand(() => + { + NavigationManager.NavigateTo(NavigationView.BackupRestoreView); + IsMenuOpened = false; + }); } #endregion diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/BackupRestoreView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/BackupRestoreView.xaml new file mode 100644 index 000000000..ad8a5ca18 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/BackupRestoreView.xaml @@ -0,0 +1,128 @@ +<UserControl x:Class="Tango.PPC.UI.Views.BackupRestoreView" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:vm="clr-namespace:Tango.PPC.UI.ViewModels" + xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" + xmlns:global="clr-namespace:Tango.PPC.UI" + xmlns:local="clr-namespace:Tango.PPC.UI.Views" + mc:Ignorable="d" + d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:BackupRestoreViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.BackupRestoreViewVM}"> + + <UserControl.Resources> + <Style TargetType="touch:TouchButton" x:Key="ButtonMenu"> + <Setter Property="Padding" Value="10"></Setter> + <Setter Property="HorizontalContentAlignment" Value="Left"></Setter> + <Setter Property="Height" Value="140"></Setter> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="BorderBrush" Value="{StaticResource TangoDarkForegroundBrush}"></Setter> + <Setter Property="BorderThickness" Value="1"></Setter> + <Setter Property="Foreground" Value="{StaticResource TangoDarkForegroundBrush}"></Setter> + <Setter Property="EnableDropShadow" Value="False"></Setter> + <Setter Property="CornerRadius" Value="5"></Setter> + <Setter Property="Margin" Value="0 0 0 20"></Setter> + <Setter Property="RippleBrush" Value="#4BB8B8B8"></Setter> + </Style> + </UserControl.Resources> + + <Grid Background="{StaticResource TangoPrimaryBackgroundBrush}"> + <DockPanel> + <Grid DockPanel.Dock="Top"> + <StackPanel DockPanel.Dock="Top" HorizontalAlignment="Center" Margin="0 20 0 0"> + <Image Source="/Images/backup-restore.png" Stretch="Fill" Width="700" /> + </StackPanel> + </Grid> + + <Grid DockPanel.Dock="Bottom" Margin="50 20"> + <touch:TouchButton Command="{Binding NavigateBackCommand}" HorizontalAlignment="Right" Height="60" Width="200" Style="{StaticResource TangoHollowButton}"> + <StackPanel Orientation="Horizontal"> + <touch:TouchIcon Margin="-30 0 30 0" Icon="ArrowLeft" /> + <TextBlock>Back</TextBlock> + </StackPanel> + </touch:TouchButton> + </Grid> + + <controls:NavigationControl x:Name="navigationControl" TransitionType="Slide" KeepElementsAttached="True" Margin="0 20 0 0" SelectedIndex="0"> + + <Grid controls:NavigationControl.NavigationName="MainView"> + <StackPanel HorizontalAlignment="Left" Margin="50 20 50 0"> + <TextBlock TextWrapping="Wrap" FontSize="{StaticResource TangoDefaultFontSize}"> + <Run FontSize="{StaticResource TangoTitleFontSize}">Welcome to the backup/restore wizard</Run> + <LineBreak/> + <LineBreak/> + <Run>This wizard allows you to create a complete backup of your current machine state including software, firmware, data and user settings.</Run> + <LineBreak/> + <LineBreak/> + <LineBreak/> + <Run>For creating a complete backup of your system please press 'Backup'.</Run> + <LineBreak/> + <Run>In case you want to restore your system to a previous state, please press 'Restore'.</Run> + </TextBlock> + </StackPanel> + + <StackPanel VerticalAlignment="Center" Margin="50 150 50 0"> + <touch:TouchButton Style="{StaticResource ButtonMenu}" Command="{Binding NavigateCommand}" CommandParameter="BackupView"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> + <Image Source="../Images/backup-big.png" Width="80" Height="80" /> + <StackPanel Margin="10 0 0 0"> + <TextBlock FontSize="{StaticResource TangoButtonFontSize}">Backup</TextBlock> + <TextBlock Foreground="{StaticResource TangoGrayTextBrush}" Width="470" TextWrapping="Wrap"> + Create a complete backup of your system state and save it to a storage device. + </TextBlock> + </StackPanel> + </StackPanel> + </touch:TouchButton> + + <touch:TouchButton Style="{StaticResource ButtonMenu}" Command="{Binding NavigateCommand}" CommandParameter="RestoreView"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> + <Image Source="../Images/restore.png" Width="80" Height="65" /> + <StackPanel Margin="10 0 0 0"> + <TextBlock FontSize="{StaticResource TangoButtonFontSize}">Restore</TextBlock> + <TextBlock Foreground="{StaticResource TangoGrayTextBrush}"> + Restore your system from a previously saved backup file. + </TextBlock> + </StackPanel> + </StackPanel> + </touch:TouchButton> + </StackPanel> + </Grid> + + <Grid controls:NavigationControl.NavigationName="BackupView"> + <StackPanel HorizontalAlignment="Left" Margin="50 20 50 0"> + <TextBlock TextWrapping="Wrap" FontSize="{StaticResource TangoDefaultFontSize}"> + <Run FontSize="{StaticResource TangoTitleFontSize}">Backup your system</Run> + <LineBreak/> + <LineBreak/> + <Run>This wizard allows you to create a complete backup of your current machine state including software, firmware, data and user settings.</Run> + <LineBreak/> + <LineBreak/> + <LineBreak/> + <Run>For creating a complete backup of your system please press 'Backup'.</Run> + <LineBreak/> + <Run>In case you want to restore your system to a previous state, please press 'Restore'.</Run> + </TextBlock> + </StackPanel> + </Grid> + + <Grid controls:NavigationControl.NavigationName="RestoreView"> + <StackPanel HorizontalAlignment="Left" Margin="50 20 50 0"> + <TextBlock TextWrapping="Wrap" FontSize="{StaticResource TangoDefaultFontSize}"> + <Run FontSize="{StaticResource TangoTitleFontSize}">Restore your system</Run> + <LineBreak/> + <LineBreak/> + <Run>This wizard allows you to create a complete backup of your current machine state including software, firmware, data and user settings.</Run> + <LineBreak/> + <LineBreak/> + <LineBreak/> + <Run>For creating a complete backup of your system please press 'Backup'.</Run> + <LineBreak/> + <Run>In case you want to restore your system to a previous state, please press 'Restore'.</Run> + </TextBlock> + </StackPanel> + </Grid> + </controls:NavigationControl> + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/BackupRestoreView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/BackupRestoreView.xaml.cs new file mode 100644 index 000000000..824bad9f0 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/BackupRestoreView.xaml.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Tango.PPC.Common; +using Tango.PPC.UI.ViewModels; +using Tango.PPC.UI.ViewsContracts; + +namespace Tango.PPC.UI.Views +{ + /// <summary> + /// Interaction logic for BackupRestoreView.xaml + /// </summary> + public partial class BackupRestoreView : UserControl, IBackupRestoreView + { + public static BackupRestoreView Instance { get; internal set; } + + public BackupRestoreView() + { + InitializeComponent(); + + Instance = this; + } + + public Task NavigateTo(BackupRestoreViewVM.BackupRestoreView view) + { + TaskCompletionSource<object> source = new TaskCompletionSource<object>(); + + navigationControl.NavigateTo(view.ToString(), () => + { + source.SetResult(new object()); + }); + + return source.Task; + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml index 39c087c52..fa6b8de7e 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml @@ -100,6 +100,15 @@ </StackPanel> </touch:TouchButton> </Border> + + <Border BorderBrush="{StaticResource TangoDividerBrush}" BorderThickness="0 0 0 1"> + <touch:TouchButton Style="{StaticResource TangoFlatButton}" Padding="40 25" Foreground="{StaticResource TangoDarkForegroundBrush}" Command="{Binding BackupRestoreCommand}"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> + <Image Source="/Images/Menu/backup.png" VerticalAlignment="Center" Width="32" Height="32"></Image> + <TextBlock VerticalAlignment="Center" Margin="40 0 0 0" Foreground="{StaticResource TangoPrimaryAccentBrush}">Backup/Restore</TextBlock> + </StackPanel> + </touch:TouchButton> + </Border> </StackPanel> </StackPanel> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml index 6d6d57526..2119aebe7 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml @@ -89,6 +89,7 @@ <local:MachineUpdateView></local:MachineUpdateView> <local:RestartingSystemView></local:RestartingSystemView> <local:EmergencyView></local:EmergencyView> + <local:BackupRestoreView></local:BackupRestoreView> </controls:NavigationControl> </touch:TouchPanel> </Grid> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewsContracts/IBackupRestoreView.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewsContracts/IBackupRestoreView.cs new file mode 100644 index 000000000..ef5f43eda --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewsContracts/IBackupRestoreView.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Common; +using static Tango.PPC.UI.ViewModels.BackupRestoreViewVM; + +namespace Tango.PPC.UI.ViewsContracts +{ + public interface IBackupRestoreView : IPPCView + { + /// <summary> + /// Navigates to the specified backup/restore view. + /// </summary> + /// <param name="view">The view.</param> + Task NavigateTo(BackupRestoreView view); + } +} |
