diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2019-02-17 01:49:32 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2019-02-17 01:49:32 +0200 |
| commit | da39ba78af62aa19f40d755d870dbfe321fbde2e (patch) | |
| tree | ff95e65169635234ce10cdcf0c44b3f801ea17c5 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI | |
| parent | e2a5664b9425953e33b39c21dab8d5c24adfa78f (diff) | |
| parent | 5f3cb9b25e937a0e9a4a3102cd26e6e3b94e5dfa (diff) | |
| download | Tango-da39ba78af62aa19f40d755d870dbfe321fbde2e.tar.gz Tango-da39ba78af62aa19f40d755d870dbfe321fbde2e.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI')
2 files changed, 24 insertions, 0 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/FirmwareUpgradeViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/FirmwareUpgradeViewVM.cs index 09b63cfc9..14b9d0d8e 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/FirmwareUpgradeViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/FirmwareUpgradeViewVM.cs @@ -5,11 +5,14 @@ using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; +using System.Windows; +using System.Windows.Input; using Tango.Core.Commands; using Tango.Integration.Operation; using Tango.Integration.Upgrade; using Tango.MachineStudio.Common.Notifications; using Tango.SharedUI; +using Tango.SharedUI.Helpers; namespace Tango.MachineStudio.UI.ViewModels { @@ -96,6 +99,10 @@ namespace Tango.MachineStudio.UI.ViewModels try { + IsFree = false; + + _operator.FirmwareUpgradeMode = FirmwareUpgradeModes.DFU; + _stream = new FileStream(SelectedFile, FileMode.Open); Handler = await _operator.UpgradeFirmware(_stream); Handler.Progress += (_, e) => @@ -104,18 +111,22 @@ namespace Tango.MachineStudio.UI.ViewModels { AbortCommand.RaiseCanExecuteChanged(); }); + + UIHelper.DoEvents(); }; Handler.Completed += (_, __) => { CanClose = true; _stream.Dispose(); CurrentPage = 2; + IsFree = true; }; Handler.Canceled += (_, __) => { CanClose = true; _stream.Dispose(); CurrentPage = 0; + IsFree = true; }; Handler.Failed += (_, ex) => { @@ -123,10 +134,12 @@ namespace Tango.MachineStudio.UI.ViewModels CanClose = true; _stream.Dispose(); CurrentPage = 3; + IsFree = true; }; } catch (Exception ex) { + IsFree = true; CanClose = true; UpgradeError = ex.FlattenMessage(); CurrentPage = 3; diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/FirmwareUpgradeView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/FirmwareUpgradeView.xaml index 84f4b2d92..4de64db12 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/FirmwareUpgradeView.xaml +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/FirmwareUpgradeView.xaml @@ -14,6 +14,17 @@ <UserControl.Resources> <converters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter" /> </UserControl.Resources> + + <UserControl.Style> + <Style TargetType="UserControl"> + <Setter Property="Cursor" Value="Arrow"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsFree}" Value="False"> + <Setter Property="Cursor" Value="Wait"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </UserControl.Style> <Grid> <Grid Margin="10"> |
