aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio
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
parent9e6f2a37d528a1bf50629dc7132f1e4496114aee (diff)
downloadTango-7689f77fe2f356d17a5ad59dbeb4a0fed3ca4a0d.tar.gz
Tango-7689f77fe2f356d17a5ad59dbeb4a0fed3ca4a0d.zip
Added PPC power up sequence support !
Refactored AppBarItems implementation.
Diffstat (limited to 'Software/Visual_Studio')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs17
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs1
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/AppBarItem.cs10
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/AppBarPriority.cs15
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs10
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj3
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/AppBarItems/PowerUpAppBarItem.cs31
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/AppBarItems/PowerUpAppBarItemView.xaml30
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/AppBarItems/PowerUpAppBarItemView.xaml.cs28
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs38
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj10
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs42
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml17
-rw-r--r--Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs41
-rw-r--r--Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs33
-rw-r--r--Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs150
16 files changed, 396 insertions, 80 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs
index 03cd5bfff..b4a30cb39 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobProgressViewVM.cs
@@ -9,6 +9,7 @@ using Tango.Integration.Operation;
using Tango.PMR.Printing;
using Tango.PPC.Common;
using Tango.PPC.Common.Navigation;
+using Tango.PPC.Common.Notifications;
using Tango.PPC.Jobs.AppBarItems;
using Tango.PPC.Jobs.AppButtons;
using Tango.PPC.Jobs.Dialogs;
@@ -25,6 +26,7 @@ namespace Tango.PPC.Jobs.ViewModels
{
private StopPrintingButton _stop_job_btn;
private JobHandler _handler;
+ private JobProgressAppBarItem _appBarItem;
#region Properties
@@ -142,9 +144,10 @@ namespace Tango.PPC.Jobs.ViewModels
if (MachineProvider.MachineOperator.IsPrinting && _handler != null && !_handler.IsCanceled)
{
- NotificationProvider.PushAppBarItem<JobProgressAppBarItem>().Pressed += (_, __) =>
+ _appBarItem = NotificationProvider.PushAppBarItem<JobProgressAppBarItem>();
+ _appBarItem.Pressed += (_, __) =>
{
- NotificationProvider.CurrentAppBarItem.Close();
+ _appBarItem?.Close();
NavigationManager.NavigateTo<JobsModule>(nameof(JobProgressView));
};
}
@@ -159,10 +162,7 @@ namespace Tango.PPC.Jobs.ViewModels
IsDisplayJobOutline = false;
- if (NotificationProvider.HasAppBarItem && NotificationProvider.CurrentAppBarItem is JobProgressAppBarItem)
- {
- NotificationProvider.CurrentAppBarItem.Close();
- }
+ _appBarItem?.Close();
if (_handler != null && !_handler.Status.IsFailed)
{
@@ -232,10 +232,7 @@ namespace Tango.PPC.Jobs.ViewModels
_stop_job_btn.Pop();
}
- if (NotificationProvider.HasAppBarItem && NotificationProvider.CurrentAppBarItem is JobProgressAppBarItem)
- {
- NotificationProvider.CurrentAppBarItem.Close();
- }
+ _appBarItem?.Close();
if (_handler != null)
{
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs
index 3d77aa4e2..84190d373 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Connection/DefaultMachineProvider.cs
@@ -104,6 +104,7 @@ namespace Tango.PPC.Common.Connection
MachineOperator.UseKeepAlive = true;
MachineOperator.EnableMachineStatusUpdates = true;
MachineOperator.EnableDiagnostics = true;
+ MachineOperator.EnablePowerUpSequence = true;
MachineOperator.EnableEmbeddedDebugging = settings.EnableEmbeddedDebugLogs;
MachineOperator.EnableAutomaticThreadLoading = settings.EnableAutomaticThreadLoading;
MachineOperator.JobRunsLogger.JobSource = BL.Enumerations.JobSource.Local;
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/AppBarItem.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/AppBarItem.cs
index 1c47d2a97..fdd66a56b 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/AppBarItem.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/AppBarItem.cs
@@ -13,6 +13,16 @@ namespace Tango.PPC.Common.Notifications
/// </summary>
public abstract class AppBarItem : ItemBase
{
+ private AppBarPriority _priority;
+ public AppBarPriority Priority
+ {
+ get { return _priority; }
+ set { _priority = value; RaisePropertyChangedAuto(); }
+ }
+ public AppBarItem()
+ {
+ Priority = AppBarPriority.Normal;
+ }
}
}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/AppBarPriority.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/AppBarPriority.cs
new file mode 100644
index 000000000..bd8547f5d
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/AppBarPriority.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.PPC.Common.Notifications
+{
+ public enum AppBarPriority
+ {
+ Low,
+ Normal,
+ High
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs
index 4a0627d70..950b8d23f 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Notifications/INotificationProvider.cs
@@ -34,14 +34,14 @@ namespace Tango.PPC.Common.Notifications
ObservableCollection<TaskBarItem> TaskBarItems { get; }
/// <summary>
- /// Gets the current application bar item.
+ /// Gets the application bar items.
/// </summary>
- AppBarItem CurrentAppBarItem { get; }
+ ObservableCollection<AppBarItem> AppBarItems { get; }
/// <summary>
- /// Gets a value indicating whether this instance has application bar item.
+ /// Gets a value indicating whether this instance has any application bar items.
/// </summary>
- bool HasAppBarItem { get; }
+ bool HasAppBarItems { get; }
/// <summary>
/// Gets a value indicating whether this instance has notification items.
@@ -182,7 +182,7 @@ namespace Tango.PPC.Common.Notifications
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
- AppBarItem PushAppBarItem<T>() where T : AppBarItem;
+ T PushAppBarItem<T>() where T : AppBarItem;
/// <summary>
/// Pops the application bar item.
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj
index 9bdba2c63..14c1a54ff 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj
+++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Tango.PPC.Common.csproj
@@ -168,6 +168,7 @@
<Compile Include="MachineSetup\MachineSetupManager.cs" />
<Compile Include="MachineSetup\MachineSetupProgress.cs" />
<Compile Include="MachineSetup\MachineSetupResult.cs" />
+ <Compile Include="Notifications\AppBarPriority.cs" />
<Compile Include="Performance\DefaultPerformanceService.cs" />
<Compile Include="Performance\IPerformanceService.cs" />
<Compile Include="RemoteDesktop\DefaultRemoteDesktopService.cs" />
@@ -462,7 +463,7 @@
</Target>
<ProjectExtensions>
<VisualStudio>
- <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" />
+ <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" />
</VisualStudio>
</ProjectExtensions>
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/AppBarItems/PowerUpAppBarItem.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/AppBarItems/PowerUpAppBarItem.cs
new file mode 100644
index 000000000..966e78769
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/AppBarItems/PowerUpAppBarItem.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.PMR.Power;
+using Tango.PPC.Common.Notifications;
+
+namespace Tango.PPC.UI.AppBarItems
+{
+ public class PowerUpAppBarItem : AppBarItem
+ {
+ private StartPowerUpResponse _status;
+ public StartPowerUpResponse Status
+ {
+ get { return _status; }
+ set { _status = value; RaisePropertyChangedAuto(); }
+ }
+
+ /// <summary>
+ /// Gets or sets the view type.
+ /// </summary>
+ public override Type ViewType
+ {
+ get
+ {
+ return typeof(PowerUpAppBarItemView);
+ }
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/AppBarItems/PowerUpAppBarItemView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/AppBarItems/PowerUpAppBarItemView.xaml
new file mode 100644
index 000000000..b6b769c69
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/AppBarItems/PowerUpAppBarItemView.xaml
@@ -0,0 +1,30 @@
+<UserControl x:Class="Tango.PPC.UI.AppBarItems.PowerUpAppBarItemView"
+ 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:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch"
+ xmlns:local="clr-namespace:Tango.PPC.UI.AppBarItems"
+ mc:Ignorable="d"
+ d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=local:PowerUpAppBarItem, IsDesignTimeCreatable=False}">
+ <Grid>
+ <touch:TouchButton Style="{StaticResource TangoFlatButton}" Command="{Binding PressedCommand}" Padding="0">
+ <StackPanel VerticalAlignment="Center">
+ <TextBlock Text="{Binding Status.Message}" FontSize="{StaticResource TangoDefaultFontSize}" TextTrimming="CharacterEllipsis"></TextBlock>
+ <ProgressBar Maximum="100" Value="{Binding Status.ProgressPercentage}" Margin="0 10 0 5" Background="{StaticResource TangoGrayBrush}" Height="5" Foreground="{StaticResource TangoPrimaryAccentBrush}" BorderThickness="0" />
+ <DockPanel LastChildFill="False">
+ <TextBlock DockPanel.Dock="Left">
+
+ <Run Text="{Binding Status.ProgressPercentage}"></Run><Run>%</Run>
+ <Run>Completed</Run>
+ </TextBlock>
+
+ <!--<TextBlock DockPanel.Dock="Right">
+ <Run Text="{Binding MachineProvider.MachineOperator.RunningJobStatus.RemainingTime,Converter={StaticResource TimeSpanToTwoDigitsTimeConverter},FallbackValue=5}"></Run>
+ <Run FontSize="16" Text="{Binding MachineProvider.MachineOperator.RunningJobStatus.RemainingTime,Converter={StaticResource TimeSpanToLabelConverter},FallbackValue=min}"></Run>
+ </TextBlock>-->
+ </DockPanel>
+ </StackPanel>
+ </touch:TouchButton>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/AppBarItems/PowerUpAppBarItemView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/AppBarItems/PowerUpAppBarItemView.xaml.cs
new file mode 100644
index 000000000..599f24d3b
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/AppBarItems/PowerUpAppBarItemView.xaml.cs
@@ -0,0 +1,28 @@
+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;
+
+namespace Tango.PPC.UI.AppBarItems
+{
+ /// <summary>
+ /// Interaction logic for PowerOffAppBarItemView.xaml
+ /// </summary>
+ public partial class PowerUpAppBarItemView : UserControl
+ {
+ public PowerUpAppBarItemView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs
index 3b1e1e2f5..e9de2538e 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs
@@ -49,6 +49,11 @@ namespace Tango.PPC.UI.Notifications
public ObservableCollection<NotificationItem> NotificationItems { get; private set; }
/// <summary>
+ /// Gets the application bar items.
+ /// </summary>
+ public ObservableCollection<AppBarItem> AppBarItems { get; private set; }
+
+ /// <summary>
/// Gets the notification items view.
/// </summary>
public ICollectionView NotificationItemsView { get; private set; }
@@ -65,6 +70,10 @@ namespace Tango.PPC.UI.Notifications
{
NotificationsVisible = true;
NotificationItems = new ObservableCollection<NotificationItem>();
+
+ AppBarItems = new ObservableCollection<AppBarItem>();
+ CollectionViewSource.GetDefaultView(AppBarItems).SortDescriptions.Add(new SortDescription(nameof(AppBarItem.Priority), ListSortDirection.Ascending));
+
TaskBarItems = new ObservableCollection<TaskBarItem>();
_pendingMessageBoxes = new ConcurrentQueue<PendingNotification<MessageBoxVM, bool>>();
_pendingDialogs = new ConcurrentQueue<PendingNotification<DialogAndView, DialogViewVM>>();
@@ -472,22 +481,12 @@ namespace Tango.PPC.UI.Notifications
/// </summary>
public bool IsInGlobalBusyState { get; private set; }
- private AppBarItem _currentAppBarItem;
- /// <summary>
- /// Gets the current application bar item.
- /// </summary>
- public AppBarItem CurrentAppBarItem
- {
- get { return _currentAppBarItem; }
- set { _currentAppBarItem = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(HasAppBarItem)); }
- }
-
/// <summary>
/// Gets a value indicating whether this instance has application bar item.
/// </summary>
- public bool HasAppBarItem
+ public bool HasAppBarItems
{
- get { return CurrentAppBarItem != null; }
+ get { return AppBarItems.Count > 0; }
}
/// <summary>
@@ -498,8 +497,9 @@ namespace Tango.PPC.UI.Notifications
public AppBarItem PushAppBarItem(AppBarItem appBarItem)
{
LogManager.Log($"Pushing AppBarItem '{appBarItem.GetType().Name}'.");
- CurrentAppBarItem = appBarItem;
+ AppBarItems.Add(appBarItem);
appBarItem.RemoveAction = () => PopAppBarItem(appBarItem);
+ RaisePropertyChanged(nameof(HasAppBarItems));
return appBarItem;
}
@@ -508,9 +508,9 @@ namespace Tango.PPC.UI.Notifications
/// </summary>
/// <typeparam name="T"></typeparam>
/// <returns></returns>
- public AppBarItem PushAppBarItem<T>() where T : AppBarItem
+ public T PushAppBarItem<T>() where T : AppBarItem
{
- return PushAppBarItem(Activator.CreateInstance<T>());
+ return PushAppBarItem(Activator.CreateInstance<T>()) as T;
}
/// <summary>
@@ -519,8 +519,12 @@ namespace Tango.PPC.UI.Notifications
/// <param name="appBarItem">The application bar item.</param>
public void PopAppBarItem(AppBarItem appBarItem)
{
- LogManager.Log($"Popping out AppBarItem '{appBarItem.GetType().Name}'.");
- CurrentAppBarItem = null;
+ InvokeUI(() =>
+ {
+ LogManager.Log($"Popping out AppBarItem '{appBarItem.GetType().Name}'.");
+ AppBarItems.Remove(appBarItem);
+ RaisePropertyChanged(nameof(HasAppBarItems));
+ });
}
/// <summary>
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 10d3a82a5..0cdf78614 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
@@ -114,7 +114,11 @@
<Compile Include="..\..\Versioning\GlobalVersionInfo.cs">
<Link>GlobalVersionInfo.cs</Link>
</Compile>
+ <Compile Include="AppBarItems\PowerUpAppBarItem.cs" />
<Compile Include="AppBarItems\PowerOffAppBarItem.cs" />
+ <Compile Include="AppBarItems\PowerUpAppBarItemView.xaml.cs">
+ <DependentUpon>PowerUpAppBarItemView.xaml</DependentUpon>
+ </Compile>
<Compile Include="AppBarItems\PowerOffAppBarItemView.xaml.cs">
<DependentUpon>PowerOffAppBarItemView.xaml</DependentUpon>
</Compile>
@@ -238,6 +242,10 @@
<Compile Include="Views\RestartingSystemView.xaml.cs">
<DependentUpon>RestartingSystemView.xaml</DependentUpon>
</Compile>
+ <Page Include="AppBarItems\PowerUpAppBarItemView.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
<Page Include="AppBarItems\PowerOffAppBarItemView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -705,7 +713,7 @@ if $(ConfigurationName) == Debug copy /Y "$(TargetDir)Packages" "$(TargetDir)"</
</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/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)
{
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml
index 1700749c2..21cc90f2d 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml
@@ -284,8 +284,21 @@
</Grid>
<Grid>
- <Grid Margin="20 0 60 0" Height="80" Visibility="{Binding NotificationProvider.HasAppBarItem,Converter={StaticResource BooleanToVisibilityConverter}}">
- <ContentControl Content="{Binding NotificationProvider.CurrentAppBarItem,Converter={StaticResource AppBarItemConverter}}"></ContentControl>
+ <Grid Margin="20 0 60 0" Height="80" Visibility="{Binding NotificationProvider.HasAppBarItems,Converter={StaticResource BooleanToVisibilityConverter}}">
+ <ItemsControl ItemsSource="{Binding NotificationProvider.AppBarItems}">
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <Grid IsItemsHost="True" />
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <Grid Background="{StaticResource TangoPrimaryBackgroundBrush}">
+ <ContentControl Content="{Binding Converter={StaticResource AppBarItemConverter}}"></ContentControl>
+ </Grid>
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
</Grid>
<!--External Header Content Here-->
diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs
index c2be3c22b..0fe3f280d 100644
--- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs
+++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs
@@ -425,6 +425,9 @@ namespace Tango.Emulations.Emulators
case MessageType.AbortHeadCleaningRequest:
HandleAbortHeadCleaningRequest(MessageFactory.ParseTangoMessageFromContainer<AbortHeadCleaningRequest>(container));
break;
+ case MessageType.StartPowerUpRequest:
+ HandleStartPowerUpRequest(MessageFactory.ParseTangoMessageFromContainer<StartPowerUpRequest>(container));
+ break;
}
}
@@ -750,7 +753,7 @@ namespace Tango.Emulations.Emulators
}
progress += Math.Min((centimeter_per_second / 1000d), (unit_length + (i == units - 1 ? (job.ProcessParameters.DryerBufferLength * ProcessParametersTable.DRYER_METERS_PER_CYCLE + ProcessParametersTable.DRYER_TO_SPOOL_LENGTH_METERS) : 0)) - progress);
-
+
double currentPosition = 0;
double nextStopPosition = unit_length;
for (int seg_index = 0; seg_index < _current_job_ticket.Segments.Count(); seg_index++)
@@ -836,7 +839,7 @@ namespace Tango.Emulations.Emulators
{
if (_current_job_resume_token == null)
{
- Transporter.SendResponse<JobResponse>(new JobResponse()
+ Transporter.SendResponse<JobResponse>(new JobResponse()
{
Status = new PMR.Printing.JobStatus()
{
@@ -847,7 +850,7 @@ namespace Tango.Emulations.Emulators
}
else
{
- Transporter.SendResponse<ResumeCurrentJobResponse>(new ResumeCurrentJobResponse()
+ Transporter.SendResponse<ResumeCurrentJobResponse>(new ResumeCurrentJobResponse()
{
Status = new PMR.Printing.JobStatus()
{
@@ -1582,6 +1585,38 @@ namespace Tango.Emulations.Emulators
}
}
+ private async void HandleStartPowerUpRequest(TangoMessage<StartPowerUpRequest> request)
+ {
+ await Transporter.SendResponse(new StartPowerUpResponse() { Message = "Power up started...", ProgressPercentage = 10, State = PowerUpState.BuiltInTest }, request.Container.Token);
+ Thread.Sleep(1000);
+
+ await Transporter.SendResponse(new StartPowerUpResponse() { Message = "Testing dispensers...", ProgressPercentage = 20, State = PowerUpState.DispenserPressureBuildupTest }, request.Container.Token);
+ Thread.Sleep(1000);
+
+ await Transporter.SendResponse(new StartPowerUpResponse() { Message = "Heating started...", ProgressPercentage = 30, State = PowerUpState.HeatingStarted }, request.Container.Token);
+ Thread.Sleep(1000);
+
+ await Transporter.SendResponse(new StartPowerUpResponse() { Message = "Heating started...", ProgressPercentage = 40, State = PowerUpState.HwConfig }, request.Container.Token);
+ Thread.Sleep(1000);
+
+ await Transporter.SendResponse(new StartPowerUpResponse() { Message = "Hardware configuration...", ProgressPercentage = 50, State = PowerUpState.HwConfig }, request.Container.Token);
+ Thread.Sleep(1000);
+
+ await Transporter.SendResponse(new StartPowerUpResponse() { Message = "Initializing blower...", ProgressPercentage = 60, State = PowerUpState.InitialBlowerActivation }, request.Container.Token);
+ Thread.Sleep(1000);
+
+ await Transporter.SendResponse(new StartPowerUpResponse() { Message = "Thread detection...", ProgressPercentage = 70, State = PowerUpState.ThreadDetection }, request.Container.Token);
+ Thread.Sleep(1000);
+
+ await Transporter.SendResponse(new StartPowerUpResponse() { Message = "Waiting for cooler...", ProgressPercentage = 80, State = PowerUpState.WaitForCooler }, request.Container.Token);
+ Thread.Sleep(4000);
+
+ await Transporter.SendResponse(new StartPowerUpResponse() { Message = "Ready to dye...", ProgressPercentage = 90, State = PowerUpState.MachineReadyToDye }, request.Container.Token,new TransportResponseConfig()
+ {
+ Completed = true
+ });
+ }
+
#endregion
#region Public Methods
diff --git a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs
index 761ed5644..d006848de 100644
--- a/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs
+++ b/Software/Visual_Studio/Tango.Integration/Operation/IMachineOperator.cs
@@ -24,6 +24,7 @@ using Tango.Integration.JobRuns;
using Tango.Integration.Emergency;
using Tango.PMR.MachineStatus;
using Tango.PMR.ThreadLoading;
+using Tango.PMR.Power;
namespace Tango.Integration.Operation
{
@@ -187,7 +188,32 @@ namespace Tango.Integration.Operation
/// <summary>
/// Occurs when the machine was connected and device has reported IsAfterReset.
/// </summary>
- event EventHandler PowerUpStarted;
+ event EventHandler FirmwareStarted;
+
+ /// <summary>
+ /// Occurs when the power up sequence has started.
+ /// </summary>
+ event EventHandler<StartPowerUpResponse> PowerUpStarted;
+
+ /// <summary>
+ /// Occurs when the power up sequence progress has changed.
+ /// </summary>
+ event EventHandler<StartPowerUpResponse> PowerUpProgress;
+
+ /// <summary>
+ /// Occurs when power up sequence has completed successfully.
+ /// </summary>
+ event EventHandler<StartPowerUpResponse> PowerUpCompleted;
+
+ /// <summary>
+ /// Occurs when power up sequence has failed.
+ /// </summary>
+ event EventHandler<StartPowerUpResponse> PowerUpFailed;
+
+ /// <summary>
+ /// Occurs when power up sequence has ended. Could be due to no response to the request!
+ /// </summary>
+ event EventHandler PowerUpEnded;
/// <summary>
/// Occurs when power down has started.
@@ -245,6 +271,11 @@ namespace Tango.Integration.Operation
bool EnableAutomaticThreadLoading { get; set; }
/// <summary>
+ /// Gets or sets a value indicating whether to enable the power sequence tracking.
+ /// </summary>
+ bool EnablePowerUpSequence { get; set; }
+
+ /// <summary>
/// Gets the last process parameters table sent to the embedded device.
/// </summary>
ProcessParametersTable CurrentProcessParameters { get; }
diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
index e6db7fcfc..c40429375 100644
--- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
+++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs
@@ -214,7 +214,7 @@ namespace Tango.Integration.Operation
/// <summary>
/// Occurs when the machine was connected and device has reported IsAfterReset.
/// </summary>
- public event EventHandler PowerUpStarted;
+ public event EventHandler FirmwareStarted;
/// <summary>
/// Occurs when power down has started.
@@ -241,6 +241,31 @@ namespace Tango.Integration.Operation
/// </summary>
public event EventHandler<StartThreadLoadingResponse> ThreadLoadingFailed;
+ /// <summary>
+ /// Occurs when the power up sequence has started.
+ /// </summary>
+ public event EventHandler<StartPowerUpResponse> PowerUpStarted;
+
+ /// <summary>
+ /// Occurs when the power up sequence progress has changed.
+ /// </summary>
+ public event EventHandler<StartPowerUpResponse> PowerUpProgress;
+
+ /// <summary>
+ /// Occurs when power up sequence has completed successfully.
+ /// </summary>
+ public event EventHandler<StartPowerUpResponse> PowerUpCompleted;
+
+ /// <summary>
+ /// Occurs when power up sequence has failed.
+ /// </summary>
+ public event EventHandler<StartPowerUpResponse> PowerUpFailed;
+
+ /// <summary>
+ /// Occurs when power up sequence has ended. Could be due to no response to the request!
+ /// </summary>
+ public event EventHandler PowerUpEnded;
+
#endregion
#region Properties
@@ -507,6 +532,16 @@ namespace Tango.Integration.Operation
}
}
+ private bool _enablePowerUpSequence;
+ /// <summary>
+ /// Gets or sets a value indicating whether to enable the power sequence tracking.
+ /// </summary>
+ public bool EnablePowerUpSequence
+ {
+ get { return _enablePowerUpSequence; }
+ set { _enablePowerUpSequence = value; RaisePropertyChangedAuto(); }
+ }
+
/// <summary>
/// Gets or sets the machine events state provider used to get notifications about current machine events and errors.
/// </summary>
@@ -1242,6 +1277,11 @@ namespace Tango.Integration.Operation
OnEnableMachineStatusUpdatesChanged(EnableMachineStatusUpdates);
OnEnableAutomaticThreadLoadingChanged(EnableAutomaticThreadLoading);
+ if (EnablePowerUpSequence)
+ {
+ TrackPowerUpSequence();
+ }
+
if (EnableJobResume)
{
ResumeJob();
@@ -1249,7 +1289,7 @@ namespace Tango.Integration.Operation
if (response.Message.IsAfterReset)
{
- PowerUpStarted?.Invoke(this, new EventArgs());
+ FirmwareStarted?.Invoke(this, new EventArgs());
}
}
catch (Exception ex)
@@ -1269,6 +1309,76 @@ namespace Tango.Integration.Operation
#region Private Methods
+ private void TrackPowerUpSequence()
+ {
+ LogManager.Log("Starting power up sequence tracking...");
+
+ bool started = false;
+ bool completed = false;
+ PowerUpState lastState = PowerUpState.None;
+
+ SendContinuousRequest<StartPowerUpRequest, StartPowerUpResponse>(new StartPowerUpRequest(), new TransportContinuousRequestConfig()
+ {
+ ShouldLog = true,
+ Timeout = TimeSpan.FromSeconds(5)
+ }).Subscribe((response) =>
+ {
+ if (!started)
+ {
+ started = true;
+ PowerUpStarted?.Invoke(this, response);
+ }
+
+ PowerUpProgress?.Invoke(this, response);
+
+ var state = response.Message.State;
+
+ if (state != lastState)
+ {
+ LogManager.Log($"Power up sequence state changed to '{state}'...");
+
+ switch (state)
+ {
+ case PowerUpState.Error:
+ completed = true;
+ LogManager.Log($"Power up sequence failed with state '{state}'. ({response.Message.Message})");
+ PowerUpFailed?.Invoke(this, response);
+ PowerUpEnded?.Invoke(this, new EventArgs());
+ break;
+ case PowerUpState.Cancelled:
+ completed = true;
+ LogManager.Log($"Power up sequence canceled with state '{state}'. ({response.Message.Message})");
+ PowerUpEnded?.Invoke(this, new EventArgs());
+ break;
+ case PowerUpState.MachineReadyToDye:
+ completed = true;
+ LogManager.Log($"Power up sequence completed successfully with state '{state}'. ({response.Message.Message})");
+ PowerUpCompleted?.Invoke(this, response);
+ PowerUpEnded?.Invoke(this, new EventArgs());
+ break;
+ }
+
+ lastState = state;
+ }
+
+ }, (ex) =>
+ {
+ if (!completed)
+ {
+ completed = true;
+ LogManager.Log(ex, "Power up sequence tracking failed.");
+ PowerUpEnded?.Invoke(this, new EventArgs());
+ }
+ }, () =>
+ {
+ if (!completed)
+ {
+ completed = true;
+ PowerUpEnded?.Invoke(this, new EventArgs());
+ }
+ });
+ }
+
private async void ResumeJob()
{
LogManager.Log("Checking if a job is in progress...");
@@ -1421,42 +1531,6 @@ namespace Tango.Integration.Operation
}
/// <summary>
- /// Logs the request sent.
- /// </summary>
- /// <param name="message">The message.</param>
- //protected void LogRequestSent(IMessage message)
- //{
- // if (!(message is FileChunkUploadRequest) && !(message is FileDownloadRequest))
- // {
- // //LogManager.Log($"{GetExtendedComponentName()}: Sending request '{message.GetType().Name}'...\n{message.ToJsonString()}");
- // OnRequestSent(message);
- // }
- //}
-
- /// <summary>
- /// Logs the request failed.
- /// </summary>
- /// <param name="message">The message.</param>
- //protected void LogRequestFailed(IMessage message, Exception ex)
- //{
- // //LogManager.Log($"{GetExtendedComponentName()}: Request failed '{message.GetType().Name}'...\n{message.ToJsonString()}\n{ex.ToString()}", LogCategory.Error);
- // OnRequestFailed(message, ex);
- //}
-
- /// <summary>
- /// Logs the response received.
- /// </summary>
- /// <param name="message">The message.</param>
- //protected void LogResponseReceived(IMessage message)
- //{
- // if (!(message is FileChunkUploadResponse) && !(message is FileDownloadResponse))
- // {
- // //LogManager.Log($"{GetExtendedComponentName()}: Response received '{message.GetType().Name}'...\n{message.ToJsonString()}");
- // OnResponseReceived(message);
- // }
- //}
-
- /// <summary>
/// Creates a PMR job segment.
/// </summary>
/// <param name="segment">The segment.</param>