diff options
Diffstat (limited to 'Software/Visual_Studio/Tango.Integration/Upgrade')
| -rw-r--r-- | Software/Visual_Studio/Tango.Integration/Upgrade/FirmwareUpgradeHandler.cs | 31 | ||||
| -rw-r--r-- | Software/Visual_Studio/Tango.Integration/Upgrade/FirmwareUpgradeProgressEventArgs.cs | 5 |
2 files changed, 13 insertions, 23 deletions
diff --git a/Software/Visual_Studio/Tango.Integration/Upgrade/FirmwareUpgradeHandler.cs b/Software/Visual_Studio/Tango.Integration/Upgrade/FirmwareUpgradeHandler.cs index dd42693c4..774824b49 100644 --- a/Software/Visual_Studio/Tango.Integration/Upgrade/FirmwareUpgradeHandler.cs +++ b/Software/Visual_Studio/Tango.Integration/Upgrade/FirmwareUpgradeHandler.cs @@ -19,8 +19,6 @@ namespace Tango.Integration.Upgrade internal FirmwareUpgradeHandler() { - IsIndeterminate = true; - Total = 100; Message = "Initializing..."; } @@ -43,8 +41,8 @@ namespace Tango.Integration.Upgrade private set { _status = value; RaisePropertyChangedAuto(); } } - private double _current; - public double Current + private long _current; + public long Current { get { return _current; } internal set @@ -53,20 +51,13 @@ namespace Tango.Integration.Upgrade } } - private double _total; - public double Total + private long _total; + public long Total { get { return _total; } internal set { _total = value; RaisePropertyChangedAuto(); } } - private bool _isIndeterminate; - public bool IsIndeterminate - { - get { return _isIndeterminate; } - set { _isIndeterminate = value; RaisePropertyChangedAuto(); } - } - public Task Cancel() { return Task.Factory.StartNew(() => @@ -80,27 +71,28 @@ namespace Tango.Integration.Upgrade internal void RaiseCompleted() { - RaiseProgress(FirmwareUpgradeStatus.Completed, "Firmware upgrade completed.", false, 100, 100); + Status = FirmwareUpgradeStatus.Completed; + Message = "Completed."; Completed?.Invoke(this, new EventArgs()); } internal void RaiseCanceled() { - RaiseProgress(FirmwareUpgradeStatus.Canceled, "Firmware upgrade canceled by user.", false, 100, 0); + Status = FirmwareUpgradeStatus.Canceled; + Message = "Canceled."; Canceled?.Invoke(this, new EventArgs()); } internal void RaiseFailed(Exception ex) { - RaiseProgress(FirmwareUpgradeStatus.Failed, "Firmware upgrade failed.", false, 100, 0); + Status = FirmwareUpgradeStatus.Failed; + Message = "Failed."; Failed?.Invoke(this, ex); } - internal void RaiseProgress(FirmwareUpgradeStatus status, String message, bool isIndeterminate = true, double total = 100, double current = 0) + internal void RaiseProgress(long current, FirmwareUpgradeStatus status, String message) { - Total = total; Current = current; - IsIndeterminate = isIndeterminate; Status = status; Message = message; @@ -110,7 +102,6 @@ namespace Tango.Integration.Upgrade Status = Status, Total = Total, Message = Message, - IsIndeterminate = IsIndeterminate }); } } diff --git a/Software/Visual_Studio/Tango.Integration/Upgrade/FirmwareUpgradeProgressEventArgs.cs b/Software/Visual_Studio/Tango.Integration/Upgrade/FirmwareUpgradeProgressEventArgs.cs index 8315f4026..fa4f4cc96 100644 --- a/Software/Visual_Studio/Tango.Integration/Upgrade/FirmwareUpgradeProgressEventArgs.cs +++ b/Software/Visual_Studio/Tango.Integration/Upgrade/FirmwareUpgradeProgressEventArgs.cs @@ -8,9 +8,8 @@ namespace Tango.Integration.Upgrade { public class FirmwareUpgradeProgressEventArgs : EventArgs { - public double Current { get; set; } - public double Total { get; set; } - public bool IsIndeterminate { get; set; } + public long Current { get; set; } + public long Total { get; set; } public FirmwareUpgradeStatus Status { get; set; } public String Message { get; set; } } |
