diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-12-10 11:08:14 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-12-10 11:08:14 +0200 |
| commit | ee0f4151c329542c30041ff1da91d25e8d8e2575 (patch) | |
| tree | c9528600e903e5bd7bc6084946a43c88c26c1f1c /Software/Visual_Studio/PPC/Tango.PPC.UI | |
| parent | 0f60e99c075458a746a5e574ee6f87f33c0acd75 (diff) | |
| download | Tango-ee0f4151c329542c30041ff1da91d25e8d8e2575.tar.gz Tango-ee0f4151c329542c30041ff1da91d25e8d8e2575.zip | |
Removed Firmware Upgrade Views and VM from PPC.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI')
7 files changed, 1 insertions, 318 deletions
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 862b7c891..0f088e9dd 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 @@ -133,7 +133,6 @@ <Compile Include="Threading\DefaultDispatcherProvider.cs" /> <Compile Include="ViewModelLocator.cs" /> <Compile Include="ViewModels\ExternalBridgeViewVM.cs" /> - <Compile Include="ViewModels\FirmwareUpgradeViewVM.cs" /> <Compile Include="ViewModels\LayoutViewVM.cs" /> <Compile Include="ViewModels\LoadingErrorViewVM.cs" /> <Compile Include="ViewModels\LoadingViewVM.cs" /> @@ -141,16 +140,12 @@ <Compile Include="ViewModels\MachineSetupViewVM.cs" /> <Compile Include="ViewModels\MainViewVM.cs" /> <Compile Include="ViewModels\MachineUpdateViewVM.cs" /> - <Compile Include="ViewsContracts\IFirmwareUpgradeView.cs" /> <Compile Include="ViewsContracts\ILayoutView.cs" /> <Compile Include="ViewsContracts\IMachineSetupView.cs" /> <Compile Include="ViewsContracts\IMachineUpdateView.cs" /> <Compile Include="Views\ExternalBridgeView.xaml.cs"> <DependentUpon>ExternalBridgeView.xaml</DependentUpon> </Compile> - <Compile Include="Views\FirmwareUpgradeView.xaml.cs"> - <DependentUpon>FirmwareUpgradeView.xaml</DependentUpon> - </Compile> <Compile Include="Views\LayoutView.xaml.cs"> <DependentUpon>LayoutView.xaml</DependentUpon> </Compile> @@ -208,10 +203,6 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> - <Page Include="Views\FirmwareUpgradeView.xaml"> - <SubType>Designer</SubType> - <Generator>MSBuild:Compile</Generator> - </Page> <Page Include="Views\LayoutView.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -476,7 +467,7 @@ del "$(TargetDir)firmware_package.tfp"</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 4ab3f26bd..11751d822 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs @@ -10,7 +10,6 @@ using Tango.PPC.Common.Connectivity; using Tango.PPC.Common.Diagnostics; using Tango.PPC.Common.EventLogging; using Tango.PPC.Common.ExternalBridge; -using Tango.PPC.Common.FirmwareUpgrade; using Tango.PPC.Common.MachineSetup; using Tango.PPC.Common.MachineUpdate; using Tango.PPC.Common.Modules; @@ -76,7 +75,6 @@ namespace Tango.PPC.UI TangoIOC.Default.Register<IPPCExternalBridgeService, PPCExternalBridgeService>(); TangoIOC.Default.Register<IMachineSetupManager, MachineSetupManager>(); TangoIOC.Default.Register<IMachineUpdateManager, MachineUpdateManager>(); - TangoIOC.Default.Register<IFirmwareUpgrader, DefaultFirmwareUpgrader>(); TangoIOC.Default.Register<IPrintingManager, DefaultPrintingManager>(); TangoIOC.Default.Register<IConnectivityProvider, DefaultConnectivityProvider>(); TangoIOC.Default.Register<IStorageProvider, DefaultStorageProvider>(); @@ -90,7 +88,6 @@ namespace Tango.PPC.UI TangoIOC.Default.Register<ExternalBridgeViewVM>(); TangoIOC.Default.Register<MachineSetupViewVM>(); TangoIOC.Default.Register<MachineUpdateViewVM>(); - TangoIOC.Default.Register<FirmwareUpgradeViewVM>(); TangoIOC.Default.Register<LoadingErrorViewVM>(); @@ -166,14 +163,6 @@ namespace Tango.PPC.UI } } - public static FirmwareUpgradeViewVM FirmwareUpgradeViewVM - { - get - { - return TangoIOC.Default.GetInstance<FirmwareUpgradeViewVM>(); - } - } - public static LoadingErrorViewVM LoadingErrorViewVM { get diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/FirmwareUpgradeViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/FirmwareUpgradeViewVM.cs deleted file mode 100644 index 1cde1fe1a..000000000 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/FirmwareUpgradeViewVM.cs +++ /dev/null @@ -1,170 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.Core.Commands; -using Tango.PPC.Common; -using Tango.PPC.Common.Application; -using Tango.PPC.Common.FirmwareUpgrade; -using Tango.PPC.Common.Navigation; -using Tango.PPC.UI.ViewsContracts; - -namespace Tango.PPC.UI.ViewModels -{ - public class FirmwareUpgradeViewVM : PPCViewModel<IFirmwareUpgradeView> - { - public enum FirmUpgradeView - { - FirmwareProgressView, - FirmwareCompletedView, - FirmwareFailedView, - } - - - private IFirmwareUpgrader _firmwareUpgrader; - - private String _status; - /// <summary> - /// Gets or sets the firmware upgrade status. - /// </summary> - public String Status - { - get { return _status; } - set { _status = value; RaisePropertyChangedAuto(); } - } - - private long _maxProgress; - /// <summary> - /// Gets or sets the firmware upgrade maximum progress. - /// </summary> - public long MaxProgress - { - get { return _maxProgress; } - set { _maxProgress = value; RaisePropertyChangedAuto(); } - } - - private long _progress; - /// <summary> - /// Gets or sets the firmware upgrade progress. - /// </summary> - public long Progress - { - get { return _progress; } - set { _progress = value; RaisePropertyChangedAuto(); } - } - - private bool _isIntermediate; - /// <summary> - /// Gets or sets a value indicating whether firmware upgrade progress is intermediate. - /// </summary> - public bool IsIntermediate - { - get { return _isIntermediate; } - set { _isIntermediate = value; RaisePropertyChangedAuto(); } - } - - /// <summary> - /// Gets or sets the complete command. - /// </summary> - public RelayCommand CompleteCommand { get; set; } - - public RelayCommand TryAgainCommand { get; set; } - - /// <summary> - /// Initializes a new instance of the <see cref="FirmwareUpgradeViewVM"/> class. - /// </summary> - /// <param name="applicationManager">The application manager.</param> - /// <param name="firmwareUpgrader">The firmware upgrader.</param> - public FirmwareUpgradeViewVM(IPPCApplicationManager applicationManager, IFirmwareUpgrader firmwareUpgrader) - { - _firmwareUpgrader = firmwareUpgrader; - CompleteCommand = new RelayCommand(Complete); - TryAgainCommand = new RelayCommand(TryAgain); - } - - private async void Upgrade() - { - IsIntermediate = true; - Progress = 0; - Status = "Connecting to the embedded firmware device..."; - await Task.Delay(2000); - await NavigateTo(FirmUpgradeView.FirmwareProgressView); - try - { - var handler = await _firmwareUpgrader.PerformUpgrade(); - IsIntermediate = false; - - handler.Progress += (_, e) => - { - MaxProgress = e.Total; - Progress = e.Current; - Status = e.Message; - - if (e.Status != Integration.Upgrade.FirmwareUpgradeStatus.Uploading) - { - IsIntermediate = true; - } - }; - handler.Canceled += (_, __) => - { - NavigateTo(FirmUpgradeView.FirmwareFailedView); - }; - handler.Failed += (_, ex) => - { - Status = ex.FlattenMessage(); - NavigateTo(FirmUpgradeView.FirmwareFailedView); - }; - handler.Completed += (_, __) => - { - NavigateTo(FirmUpgradeView.FirmwareCompletedView); - }; - } - catch (Exception ex) - { - Status = ex.FlattenMessage(); - LogManager.Log(ex); - await NavigateTo(FirmUpgradeView.FirmwareFailedView); - } - } - - private void Complete() - { - Restart(); - } - - private async void TryAgain() - { - await NavigateTo(FirmUpgradeView.FirmwareProgressView); - Upgrade(); - } - - private async void ApplicationManager_FirmwareUpgradeRequired(object sender, EventArgs e) - { - LogManager.Log("SetupRequired event received. Navigating to FirmwareUpgradeView..."); - await NavigationManager.NavigateTo(NavigationView.FirmwareUpgradeView); - Upgrade(); - } - - private void Restart() - { - Settings.ApplicationState = ApplicationStates.Ready; - Settings.Save(); - ApplicationManager.Restart(); - } - - /// <summary> - /// Navigates to the specified view. - /// </summary> - /// <param name="view">The view.</param> - private Task NavigateTo(FirmUpgradeView view) - { - return View.NavigateTo(view); - } - - public override void OnApplicationStarted() - { - - } - } -} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/FirmwareUpgradeView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/FirmwareUpgradeView.xaml deleted file mode 100644 index 864d4aac9..000000000 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/FirmwareUpgradeView.xaml +++ /dev/null @@ -1,60 +0,0 @@ -<UserControl x:Class="Tango.PPC.UI.Views.FirmwareUpgradeView" - 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:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" - xmlns:local="clr-namespace:Tango.PPC.UI.Views" - xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" - xmlns:global="clr-namespace:Tango.PPC.UI" - xmlns:vm="clr-namespace:Tango.PPC.UI.ViewModels" - mc:Ignorable="d" - d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:FirmwareUpgradeViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.FirmwareUpgradeViewVM}"> - <Grid Background="{StaticResource TangoPrimaryBackgroundBrush}"> - <Grid> - <DockPanel> - - <StackPanel DockPanel.Dock="Top" HorizontalAlignment="Center" Margin="0 10 0 0"> - <Image Source="/Images/machine-update-firmware.png" Stretch="None" /> - </StackPanel> - - <controls:NavigationControl x:Name="navigationControl" TransitionType="Slide" KeepElementsAttached="True" Margin="0 20 0 0" SelectedIndex="0"> - <Grid controls:NavigationControl.NavigationName="FirmwareProgressView"> - <StackPanel HorizontalAlignment="Center" Margin="0 0 0 0"> - <TextBlock TextAlignment="Center" LineHeight="40" Margin="20 0" TextWrapping="Wrap" FontSize="{StaticResource TangoTitleFontSize}"> - <Run>Now it's time to perform a firmware upgrade and verify the connection to the machine's embedded firmware. Please wait..</Run> - </TextBlock> - <TextBlock Text="{Binding Status}" DockPanel.Dock="Top" Margin="20 300 20 0" FontSize="{StaticResource TangoTitleFontSize}" HorizontalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center"></TextBlock> - <touch:TouchProgressBar Height="20" Width="700" Margin="0 40 0 0" IsIndeterminate="{Binding IsIntermediate}" Maximum="{Binding MaxProgress}" Value="{Binding Progress}" /> - </StackPanel> - </Grid> - - <Grid controls:NavigationControl.NavigationName="FirmwareCompletedView"> - <StackPanel HorizontalAlignment="Center" Margin="0 50 0 0"> - <touch:TouchIcon Icon="Check" Foreground="{StaticResource TangoPrimaryAccentBrush}" Width="70" Height="70" /> - <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0 10 0 0" Foreground="{StaticResource TangoPrimaryAccentBrush}" FontSize="{StaticResource TangoHeaderFontSize}">Machine is ready!</TextBlock> - - <touch:TouchButton Margin="0 200 0 0" Padding="20" Width="300" CornerRadius="35" Command="{Binding CompleteCommand}">RESTART</touch:TouchButton> - </StackPanel> - </Grid> - - <Grid controls:NavigationControl.NavigationName="FirmwareFailedView"> - <StackPanel HorizontalAlignment="Center" Margin="0 50 0 0"> - <touch:TouchIcon Icon="AlertOctagon" Foreground="{StaticResource TangoErrorBrush}" Width="70" Height="70" /> - <TextBlock TextAlignment="Center" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0 10 0 0" FontSize="{StaticResource TangoTitleFontSize}"> - <Run>Firmware upgrade failed.</Run> - <LineBreak/> - <Run Text="{Binding Status,Mode=OneWay}"></Run> - <LineBreak/> - <Run>Tap 'try again' to restart the process.</Run> - </TextBlock> - - <touch:TouchButton Margin="0 200 0 0" Padding="20" Width="300" CornerRadius="35" Command="{Binding TryAgainCommand}">TRY AGAIN</touch:TouchButton> - </StackPanel> - </Grid> - - </controls:NavigationControl> - </DockPanel> - </Grid> - </Grid> -</UserControl> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/FirmwareUpgradeView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/FirmwareUpgradeView.xaml.cs deleted file mode 100644 index 867309d6a..000000000 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/FirmwareUpgradeView.xaml.cs +++ /dev/null @@ -1,47 +0,0 @@ -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.Core.DI; -using Tango.PPC.UI.ViewModels; -using Tango.PPC.UI.ViewsContracts; - -namespace Tango.PPC.UI.Views -{ - /// <summary> - /// Interaction logic for FirmwareUpgradeView.xaml - /// </summary> - public partial class FirmwareUpgradeView : UserControl, IFirmwareUpgradeView - { - public FirmwareUpgradeView() - { - InitializeComponent(); - TangoIOC.Default.Register<IFirmwareUpgradeView>(this); - } - - public Task NavigateTo(FirmwareUpgradeViewVM.FirmUpgradeView view) - { - TaskCompletionSource<object> source = new TaskCompletionSource<object>(); - - this.BeginInvoke(() => - { - navigationControl.NavigateTo(view.ToString(), () => - { - source.SetResult(new object()); - }); - }); - - return source.Task; - } - } -} 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 ed15180c4..3436bb3bb 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml @@ -84,7 +84,6 @@ <local:ExternalBridgeView></local:ExternalBridgeView> <local:MachineSetupView></local:MachineSetupView> <local:MachineUpdateView></local:MachineUpdateView> - <local:FirmwareUpgradeView></local:FirmwareUpgradeView> </controls:NavigationControl> </touch:TouchPanel> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewsContracts/IFirmwareUpgradeView.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewsContracts/IFirmwareUpgradeView.cs deleted file mode 100644 index c32af83ba..000000000 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewsContracts/IFirmwareUpgradeView.cs +++ /dev/null @@ -1,19 +0,0 @@ -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.FirmwareUpgradeViewVM; - -namespace Tango.PPC.UI.ViewsContracts -{ - public interface IFirmwareUpgradeView : IPPCView - { - /// <summary> - /// Navigates to the specified firmware upgrade view. - /// </summary> - /// <param name="view">The view.</param> - Task NavigateTo(FirmUpgradeView view); - } -} |
