diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2019-05-26 18:13:39 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2019-05-26 18:13:39 +0300 |
| commit | cc5762df4525f598bd268cfc7e2e5bcbb455db53 (patch) | |
| tree | c9bfaafd7149564cabcd4541995852af202e8bfd /Software/Visual_Studio/PPC/Modules | |
| parent | d7d99dc7d1fa11845c5d4df3bbff16fec33b406c (diff) | |
| parent | 9d4e765f260c6a3647a94dab12b2179501be6ed3 (diff) | |
| download | Tango-cc5762df4525f598bd268cfc7e2e5bcbb455db53.tar.gz Tango-cc5762df4525f598bd268cfc7e2e5bcbb455db53.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules')
6 files changed, 151 insertions, 60 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ColorProfileReceivedView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ColorProfileReceivedView.xaml index 83c90f5ed..bc6534596 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ColorProfileReceivedView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ColorProfileReceivedView.xaml @@ -11,6 +11,12 @@ <DockPanel> <Grid DockPanel.Dock="Bottom"> <touch:TouchButton HorizontalAlignment="Left" CornerRadius="25" Command="{Binding CloseCommand}" Style="{StaticResource TangoHollowButton}" Width="150" Height="50" VerticalAlignment="Bottom">DECLINE</touch:TouchButton> + + <Grid HorizontalAlignment="Center"> + <touch:TouchRingProgress Width="50" Height="50" Maximum="{Binding MaxSeconds}" Value="{Binding SecondsRemaining}" /> + <TextBlock Text="{Binding SecondsRemaining}" HorizontalAlignment="Center" VerticalAlignment="Center"></TextBlock> + </Grid> + <touch:TouchButton HorizontalAlignment="Right" CornerRadius="25" Command="{Binding OKCommand}" Style="{StaticResource TangoHollowButton}" Width="150" Height="50" VerticalAlignment="Bottom">APPROVE</touch:TouchButton> </Grid> <StackPanel DockPanel.Dock="Top"> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ColorProfileReceivedViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ColorProfileReceivedViewVM.cs index 31e664825..1386acb93 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ColorProfileReceivedViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ColorProfileReceivedViewVM.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Media; +using System.Windows.Threading; using Tango.Core.Commands; using Tango.SharedUI; @@ -11,6 +12,60 @@ namespace Tango.PPC.Jobs.Dialogs { public class ColorProfileReceivedViewVM : DialogViewVM { + private DispatcherTimer _timer; + public Color Color { get; set; } + + private int _maxSeconds; + public int MaxSeconds + { + get { return _maxSeconds; } + set { _maxSeconds = value; RaisePropertyChangedAuto(); } + } + + private int _secondsRemaining; + public int SecondsRemaining + { + get { return _secondsRemaining; } + set { _secondsRemaining = value; RaisePropertyChangedAuto(); } + } + + public ColorProfileReceivedViewVM() + { + MaxSeconds = 10; + SecondsRemaining = 10; + + _timer = new DispatcherTimer(); + _timer.Interval = TimeSpan.FromMilliseconds(800); + _timer.Tick += _timer_Tick; + } + + public override void OnShow() + { + base.OnShow(); + _timer.Start(); + } + + protected override void Accept() + { + _timer.Stop(); + base.Accept(); + } + + protected override void Cancel() + { + _timer.Stop(); + base.Cancel(); + } + + private void _timer_Tick(object sender, EventArgs e) + { + SecondsRemaining--; + + if (SecondsRemaining == 0) + { + Cancel(); + } + } } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs index 08d135e21..c89db820d 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs @@ -417,7 +417,10 @@ namespace Tango.PPC.Jobs.ViewModels { vm.SupportedColorSpaces = new List<ColorSpaces>() { ColorSpaces.RGB }; vm.SelectedColorSpace = vm.SupportedColorSpaces.First(); + } + if (twnFile != null) + { vm.SupportedJobTypes = new List<JobTypes>() { JobTypes.Embroidery }; vm.SelectedJobType = vm.SupportedJobTypes.First(); } @@ -468,6 +471,7 @@ namespace Tango.PPC.Jobs.ViewModels else { job.AddSolidSegment(colorProfile.Value, machine.DefaultSegmentLength > 0 ? machine.DefaultSegmentLength : 100); + job.Name = $"SnapMatch {colorProfile.Value.R}, {colorProfile.Value.G}, {colorProfile.Value.B}"; } if (twnFile != null) diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/TwineCatalogView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/TwineCatalogView.xaml index a5ce50ad2..284666733 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/TwineCatalogView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/TwineCatalogView.xaml @@ -25,7 +25,7 @@ <touch:TouchLoadingPanel IsLoading="{Binding IsBusy}"> <DockPanel Margin="10"> <Border DockPanel.Dock="Bottom" Height="100"> - <touch:TouchButton Command="{Binding OKCommand}" HorizontalAlignment="Right" VerticalAlignment="Center" Content="OK" Height="50" Width="150" Style="{StaticResource TangoHollowButton}" Margin="0 0 20 0" /> + <touch:TouchButton Command="{Binding OKCommand}" FontSize="{StaticResource TangoButtonFontSize}" HorizontalAlignment="Right" VerticalAlignment="Center" Content="SELECT" Height="60" Width="200" Style="{StaticResource TangoHollowButton}" Margin="0 0 20 0" /> </Border> <Border Style="{StaticResource TangoTouchBorder}" Padding="20 20 20 100" Margin="0 10 0 0"> 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); - } } } |
