diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-02-14 18:50:59 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-02-14 18:50:59 +0200 |
| commit | 73196dd48da9d16b6949ab9dec0ae0a5d63accfe (patch) | |
| tree | 04bbaade70fb016423d7cd43161f4cbc8bc04b79 /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/FirmwareUpgradeViewVM.cs | |
| parent | b6283ab40fafa8e738e8e3fec260777a4d250597 (diff) | |
| download | Tango-73196dd48da9d16b6949ab9dec0ae0a5d63accfe.tar.gz Tango-73196dd48da9d16b6949ab9dec0ae0a5d63accfe.zip | |
Working on DFU firmware upgrade...
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/FirmwareUpgradeViewVM.cs')
| -rw-r--r-- | Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/FirmwareUpgradeViewVM.cs | 13 |
1 files changed, 13 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; |
