aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-03-09 02:27:58 +0200
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-03-09 02:27:58 +0200
commiteb793f20dc078a304a423a481e5bb0eddce71471 (patch)
treeca7b60be7b2d588875017b3885ba3d3cd3f893f9 /Software/Visual_Studio/PPC
parent1b5d452cccd3be79c226f1438c3efe7abe786017 (diff)
parentae9cdafa944db884bf878f36a7a328c53a7588a8 (diff)
downloadTango-eb793f20dc078a304a423a481e5bb0eddce71471.tar.gz
Tango-eb793f20dc078a304a423a481e5bb0eddce71471.zip
MERGE
Diffstat (limited to 'Software/Visual_Studio/PPC')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/HomingMotorCommand.cs80
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseDyeingHeadCommand.cs31
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseLeftLeadingWheelsCommand.cs30
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseMotorCommand.cs158
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseRightLeadingWheelsCommand.cs30
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/ResetThreadLoadingCommand.cs24
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Controls/StateTouchButton.cs109
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/MaintenanceCommand.cs81
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj13
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Themes/Generic.xaml9
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs99
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml22
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs2
13 files changed, 598 insertions, 90 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/HomingMotorCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/HomingMotorCommand.cs
new file mode 100644
index 000000000..d3f44fe7e
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/HomingMotorCommand.cs
@@ -0,0 +1,80 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.PMR.Diagnostics;
+using Tango.PMR.Hardware;
+
+namespace Tango.PPC.Maintenance.Commands
+{
+ public abstract class HomingMotorCommand : MaintenanceCommand<object>
+ {
+ public HardwareMotorType Motor { get; set; }
+
+ public MotorDirection Direction { get; set; }
+
+ public double Speed { get; set; }
+
+ public String HomingMessage { get; set; }
+
+ public String ErrorMessage { get; set; }
+
+ public String SuccessMessage { get; set; }
+
+ public HomingMotorCommand(HardwareMotorType motor,
+ MotorDirection direction,
+ double speed,
+ string homingMessage,
+ string errorMessage,
+ string successMessage)
+ {
+ Motor = motor;
+ Direction = direction;
+ Speed = speed;
+ HomingMessage = homingMessage;
+ ErrorMessage = errorMessage;
+ SuccessMessage = successMessage;
+ }
+
+ protected override void OnExecute()
+ {
+ IsEnabled = false;
+
+ try
+ {
+ NotificationProvider.SetGlobalBusyMessage(HomingMessage);
+
+ MachineProvider.MachineOperator.StartMotorHoming(new PMR.Diagnostics.MotorHomingRequest()
+ {
+ Direction = Direction,
+ MotorType = Motor,
+ Speed = Speed,
+ }).Subscribe((response) =>
+ {
+ //Next
+ }, (ex) =>
+ {
+ //Error
+ IsEnabled = true;
+ NotificationProvider.ReleaseGlobalBusyMessage();
+ LogManager.Log(ex, ErrorMessage);
+ NotificationProvider.ShowError(ex.FlattenMessage());
+ }, () =>
+ {
+ //Complete
+ IsEnabled = true;
+ NotificationProvider.ReleaseGlobalBusyMessage();
+ NotificationProvider.ShowSuccess(SuccessMessage);
+ });
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, ErrorMessage);
+ NotificationProvider.ReleaseGlobalBusyMessage();
+ NotificationProvider.ShowError(ex.FlattenMessage());
+ IsEnabled = true;
+ }
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseDyeingHeadCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseDyeingHeadCommand.cs
new file mode 100644
index 000000000..794274e21
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseDyeingHeadCommand.cs
@@ -0,0 +1,31 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Integration.Operation;
+using Tango.PMR.Diagnostics;
+using Tango.PMR.Hardware;
+
+namespace Tango.PPC.Maintenance.Commands
+{
+ public class OpenCloseDyeingHeadCommand : OpenCloseMotorCommand
+ {
+ public OpenCloseDyeingHeadCommand() : base(
+ HardwareMotorType.MotoDhLid,
+ MotorDirection.Backward,
+ 400,
+ 400,
+ MotorState.Closed,
+ "Opening dyeing head lead...",
+ "Closing dyeing head lead...",
+ "Error opening dyeing head lead.",
+ "Error closing dyeing head lead.",
+ "The dyeing head lead is now opened.",
+ "The dyeing head lead is now closed."
+ )
+ {
+
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseLeftLeadingWheelsCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseLeftLeadingWheelsCommand.cs
new file mode 100644
index 000000000..b0d8c1dc5
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseLeftLeadingWheelsCommand.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.PMR.Diagnostics;
+using Tango.PMR.Hardware;
+
+namespace Tango.PPC.Maintenance.Commands
+{
+ public class OpenCloseLeftLeadingWheelsCommand : OpenCloseMotorCommand
+ {
+ public OpenCloseLeftLeadingWheelsCommand() : base(
+ HardwareMotorType.MotoLloading,
+ MotorDirection.Backward,
+ 250,
+ 250,
+ MotorState.Closed,
+ "Opening left leading wheels...",
+ "Closing left leading wheels...",
+ "Error opening left leading wheels.",
+ "Error closing left leading wheels.",
+ "The left leading wheels are now opened.",
+ "The left leading wheels are now closed."
+ )
+ {
+
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseMotorCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseMotorCommand.cs
new file mode 100644
index 000000000..149c3675d
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseMotorCommand.cs
@@ -0,0 +1,158 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.PMR.Diagnostics;
+using Tango.PMR.Hardware;
+
+namespace Tango.PPC.Maintenance.Commands
+{
+ public abstract class OpenCloseMotorCommand : MaintenanceCommand<OpenCloseMotorCommand.MotorState>
+ {
+ public enum MotorState
+ {
+ Closed,
+ Opened,
+ }
+
+ public HardwareMotorType Motor { get; set; }
+
+ public MotorDirection OpenDirection { get; set; }
+
+ public MotorDirection CloseDirection
+ {
+ get
+ {
+ return OpenDirection == MotorDirection.Forward ? MotorDirection.Backward : MotorDirection.Forward;
+ }
+ }
+
+ public double OpeningSpeed { get; set; }
+
+ public double ClosingSpeed { get; set; }
+
+ public String OpeningMessage { get; set; }
+
+ public String ClosingMessage { get; set; }
+
+ public String OpeningErrorMessage { get; set; }
+
+ public String ClosingErrorMessage { get; set; }
+
+ public String OpeningSuccessMessage { get; set; }
+
+ public String ClosingSuccessMessage { get; set; }
+
+ public OpenCloseMotorCommand(
+ HardwareMotorType motor,
+ MotorDirection openDirection,
+ double openingSpeed,
+ double closingSpeed,
+ MotorState defaultState,
+ String openingMessage,
+ String closingMessage,
+ String openingErrorMessage,
+ String closingErrorMessage,
+ String openingSuccessMessage,
+ String closingSuccessMessage)
+ {
+
+ Motor = motor;
+ OpenDirection = openDirection;
+ OpeningSpeed = openingSpeed;
+ ClosingSpeed = closingSpeed;
+ State = defaultState;
+ OpeningMessage = openingMessage;
+ ClosingMessage = closingMessage;
+ OpeningErrorMessage = openingErrorMessage;
+ ClosingErrorMessage = closingErrorMessage;
+ OpeningSuccessMessage = openingSuccessMessage;
+ ClosingSuccessMessage = closingSuccessMessage;
+ }
+
+ protected override void OnExecute()
+ {
+ if (State == MotorState.Closed)
+ {
+ IsEnabled = false;
+
+ try
+ {
+ NotificationProvider.SetGlobalBusyMessage(OpeningMessage);
+
+ MachineProvider.MachineOperator.StartMotorHoming(new PMR.Diagnostics.MotorHomingRequest()
+ {
+ Direction = OpenDirection,
+ MotorType = Motor,
+ Speed = OpeningSpeed,
+ }).Subscribe((response) =>
+ {
+ //Next
+ }, (ex) =>
+ {
+ //Error
+ IsEnabled = true;
+ NotificationProvider.ReleaseGlobalBusyMessage();
+ LogManager.Log(ex, OpeningErrorMessage);
+ NotificationProvider.ShowError(ex.FlattenMessage());
+ }, () =>
+ {
+ //Complete
+ IsEnabled = true;
+ State = MotorState.Opened;
+ NotificationProvider.ReleaseGlobalBusyMessage();
+ NotificationProvider.ShowSuccess(OpeningSuccessMessage);
+ });
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, OpeningErrorMessage);
+ NotificationProvider.ReleaseGlobalBusyMessage();
+ NotificationProvider.ShowError(ex.FlattenMessage());
+ IsEnabled = true;
+ }
+ }
+ else
+ {
+ IsEnabled = false;
+
+ try
+ {
+ NotificationProvider.SetGlobalBusyMessage(ClosingMessage);
+
+ MachineProvider.MachineOperator.StartMotorHoming(new PMR.Diagnostics.MotorHomingRequest()
+ {
+ Direction = CloseDirection,
+ MotorType = Motor,
+ Speed = ClosingSpeed,
+ }).Subscribe((response) =>
+ {
+ //Next
+ }, (ex) =>
+ {
+ //Error
+ IsEnabled = true;
+ NotificationProvider.ReleaseGlobalBusyMessage();
+ LogManager.Log(ex, ClosingErrorMessage);
+ NotificationProvider.ShowError(ex.FlattenMessage());
+ }, () =>
+ {
+ //Complete
+ IsEnabled = true;
+ State = MotorState.Closed;
+ NotificationProvider.ReleaseGlobalBusyMessage();
+ NotificationProvider.ShowSuccess(ClosingSuccessMessage);
+ });
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, ClosingErrorMessage);
+ NotificationProvider.ReleaseGlobalBusyMessage();
+ NotificationProvider.ShowError(ex.FlattenMessage());
+ IsEnabled = true;
+ }
+ }
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseRightLeadingWheelsCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseRightLeadingWheelsCommand.cs
new file mode 100644
index 000000000..ced9eea60
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/OpenCloseRightLeadingWheelsCommand.cs
@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.PMR.Diagnostics;
+using Tango.PMR.Hardware;
+
+namespace Tango.PPC.Maintenance.Commands
+{
+ public class OpenCloseRightLeadingWheelsCommand : OpenCloseMotorCommand
+ {
+ public OpenCloseRightLeadingWheelsCommand() : base(
+ HardwareMotorType.MotoRloading,
+ MotorDirection.Backward,
+ 250,
+ 250,
+ MotorState.Closed,
+ "Opening right leading wheels...",
+ "Closing right leading wheels...",
+ "Error opening right leading wheels.",
+ "Error closing right leading wheels.",
+ "The right leading wheels are now opened.",
+ "The right leading wheels are now closed."
+ )
+ {
+
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/ResetThreadLoadingCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/ResetThreadLoadingCommand.cs
new file mode 100644
index 000000000..0078cd546
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Commands/ResetThreadLoadingCommand.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.PMR.Diagnostics;
+using Tango.PMR.Hardware;
+
+namespace Tango.PPC.Maintenance.Commands
+{
+ public class ResetThreadLoadingCommand : HomingMotorCommand
+ {
+ public ResetThreadLoadingCommand() : base(
+ HardwareMotorType.MotoDryerLoadarm,
+ MotorDirection.Backward,
+ 200,
+ "Resetting thread loading arm...",
+ "Error resetting thread loading arm.",
+ "Thread loading arm in now in place.")
+ {
+
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Controls/StateTouchButton.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Controls/StateTouchButton.cs
new file mode 100644
index 000000000..9a259482b
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Controls/StateTouchButton.cs
@@ -0,0 +1,109 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Collections.Specialized;
+using System.ComponentModel;
+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.Markup;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using Tango.Touch.Controls;
+
+namespace Tango.PPC.Maintenance.Controls
+{
+ public class ButtonState : DependencyObject
+ {
+ public Object Value
+ {
+ get { return (Object)GetValue(ValueProperty); }
+ set { SetValue(ValueProperty, value); }
+ }
+ public static readonly DependencyProperty ValueProperty =
+ DependencyProperty.Register("Value", typeof(Object), typeof(ButtonState), new PropertyMetadata(null));
+
+ public Object Content
+ {
+ get { return (Object)GetValue(ContentProperty); }
+ set { SetValue(ContentProperty, value); }
+ }
+ public static readonly DependencyProperty ContentProperty =
+ DependencyProperty.Register("Content", typeof(Object), typeof(ButtonState), new PropertyMetadata(null));
+ }
+
+ [ContentProperty(nameof(States))]
+ public class StateTouchButton : TouchButton
+ {
+ public ObservableCollection<Object> States
+ {
+ get { return (ObservableCollection<Object>)GetValue(StatesProperty); }
+ set { SetValue(StatesProperty, value); }
+ }
+ public static readonly DependencyProperty StatesProperty =
+ DependencyProperty.Register("States", typeof(ObservableCollection<Object>), typeof(StateTouchButton), new PropertyMetadata(null, (d, e) => (d as StateTouchButton).OnStatesChanged()));
+
+ public Object SelectedState
+ {
+ get { return (Object)GetValue(SelectedStateProperty); }
+ set { SetValue(SelectedStateProperty, value); }
+ }
+ public static readonly DependencyProperty SelectedStateProperty =
+ DependencyProperty.Register("SelectedState", typeof(Object), typeof(StateTouchButton), new PropertyMetadata(null, (d, e) => (d as StateTouchButton).OnSelectedStateChanged()));
+
+ public StateTouchButton()
+ {
+ States = new ObservableCollection<object>();
+ }
+
+ private void OnStatesChanged()
+ {
+ if (States != null)
+ {
+ States.CollectionChanged -= States_CollectionChanged;
+ States.CollectionChanged += States_CollectionChanged;
+ OnSelectedStateChanged();
+ }
+ }
+
+ private void OnSelectedStateChanged()
+ {
+ if (SelectedState == null)
+ {
+ Content = null;
+ return;
+ }
+
+ if (States != null)
+ {
+ var converter = TypeDescriptor.GetConverter(SelectedState.GetType());
+ var matchingState = States.OfType<ButtonState>().ToList().FirstOrDefault(x => x.Value != null && converter.ConvertFrom(x.Value).Equals(SelectedState));
+ if (matchingState != null)
+ {
+ Content = matchingState.Content;
+ }
+ else
+ {
+ Content = null;
+ }
+ }
+ else
+ {
+ Content = null;
+ }
+ }
+
+ private void States_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
+ {
+ OnSelectedStateChanged();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/MaintenanceCommand.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/MaintenanceCommand.cs
new file mode 100644
index 000000000..5c74d92cd
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/MaintenanceCommand.cs
@@ -0,0 +1,81 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Core;
+using Tango.Core.Commands;
+using Tango.Core.DI;
+using Tango.Integration.Operation;
+using Tango.PPC.Common.Connection;
+using Tango.PPC.Common.Notifications;
+
+namespace Tango.PPC.Maintenance
+{
+ public abstract class MaintenanceCommand<T> : ExtendedObject
+ {
+ private IMachineProvider _machineProvider;
+ [TangoInject(Mode = TangoInjectMode.WhenAvailable)]
+ protected IMachineProvider MachineProvider
+ {
+ get { return _machineProvider; }
+ set
+ {
+ _machineProvider = value; RaisePropertyChangedAuto();
+ _machineProvider.MachineOperator.StatusChanged += MachineOperator_StatusChanged;
+ }
+ }
+
+ [TangoInject(Mode = TangoInjectMode.WhenAvailable)]
+ protected INotificationProvider NotificationProvider { get; set; }
+
+ private RelayCommand _command;
+ public RelayCommand Command
+ {
+ get { return _command; }
+ set { _command = value; RaisePropertyChangedAuto(); }
+ }
+
+ private bool _isEnabled;
+ public bool IsEnabled
+ {
+ get { return _isEnabled; }
+ set { _isEnabled = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); }
+ }
+
+ private T _state;
+ public T State
+ {
+ get { return _state; }
+ set { _state = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); }
+ }
+
+ private void MachineOperator_StatusChanged(object sender, MachineStatuses e)
+ {
+ InvalidateRelayCommands();
+ }
+
+ public MaintenanceCommand()
+ {
+ TangoIOC.Default.Inject(this);
+ IsEnabled = true;
+ Command = new RelayCommand(Execute, CanExecute);
+ }
+
+ protected virtual bool CanExecute()
+ {
+ if (!IsEnabled) return false;
+ if (MachineProvider == null) return false;
+ if (!MachineProvider.MachineOperator.CanPrint) return false;
+
+ return true;
+ }
+
+ private void Execute()
+ {
+ OnExecute();
+ }
+
+ protected abstract void OnExecute();
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj
index 3f9f7c7b9..42d4a396e 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Tango.PPC.Maintenance.csproj
@@ -85,6 +85,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="Themes\Generic.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="Views\GeneralGuideView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -102,6 +106,13 @@
<Compile Include="..\..\..\Versioning\GlobalVersionInfo.cs">
<Link>GlobalVersionInfo.cs</Link>
</Compile>
+ <Compile Include="Commands\HomingMotorCommand.cs" />
+ <Compile Include="Commands\OpenCloseDyeingHeadCommand.cs" />
+ <Compile Include="Commands\OpenCloseRightLeadingWheelsCommand.cs" />
+ <Compile Include="Commands\OpenCloseLeftLeadingWheelsCommand.cs" />
+ <Compile Include="Commands\OpenCloseMotorCommand.cs" />
+ <Compile Include="Commands\ResetThreadLoadingCommand.cs" />
+ <Compile Include="Controls\StateTouchButton.cs" />
<Compile Include="Converters\LiquidTypeToBrushConverter.cs" />
<Compile Include="Converters\MidTankLevelToElementHeightConverter.cs" />
<Compile Include="Converters\StringToFirstLetterConverter.cs" />
@@ -113,6 +124,7 @@
<Compile Include="Guides\HandleWasteCartridgeGuide.cs" />
<Compile Include="Guides\LoadNewThreadGuide.cs" />
<Compile Include="Helpers\GuideHelper.cs" />
+ <Compile Include="MaintenanceCommand.cs" />
<Compile Include="MaintenanceModule.cs" />
<Compile Include="Models\MidTankLevelModel.cs" />
<Compile Include="Models\OverallTemperatureModel.cs" />
@@ -265,6 +277,7 @@
<Resource Include="Images\cone-full.png" />
<Resource Include="Images\l-full.png" />
</ItemGroup>
+ <ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Themes/Generic.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Themes/Generic.xaml
new file mode 100644
index 000000000..a77cc2281
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Themes/Generic.xaml
@@ -0,0 +1,9 @@
+<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch"
+ xmlns:local="clr-namespace:Tango.PPC.Maintenance.Controls">
+
+ <Style TargetType="{x:Type local:StateTouchButton}" BasedOn="{StaticResource {x:Type touch:TouchButton}}">
+
+ </Style>
+</ResourceDictionary> \ No newline at end of file
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs
index aeb349bdc..8d221c3f3 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/ViewModels/MaintenanceViewVM.cs
@@ -11,6 +11,7 @@ using Tango.Integration.Operation;
using Tango.Logging;
using Tango.PMR.MachineStatus;
using Tango.PPC.Common;
+using Tango.PPC.Maintenance.Commands;
using Tango.PPC.Maintenance.Helpers;
using Tango.PPC.Maintenance.Models;
using Tango.PPC.Maintenance.Views;
@@ -38,11 +39,15 @@ namespace Tango.PPC.Maintenance.ViewModels
set { _overallTemperature = value; RaisePropertyChangedAuto(); }
}
- public RelayCommand OpenDyeingHeadCommand { get; set; }
+ public RelayCommand ExportLogsCommand { get; set; }
- public RelayCommand CloseDyeingHeadCommand { get; set; }
+ public OpenCloseDyeingHeadCommand OpenCloseDyeingHeadCommand { get; set; }
- public RelayCommand ExportLogsCommand { get; set; }
+ public OpenCloseLeftLeadingWheelsCommand OpenCloseLeftLeadingWheelsCommand { get; set; }
+
+ public OpenCloseRightLeadingWheelsCommand OpenCloseRightLeadingWheelsCommand { get; set; }
+
+ public ResetThreadLoadingCommand ResetThreadLoadingCommand { get; set; }
public MaintenanceViewVM()
{
@@ -50,10 +55,12 @@ namespace Tango.PPC.Maintenance.ViewModels
OverallTemperature = new OverallTemperatureModel();
OpenGuideCommand = new RelayCommand<GuideBase>(OpenGuide);
-
- OpenDyeingHeadCommand = new RelayCommand(OpenDyeingHead);
- CloseDyeingHeadCommand = new RelayCommand(CloseDyeingHead);
ExportLogsCommand = new RelayCommand(ExportLogsToStorage);
+
+ OpenCloseDyeingHeadCommand = new OpenCloseDyeingHeadCommand();
+ OpenCloseLeftLeadingWheelsCommand = new OpenCloseLeftLeadingWheelsCommand();
+ OpenCloseRightLeadingWheelsCommand = new OpenCloseRightLeadingWheelsCommand();
+ ResetThreadLoadingCommand = new ResetThreadLoadingCommand();
}
public override void OnApplicationStarted()
@@ -101,86 +108,6 @@ namespace Tango.PPC.Maintenance.ViewModels
}
}
- private void OpenDyeingHead()
- {
- IsFree = false;
-
- try
- {
- NotificationProvider.SetGlobalBusyMessage("Opening dyeing head lead...");
-
- MachineProvider.MachineOperator.StartMotorHoming(new PMR.Diagnostics.MotorHomingRequest()
- {
- Direction = PMR.Diagnostics.MotorDirection.Backward,
- MotorType = PMR.Hardware.HardwareMotorType.MotoDhLid,
- Speed = 400,
- }).Subscribe((response) =>
- {
- //Next
- }, (ex) =>
- {
- //Error
- IsFree = true;
- NotificationProvider.ReleaseGlobalBusyMessage();
- LogManager.Log(ex, "Error opening dyeing head lead.");
- NotificationProvider.ShowError(ex.FlattenMessage());
- }, () =>
- {
- //Complete
- IsFree = true;
- NotificationProvider.ReleaseGlobalBusyMessage();
- NotificationProvider.ShowSuccess("The dyeing head lead is now opened.");
- });
- }
- catch (Exception ex)
- {
- LogManager.Log(ex, "Error opening dyeing head lead.");
- NotificationProvider.ReleaseGlobalBusyMessage();
- NotificationProvider.ShowError(ex.FlattenMessage());
- IsFree = true;
- }
- }
-
- private void CloseDyeingHead()
- {
- IsFree = false;
-
- try
- {
- NotificationProvider.SetGlobalBusyMessage("Closing dyeing head lead...");
-
- MachineProvider.MachineOperator.StartMotorHoming(new PMR.Diagnostics.MotorHomingRequest()
- {
- Direction = PMR.Diagnostics.MotorDirection.Forward,
- MotorType = PMR.Hardware.HardwareMotorType.MotoDhLid,
- Speed = 400,
- }).Subscribe((response) =>
- {
- //Next
- }, (ex) =>
- {
- //Error
- IsFree = true;
- NotificationProvider.ReleaseGlobalBusyMessage();
- LogManager.Log(ex, "Error closing dyeing head lead.");
- NotificationProvider.ShowError(ex.FlattenMessage());
- }, () =>
- {
- //Complete
- IsFree = true;
- NotificationProvider.ReleaseGlobalBusyMessage();
- NotificationProvider.ShowSuccess("The dyeing head lead is now closed.");
- });
- }
- catch (Exception ex)
- {
- LogManager.Log(ex, "Error closing dyeing head lead.");
- NotificationProvider.ReleaseGlobalBusyMessage();
- NotificationProvider.ShowError(ex.FlattenMessage());
- IsFree = true;
- }
- }
-
private async void ExportLogsToStorage()
{
var result = await NavigationManager.
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml
index dbe09ca19..538d4e96d 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Maintenance/Views/MaintenanceView.xaml
@@ -5,8 +5,10 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:vm="clr-namespace:Tango.PPC.Maintenance.ViewModels"
xmlns:global="clr-namespace:Tango.PPC.Maintenance"
+ xmlns:arr="clr-namespace:System.Collections;assembly=mscorlib"
xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch"
xmlns:localConverters="clr-namespace:Tango.PPC.Maintenance.Converters"
+ xmlns:localControls="clr-namespace:Tango.PPC.Maintenance.Controls"
xmlns:local="clr-namespace:Tango.PPC.Maintenance.Views"
mc:Ignorable="d"
d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:MaintenanceViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MaintenanceViewVM}">
@@ -171,10 +173,24 @@
</StackPanel>
<StackPanel Style="{StaticResource Level2ContainerExtraMargin}">
- <UniformGrid Columns="2" Margin="40 0">
- <touch:TouchButton Command="{Binding OpenDyeingHeadCommand}" Margin="20" CornerRadius="25" Height="50" FontSize="18" Style="{StaticResource TangoHollowButton}">OPEN DYEING HEAD LEAD</touch:TouchButton>
+ <UniformGrid Columns="2" Margin="0 0">
- <touch:TouchButton Command="{Binding CloseDyeingHeadCommand}" Margin="20" CornerRadius="25" Height="50" FontSize="18" Style="{StaticResource TangoHollowButton}">CLOSE DYEING HEAD LEAD</touch:TouchButton>
+ <localControls:StateTouchButton Command="{Binding OpenCloseLeftLeadingWheelsCommand.Command}" SelectedState="{Binding OpenCloseLeftLeadingWheelsCommand.State}" Margin="20" CornerRadius="25" Height="50" FontSize="18" Style="{StaticResource TangoHollowButton}">
+ <localControls:ButtonState Value="Closed" Content="OPEN LEFT LEADING WHEELS" />
+ <localControls:ButtonState Value="Opened" Content="CLOSE LEFT LEADING WHEELS" />
+ </localControls:StateTouchButton>
+
+ <localControls:StateTouchButton Command="{Binding OpenCloseRightLeadingWheelsCommand.Command}" SelectedState="{Binding OpenCloseRightLeadingWheelsCommand.State}" Margin="20" CornerRadius="25" Height="50" FontSize="18" Style="{StaticResource TangoHollowButton}">
+ <localControls:ButtonState Value="Closed" Content="OPEN RIGHT LEADING WHEELS" />
+ <localControls:ButtonState Value="Opened" Content="CLOSE RIGHT LEADING WHEELS" />
+ </localControls:StateTouchButton>
+
+ <localControls:StateTouchButton Command="{Binding OpenCloseDyeingHeadCommand.Command}" SelectedState="{Binding OpenCloseDyeingHeadCommand.State}" Margin="20" CornerRadius="25" Height="50" FontSize="18" Style="{StaticResource TangoHollowButton}">
+ <localControls:ButtonState Value="Closed" Content="OPEN DYEING HEAD LEAD" />
+ <localControls:ButtonState Value="Opened" Content="CLOSE DYEING HEAD LEAD" />
+ </localControls:StateTouchButton>
+
+ <touch:TouchButton Margin="20" CornerRadius="25" Height="50" FontSize="18" Style="{StaticResource TangoHollowButton}" Command="{Binding ResetThreadLoadingCommand.Command}">RESET THREAD LOADING</touch:TouchButton>
<touch:TouchButton Margin="20" CornerRadius="25" Height="50" FontSize="18" Style="{StaticResource TangoHollowButton}" Command="{Binding ExportLogsCommand}" Visibility="{Binding ApplicationManager.IsInTechnicianMode,Converter={StaticResource BooleanToVisibilityConverter}}">EXPORT SYSTEM LOGS</touch:TouchButton>
</UniformGrid>
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs
index 01ccc7654..11a400fd3 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs
@@ -8,4 +8,4 @@ using System.Windows;
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Tango PPC Application")]
-[assembly: AssemblyVersion("1.1.5.0")]
+[assembly: AssemblyVersion("1.1.6.0")]