aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-05-25 17:27:24 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-05-25 17:27:24 +0300
commit7689f77fe2f356d17a5ad59dbeb4a0fed3ca4a0d (patch)
treede4a7897e4cd322435bab966769d98aeea324687 /Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels
parent9e6f2a37d528a1bf50629dc7132f1e4496114aee (diff)
downloadTango-7689f77fe2f356d17a5ad59dbeb4a0fed3ca4a0d.tar.gz
Tango-7689f77fe2f356d17a5ad59dbeb4a0fed3ca4a0d.zip
Added PPC power up sequence support !
Refactored AppBarItems implementation.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs42
1 files changed, 40 insertions, 2 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs
index b53a54682..e84fd81a1 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs
@@ -21,6 +21,7 @@ using Tango.PPC.Common.WatchDog;
using Tango.PPC.UI.Dialogs;
using Tango.SharedUI;
using System.Data.Entity;
+using Tango.PPC.UI.AppBarItems;
namespace Tango.PPC.UI.ViewModels
{
@@ -33,6 +34,7 @@ namespace Tango.PPC.UI.ViewModels
private DispatcherTimer _date_timer;
private bool _isPowerUpDialogShown;
private bool _isThreadLoadingShown;
+ private PowerUpAppBarItem _powerUpAppBar;
private DateTime _currentDateTime;
/// <summary>
@@ -64,11 +66,47 @@ namespace Tango.PPC.UI.ViewModels
{
base.OnApplicationReady();
MachineProvider.MachineOperator.CartridgeValidationRequestReceived += MachineOperator_CartridgeValidationRequestReceived;
- MachineProvider.MachineOperator.PowerUpStarted += MachineOperator_PowerUpStarted;
+ MachineProvider.MachineOperator.FirmwareStarted += MachineOperator_FirmwareStarted;
MachineProvider.MachineOperator.ThreadLoadingStatusChanged += MachineOperator_ThreadLoadingStatusChanged;
MachineProvider.MachineOperator.ThreadLoadingConfirmationRequired += MachineOperator_ThreadLoadingConfirmationRequired;
+
+ MachineProvider.MachineOperator.PowerUpStarted += MachineOperator_PowerUpStarted;
+ MachineProvider.MachineOperator.PowerUpProgress += MachineOperator_PowerUpProgress;
+ MachineProvider.MachineOperator.PowerUpEnded += MachineOperator_PowerUpEnded;
+ }
+
+ #region Power Up
+
+ private void MachineOperator_PowerUpEnded(object sender, EventArgs e)
+ {
+ _powerUpAppBar?.Close();
+ _powerUpAppBar = null;
+ }
+
+ private void MachineOperator_PowerUpProgress(object sender, PMR.Power.StartPowerUpResponse status)
+ {
+ if (_powerUpAppBar != null)
+ {
+ _powerUpAppBar.Status = status;
+ }
}
+ private void MachineOperator_PowerUpStarted(object sender, PMR.Power.StartPowerUpResponse e)
+ {
+ InvokeUI(() =>
+ {
+ if (_powerUpAppBar != null)
+ {
+ _powerUpAppBar.Close();
+ }
+
+ _powerUpAppBar = NotificationProvider.PushAppBarItem<PowerUpAppBarItem>();
+ _powerUpAppBar.Priority = AppBarPriority.Low;
+ });
+ }
+
+ #endregion
+
#region Event Handlers
/// <summary>
@@ -101,7 +139,7 @@ namespace Tango.PPC.UI.ViewModels
});
}
- private async void MachineOperator_PowerUpStarted(object sender, EventArgs e)
+ private async void MachineOperator_FirmwareStarted(object sender, EventArgs e)
{
if (_isPowerUpDialogShown)
{