aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-05-23 16:44:30 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-05-23 16:44:30 +0300
commit26cee052a5b20d7a5bdb597776c55dcd3da2da62 (patch)
treefd4a4bfceeb4509515913557fc66ad28704abdf9 /Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician
parent2521b3c058fe18f1ebd48a85577349b49c1c2108 (diff)
downloadTango-26cee052a5b20d7a5bdb597776c55dcd3da2da62.tar.gz
Tango-26cee052a5b20d7a5bdb597776c55dcd3da2da62.zip
Implemented new Twine color catalog !
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Controls/DispenserController.xaml19
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Controls/DispenserController.xaml.cs125
2 files changed, 85 insertions, 59 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Controls/DispenserController.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Controls/DispenserController.xaml
index 18636704a..270b88eed 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Controls/DispenserController.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Controls/DispenserController.xaml
@@ -20,17 +20,18 @@
<DockPanel Margin="40 0 0 0">
<Grid HorizontalAlignment="Left">
<Ellipse Stroke="{StaticResource TangoGrayBrush}" StrokeThickness="3"></Ellipse>
- <touch:TouchBusyIndicator Minimum="0" Maximum="100" Value="0" IsIndeterminate="{Binding ElementName=control,Path=IsHoming}" Width="Auto" Height="Auto">
+ <touch:TouchBusyIndicator Minimum="0" Maximum="100" Value="0" IsIndeterminate="{Binding ElementName=control,Path=IsBusy}" Width="Auto" Height="Auto">
</touch:TouchBusyIndicator>
- <touch:TouchIconButton x:Name="btnHome" IsEnabled="{Binding ElementName=control,Path=IsJogging,Converter={StaticResource BooleanInverseConverter}}" HorizontalAlignment="Left" Padding="20">
+ <touch:TouchIconButton x:Name="btnStop" Click="btnStop_Click" IsEnabled="{Binding ElementName=control,Path=IsBusy}" HorizontalAlignment="Left" Padding="20">
<touch:TouchIconButton.Style>
<Style TargetType="touch:TouchIconButton" BasedOn="{StaticResource {x:Type touch:TouchIconButton}}">
- <Setter Property="Icon" Value="Home"></Setter>
- <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter>
+ <Setter Property="Icon" Value="Cogs"></Setter>
+ <Setter Property="Foreground" Value="{StaticResource TangoGrayTextBrush}"></Setter>
<Style.Triggers>
- <DataTrigger Binding="{Binding ElementName=control,Path=IsHoming}" Value="True">
+ <DataTrigger Binding="{Binding ElementName=control,Path=IsBusy}" Value="True">
<Setter Property="Icon" Value="Stop"></Setter>
+ <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
@@ -57,8 +58,8 @@
<DataTrigger Binding="{Binding ElementName=control,Path=IsHoming}" Value="True">
<Setter Property="Text" Value="Homing..."></Setter>
</DataTrigger>
- <DataTrigger Binding="{Binding ElementName=control,Path=IsJogging}" Value="True">
- <Setter Property="Text" Value="Jogging..."></Setter>
+ <DataTrigger Binding="{Binding ElementName=control,Path=IsPriming}" Value="True">
+ <Setter Property="Text" Value="Priming..."></Setter>
</DataTrigger>
</Style.Triggers>
</Style>
@@ -72,7 +73,7 @@
</DockPanel>
</Border>
- <touch:TouchIconButton x:Name="btnUp" IsEnabled="{Binding ElementName=control,Path=IsHoming,Converter={StaticResource BooleanInverseConverter}}" HorizontalAlignment="Left" Margin="54 0 0 0" Icon="ChevronUpSolid">
+ <touch:TouchIconButton x:Name="btnPriming" Click="btnPriming_Click" IsEnabled="{Binding ElementName=control,Path=IsBusy,Converter={StaticResource BooleanInverseConverter}}" HorizontalAlignment="Left" Margin="54 0 0 0" Icon="ChevronUpSolid">
<touch:TouchIconButton.Style>
<Style TargetType="touch:TouchIconButton" BasedOn="{StaticResource {x:Type touch:TouchIconButton}}">
<Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter>
@@ -80,7 +81,7 @@
</touch:TouchIconButton.Style>
</touch:TouchIconButton>
- <touch:TouchIconButton x:Name="btnDown" IsEnabled="{Binding ElementName=control,Path=IsHoming,Converter={StaticResource BooleanInverseConverter}}" Grid.Row="2" HorizontalAlignment="Left" Margin="54 0 0 0" Icon="ChevronDownSolid">
+ <touch:TouchIconButton x:Name="btnHoming" Click="btnHoming_Click" IsEnabled="{Binding ElementName=control,Path=IsBusy,Converter={StaticResource BooleanInverseConverter}}" Grid.Row="2" HorizontalAlignment="Left" Margin="54 0 0 0" Icon="ChevronDownSolid">
<touch:TouchIconButton.Style>
<Style TargetType="touch:TouchIconButton" BasedOn="{StaticResource {x:Type touch:TouchIconButton}}">
<Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter>
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Controls/DispenserController.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Controls/DispenserController.xaml.cs
index 98b857fba..a8ada4e62 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Controls/DispenserController.xaml.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Controls/DispenserController.xaml.cs
@@ -48,25 +48,32 @@ namespace Tango.PPC.Technician.Controls
set { SetValue(IsHomingProperty, value); }
}
public static readonly DependencyProperty IsHomingProperty =
- DependencyProperty.Register("IsHoming", typeof(bool), typeof(DispenserController), new PropertyMetadata(false));
+ DependencyProperty.Register("IsHoming", typeof(bool), typeof(DispenserController), new PropertyMetadata(false, (d, e) => (d as DispenserController).OnChange()));
- public bool IsJogging
+ public bool IsPriming
{
- get { return (bool)GetValue(IsJoggingProperty); }
- set { SetValue(IsJoggingProperty, value); }
+ get { return (bool)GetValue(IsPrimingProperty); }
+ set { SetValue(IsPrimingProperty, value); }
+ }
+ public static readonly DependencyProperty IsPrimingProperty =
+ DependencyProperty.Register("IsPriming", typeof(bool), typeof(DispenserController), new PropertyMetadata(false, (d, e) => (d as DispenserController).OnChange()));
+
+ public bool IsBusy
+ {
+ get { return (bool)GetValue(IsBusyProperty); }
+ set { SetValue(IsBusyProperty, value); }
+ }
+ public static readonly DependencyProperty IsBusyProperty =
+ DependencyProperty.Register("IsBusy", typeof(bool), typeof(DispenserController), new PropertyMetadata(false));
+
+ private void OnChange()
+ {
+ IsBusy = IsPriming || IsHoming;
}
- public static readonly DependencyProperty IsJoggingProperty =
- DependencyProperty.Register("IsJogging", typeof(bool), typeof(DispenserController), new PropertyMetadata(false));
public DispenserController()
{
InitializeComponent();
-
- btnHome.Click += BtnHome_Click;
- btnUp.RegisterForPreviewMouseOrTouchDown(OnUpButtonPressed);
- btnUp.RegisterForPreviewMouseOrTouchUp(OnUpButtonReleased);
- btnDown.RegisterForPreviewMouseOrTouchDown(OnDownButtonPressed);
- btnDown.RegisterForPreviewMouseOrTouchUp(OnDownButtonReleased);
}
#region Home
@@ -125,78 +132,96 @@ namespace Tango.PPC.Technician.Controls
#endregion
- #region Up
-
- private async void OnUpButtonPressed(object sender, MouseOrTouchEventArgs e)
+ private void InvokeUI(Action action)
{
- IsJogging = true;
-
+ Dispatcher.BeginInvoke(action);
+ }
+ private void btnPriming_Click(object sender, RoutedEventArgs e)
+ {
try
{
- await MachineOperator.StartDispenserJogging(new DispenserJoggingRequest()
+ IsPriming = true;
+
+ MachineOperator.StartDispenserHoming(new DispenserHomingRequest()
{
Index = IdsPack.PackIndex,
- Direction = MotorDirection.Forward,
Speed = numSpeed.Value,
+ Direction = MotorDirection.Forward
+ })
+ .Subscribe((response) =>
+ {
+
+
+
+ }, (ex) =>
+ {
+
+ InvokeUI(() => IsPriming = false);
+
+
+ }, () =>
+ {
+
+ InvokeUI(() => IsPriming = false);
+
});
}
- catch { }
+ catch
+ {
+ IsPriming = false;
+ }
}
- private async void OnUpButtonReleased(object sender, MouseOrTouchEventArgs e)
+ private void btnHoming_Click(object sender, RoutedEventArgs e)
{
- IsJogging = false;
-
try
{
- await MachineOperator.StopDispenserJogging(new DispenserAbortJoggingRequest()
+ IsHoming = true;
+
+ MachineOperator.StartDispenserHoming(new DispenserHomingRequest()
{
Index = IdsPack.PackIndex,
- });
- }
- catch { }
- }
+ Speed = numSpeed.Value,
+ Direction = MotorDirection.Backward
+ })
+ .Subscribe((response) =>
+ {
- #endregion
- #region Down
- private async void OnDownButtonPressed(object sender, MouseOrTouchEventArgs e)
- {
- IsJogging = true;
+ }, (ex) =>
+ {
- try
- {
- await MachineOperator.StartDispenserJogging(new DispenserJoggingRequest()
+ InvokeUI(() => IsHoming = false);
+
+
+ }, () =>
{
- Index = IdsPack.PackIndex,
- Direction = MotorDirection.Backward,
- Speed = numSpeed.Value,
+
+ InvokeUI(() => IsHoming = false);
+
});
}
- catch { }
+ catch
+ {
+ IsHoming = false;
+ }
}
- private async void OnDownButtonReleased(object sender, MouseOrTouchEventArgs e)
+ private async void btnStop_Click(object sender, RoutedEventArgs e)
{
- IsJogging = false;
+ IsHoming = false;
+ IsPriming = false;
try
{
- await MachineOperator.StopDispenserJogging(new DispenserAbortJoggingRequest()
+ await MachineOperator.StopDispenserHoming(new DispenserAbortHomingRequest()
{
Index = IdsPack.PackIndex,
});
}
catch { }
}
-
- #endregion
-
- private void InvokeUI(Action action)
- {
- Dispatcher.BeginInvoke(action);
- }
}
}