aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Images/chip_128px.pngbin0 -> 3377 bytes
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs12
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs2
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj16
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs11
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/FirmwareUpgradeViewVM.cs169
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs98
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs2
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Views/FirmwareUpgradeView.xaml55
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Views/FirmwareUpgradeView.xaml.cs47
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml28
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml1
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewsContracts/IFirmwareUpgradeView.cs19
13 files changed, 336 insertions, 124 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/chip_128px.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/chip_128px.png
new file mode 100644
index 000000000..8e7ec780c
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/chip_128px.png
Binary files differ
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs
index 6b566dcd2..c5dab127c 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs
@@ -63,6 +63,11 @@ namespace Tango.PPC.UI.PPCApplication
public event EventHandler SetupRequired;
/// <summary>
+ /// Occurs when firmware upgrade is required.
+ /// </summary>
+ public event EventHandler FirmwareUpgradeRequired;
+
+ /// <summary>
/// Occurs when the main window content has been rendered.
/// </summary>
public event EventHandler ContentRendered;
@@ -159,7 +164,7 @@ namespace Tango.PPC.UI.PPCApplication
if (App.StartupArgs.Contains("-update_ok"))
{
LogManager.Log("Application started with '-update_ok' startup arguments. The application has been successfully updated.");
- settings.ApplicationState = ApplicationStates.Ready;
+ settings.ApplicationState = ApplicationStates.FirmwareUpgrade;
settings.Save();
}
@@ -191,6 +196,11 @@ namespace Tango.PPC.UI.PPCApplication
LogManager.Log($"The application is in {settings.ApplicationState} state. database initialization skipped. Invoking setup required event!");
SetupRequired?.Invoke(this, new EventArgs());
}
+ else if (settings.ApplicationState == ApplicationStates.FirmwareUpgrade)
+ {
+ LogManager.Log($"The application is in {settings.ApplicationState} state. database initialization skipped. Invoking firmware upgrade required event!");
+ FirmwareUpgradeRequired?.Invoke(this, new EventArgs());
+ }
else
{
PostDbInitialize();
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs
index d61c0fb6a..629afdfea 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs
@@ -8,4 +8,4 @@ using System.Windows;
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Tango PPC Application")]
-[assembly: AssemblyVersion("2.0.10.1608")]
+[assembly: AssemblyVersion("2.0.11.1608")]
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 d74e989e9..ed0092a4d 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,6 +133,7 @@
<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" />
@@ -140,12 +141,16 @@
<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>
@@ -203,6 +208,10 @@
<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>
@@ -393,6 +402,7 @@
<Link>Tango.ColorLib.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
+ <Resource Include="Images\chip_128px.png" />
<Resource Include="Images\warning-red.png" />
<Resource Include="Images\update.png" />
<Resource Include="Images\flash-drive.png" />
@@ -459,11 +469,13 @@ copy /Y "$(SolutionDir)Referenced Assemblies\mscoree.dll" "$(TargetDir)"
copy /Y "$(SolutionDir)Referenced Assemblies\msvcp140d.dll" "$(TargetDir)"
copy /Y "$(SolutionDir)Referenced Assemblies\ucrtbased.dll" "$(TargetDir)"
copy /Y "$(SolutionDir)Referenced Assemblies\vcruntime140.dll" "$(TargetDir)"
-copy /Y "$(SolutionDir)Referenced Assemblies\vcruntime140d.dll" "$(TargetDir)"</PostBuildEvent>
+copy /Y "$(SolutionDir)Referenced Assemblies\vcruntime140d.dll" "$(TargetDir)"
+
+del "$(TargetDir)firmware_package.tfp"</PostBuildEvent>
</PropertyGroup>
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
+ <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
</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 11751d822..4ab3f26bd 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModelLocator.cs
@@ -10,6 +10,7 @@ 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;
@@ -75,6 +76,7 @@ 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>();
@@ -88,6 +90,7 @@ namespace Tango.PPC.UI
TangoIOC.Default.Register<ExternalBridgeViewVM>();
TangoIOC.Default.Register<MachineSetupViewVM>();
TangoIOC.Default.Register<MachineUpdateViewVM>();
+ TangoIOC.Default.Register<FirmwareUpgradeViewVM>();
TangoIOC.Default.Register<LoadingErrorViewVM>();
@@ -163,6 +166,14 @@ 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
new file mode 100644
index 000000000..b7c36f263
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/FirmwareUpgradeViewVM.cs
@@ -0,0 +1,169 @@
+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;
+ applicationManager.FirmwareUpgradeRequired += ApplicationManager_FirmwareUpgradeRequired;
+ 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) =>
+ {
+ NavigateTo(FirmUpgradeView.FirmwareFailedView);
+ };
+ handler.Completed += (_, __) =>
+ {
+ NavigateTo(FirmUpgradeView.FirmwareCompletedView);
+ };
+ }
+ catch (Exception ex)
+ {
+ 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/ViewModels/MachineSetupViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs
index f778ff5a8..02cc4ba33 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineSetupViewVM.cs
@@ -14,6 +14,7 @@ using Tango.Logging;
using Tango.PMR.Connection;
using Tango.PPC.Common;
using Tango.PPC.Common.Application;
+using Tango.PPC.Common.Connection;
using Tango.PPC.Common.MachineSetup;
using Tango.PPC.Common.Navigation;
using Tango.PPC.UI.ViewsContracts;
@@ -46,8 +47,6 @@ namespace Tango.PPC.UI.ViewModels
WelcomeView,
WiFiSelectionView,
WiFiTestView,
- EmbeddedWelcomeView,
- EmbeddedTestView,
SetupWelcomeView,
SetupProgressView,
SetupCompletedView,
@@ -103,13 +102,6 @@ namespace Tango.PPC.UI.ViewModels
set { _state = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); }
}
- private String _machineConnectionStatus;
- public String MachineConnectionStatus
- {
- get { return _machineConnectionStatus; }
- set { _machineConnectionStatus = value; RaisePropertyChangedAuto(); }
- }
-
#endregion
#region Commands
@@ -125,16 +117,6 @@ namespace Tango.PPC.UI.ViewModels
public RelayCommand NavigateToWiFiCommand { get; set; }
/// <summary>
- /// Gets or sets the skip embedded test command.
- /// </summary>
- public RelayCommand SkipEmbeddedTestCommand { get; set; }
-
- /// <summary>
- /// Gets or sets the perform embedded test command.
- /// </summary>
- public RelayCommand PerformEmbeddedTestCommand { get; set; }
-
- /// <summary>
/// Gets or sets the install command.
/// </summary>
public RelayCommand InstallCommand { get; set; }
@@ -168,8 +150,6 @@ namespace Tango.PPC.UI.ViewModels
NavigateToWiFiCommand = new RelayCommand(EnsureWiFi);
- PerformEmbeddedTestCommand = new RelayCommand(PerformEmbeddedTest);
- SkipEmbeddedTestCommand = new RelayCommand(SkipEmbeddedTest);
InstallCommand = new RelayCommand(Install);
RestartCommand = new RelayCommand(() => { NavigateTo(MachineSetupView.WelcomeView); });
}
@@ -260,7 +240,7 @@ namespace Tango.PPC.UI.ViewModels
if (connected)
{
- await NavigateTo(MachineSetupView.EmbeddedWelcomeView);
+ await NavigateTo(MachineSetupView.SetupWelcomeView);
}
else
{
@@ -282,78 +262,6 @@ namespace Tango.PPC.UI.ViewModels
#endregion
- #region Embedded
-
- private async void PerformEmbeddedTest()
- {
- await NavigateTo(MachineSetupView.EmbeddedTestView);
-
- try
- {
- MachineConnectionStatus = "Scanning for the machine...";
-
- LogManager.Log("Starting machine connection procedure...");
-
- TimeSpan timeout = TimeSpan.FromSeconds(SettingsManager.Default.GetOrCreate<PPCSettings>().MachineScanningTimeoutSeconds);
-
- LogManager.Log("Scanning for machine on available serial ports...");
- Transport.Discovery.UsbCommunicationScanner<ConnectRequest, ConnectResponse> scanner = new Transport.Discovery.UsbCommunicationScanner<ConnectRequest, ConnectResponse>(UsbSerialBaudRates.BR_9600);
-
- scanner.ScanningPort += (port) =>
- {
- MachineConnectionStatus = $"Scanning for the machine on {port}...";
- };
-
- var response = await scanner.Scan(new ConnectRequest() { Password = "1234" }, timeout);
-
- MachineConnectionStatus = "Machine discovered on port: " + response.Adapter.Address + ", trying to connect...";
-
- LogManager.Log("Machine discovered on port: " + response.Adapter.Address);
- LogManager.Log("Device Information:");
- LogManager.Log(response.Response.DeviceInformation.ToJsonString());
-
- LogManager.Log("Disconnecting machine operator...");
-
- IMachineOperator op = new MachineOperator(response.Adapter);
-
- op.EnableDiagnostics = false;
- op.EnableEmbeddedDebugging = false;
- op.EnableEventsNotification = false;
-
- LogManager.Log("Connecting machine operator...");
- await op.Connect();
-
- MachineConnectionStatus = "Test completed successfully!";
-
- await Task.Delay(1000);
-
- try
- {
- await op.Disconnect();
- }
- catch { }
-
- await NavigateTo(MachineSetupView.SetupWelcomeView);
- }
- catch (Exception ex)
- {
- LogManager.Log(ex, "Error while trying to scan and connect to the machine.");
- MachineConnectionStatus = "Test Failed!";
- await Task.Delay(2000);
- await NavigateTo(MachineSetupView.EmbeddedWelcomeView);
- }
- }
-
- private async void SkipEmbeddedTest()
- {
- if (await NotificationProvider.ShowQuestion("Are you sure you want to skip the machine communication test?"))
- {
- await NavigateTo(MachineSetupView.SetupWelcomeView);
- }
- }
-
- #endregion
-
#region Setup
private async void Install()
@@ -371,7 +279,7 @@ namespace Tango.PPC.UI.ViewModels
Settings.Save();
State = MachineSetupStates.Completed;
LogManager.Log("Machine setup completed.");
- await NavigateTo(MachineSetupView.SetupCompletedView);
+ CompleteSetup();
}
catch (Exception ex)
{
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs
index fc1de5de1..108752976 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs
@@ -167,7 +167,7 @@ namespace Tango.PPC.UI.ViewModels
{
_update_result = await MachineUpdateManager.Update(MachineProvider.Machine.SerialNumber, Settings.MachineServiceAddress);
LogManager.Log("Machine update completed.");
- await NavigateTo(MachineUpdateView.UpdateCompletedView);
+ CompleteUpdate();
}
catch (Exception ex)
{
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/FirmwareUpgradeView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/FirmwareUpgradeView.xaml
new file mode 100644
index 000000000..985e00291
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/FirmwareUpgradeView.xaml
@@ -0,0 +1,55 @@
+<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 100 0 0">
+ <Image Source="/Images/chip_128px.png" Width="128" Height="128" />
+ <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoHeaderFontSize}" Margin="50">FIRMWARE UPGRADE</TextBlock>
+ </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 VerticalAlignment="Center" Margin="0 10 0 0" Foreground="{StaticResource TangoErrorBrush}" FontSize="{StaticResource TangoTitleFontSize}">Firmware upgrade failed, tap 'try again' to restart the process.</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
new file mode 100644
index 000000000..867309d6a
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/FirmwareUpgradeView.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.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/MachineSetupView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml
index d397cfa35..4ac6dab92 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineSetupView.xaml
@@ -33,7 +33,7 @@
<Grid controls:NavigationControl.NavigationName="WelcomeView">
<StackPanel HorizontalAlignment="Center" Margin="0 100 0 0">
- <TextBlock TextAlignment="Center" LineHeight="20" Margin="20 0" TextWrapping="Wrap" FontSize="{StaticResource TangoTitleFontSize}">
+ <TextBlock TextAlignment="Center" LineHeight="40" Margin="20 0" TextWrapping="Wrap" FontSize="{StaticResource TangoTitleFontSize}">
<Run>Welcome to the machine setup wizard!</Run>
<Run>In the next steps the software will gather required information, perform tests and apply an initial configuration to this machine.</Run>
<LineBreak/>
@@ -67,29 +67,9 @@
</StackPanel>
</Grid>
- <Grid controls:NavigationControl.NavigationName="EmbeddedWelcomeView">
- <StackPanel HorizontalAlignment="Center" Margin="0 100 0 0">
- <TextBlock TextAlignment="Center" LineHeight="20" Margin="20 0" TextWrapping="Wrap" FontSize="{StaticResource TangoTitleFontSize}">
- <Run>It is recommended to perform a quick communication test with the machine before proceeding. Please turn on and connect the machine, then tap 'perform test'.</Run>
- </TextBlock>
-
- <StackPanel Orientation="Horizontal" Margin="0 250 0 0" HorizontalAlignment="Center">
- <touch:TouchButton Margin="10" Background="{StaticResource TangoGrayBrush}" Padding="20" Width="300" CornerRadius="35" Command="{Binding SkipEmbeddedTestCommand}">SKIP</touch:TouchButton>
- <touch:TouchButton Margin="10" Padding="20" Width="300" CornerRadius="35" Command="{Binding PerformEmbeddedTestCommand}">PERFORM TEST</touch:TouchButton>
- </StackPanel>
- </StackPanel>
- </Grid>
-
- <Grid controls:NavigationControl.NavigationName="EmbeddedTestView">
- <StackPanel HorizontalAlignment="Center" Margin="0 200 0 0">
- <TextBlock Text="{Binding MachineConnectionStatus}" DockPanel.Dock="Top" Margin="20 0" FontSize="{StaticResource TangoTitleFontSize}" HorizontalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center"></TextBlock>
- <touch:TouchProgressBar Height="20" Width="700" Margin="0 40 0 0" IsIndeterminate="True" />
- </StackPanel>
- </Grid>
-
<Grid controls:NavigationControl.NavigationName="SetupWelcomeView">
<StackPanel>
- <TextBlock TextAlignment="Center" LineHeight="25" FontSize="{StaticResource TangoTitleFontSize}" Margin="40 0" TextWrapping="Wrap">
+ <TextBlock TextAlignment="Center" LineHeight="40" FontSize="{StaticResource TangoTitleFontSize}" Margin="40 0" TextWrapping="Wrap">
The next step is to download the latest software package and synchronize the machine data. Please enter your machine serial number and press 'install'.
</TextBlock>
@@ -110,7 +90,7 @@
<Grid controls:NavigationControl.NavigationName="SetupProgressView">
<StackPanel>
<TextBlock TextAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">
- <Run>Please wait while we setting up this machine.</Run>
+ <Run>Please wait while we're setting up this machine.</Run>
<Run>Do not turn off this PC.</Run>
</TextBlock>
@@ -126,7 +106,7 @@
</Style>
</touch:TouchBusyIndicator.Style>
</touch:TouchBusyIndicator>
- <touch:TouchStepProgressBar FontSize="10" Width="720" Height="50" Margin="0 100 0 0" ItemsSource="{Binding Source={x:Type setup:MachineSetupSteps},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding MachineSetupManager.CurrentStep}" SelectedValuePath="Value" DisplayMemberPath="DisplayName" />
+ <touch:TouchStepProgressBar FontSize="12" Width="720" Height="50" Margin="0 100 0 0" ItemsSource="{Binding Source={x:Type setup:MachineSetupSteps},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding MachineSetupManager.CurrentStep}" SelectedValuePath="Value" DisplayMemberPath="DisplayName" />
<StackPanel Margin="100 100 100 0" Visibility="{Binding MachineSetupManager.CurrentStep,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter='DownloadingPackage'}">
<TextBlock Text="{Binding MachineSetupManager.DownloadingPackagesStatus,Mode=OneWay}"></TextBlock>
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 3436bb3bb..ed15180c4 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MainView.xaml
@@ -84,6 +84,7 @@
<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
new file mode 100644
index 000000000..c32af83ba
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewsContracts/IFirmwareUpgradeView.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.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);
+ }
+}