diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2024-09-03 22:47:14 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2024-09-03 22:47:14 +0300 |
| commit | afaa83f7b7a9fe78e34d069a43b0f2d61cc38b69 (patch) | |
| tree | daa087c9ed287ec83df167fcbb92dd973f38904b /Software/Visual_Studio | |
| parent | 507557c575f9e0cd53a288415d8dd92f7a001b36 (diff) | |
| download | Tango-afaa83f7b7a9fe78e34d069a43b0f2d61cc38b69.tar.gz Tango-afaa83f7b7a9fe78e34d069a43b0f2d61cc38b69.zip | |
Fixed rounding of liquid volumes CMYK and numeric controls.
Better support for TS-1800 waste replace process.
Diffstat (limited to 'Software/Visual_Studio')
12 files changed, 113 insertions, 64 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 9b47cf390..67b007371 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs @@ -116,7 +116,14 @@ namespace Tango.PPC.UI.ViewModels if (MachineProvider.IsConnected) { - await MachineProvider.MachineOperator.CompleteWasteReplacement(vm.DialogResult); + try + { + await MachineProvider.MachineOperator.CompleteWasteReplacement(vm.DialogResult); + } + catch (Exception ex) + { + await NotificationProvider.ShowError($"Could not complete the process correctly.\n{ex.Message}"); + } } }); } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest index d72e75011..efc5f8179 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest @@ -16,7 +16,7 @@ Remove this element if your application requires this virtualization for backwards compatibility. --> - <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> + <!--<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />--> </requestedPrivileges> </security> </trustInfo> diff --git a/Software/Visual_Studio/Tango.BL/LiquidVolume.cs b/Software/Visual_Studio/Tango.BL/LiquidVolume.cs index 793f94212..5b4cec488 100644 --- a/Software/Visual_Studio/Tango.BL/LiquidVolume.cs +++ b/Software/Visual_Studio/Tango.BL/LiquidVolume.cs @@ -61,7 +61,7 @@ namespace Tango.BL get { return _volume; } set { - _volume = Math.Max(0, Math.Round(value, 2)); + _volume = Math.Max(0, Math.Round(value, 4)); RaisePropertyChangedAuto(); OnVolumeChanged(); } diff --git a/Software/Visual_Studio/Tango.ColorConversion/DefaultColorConverter.cs b/Software/Visual_Studio/Tango.ColorConversion/DefaultColorConverter.cs index 43dc2e521..d6f34edd2 100644 --- a/Software/Visual_Studio/Tango.ColorConversion/DefaultColorConverter.cs +++ b/Software/Visual_Studio/Tango.ColorConversion/DefaultColorConverter.cs @@ -55,37 +55,39 @@ namespace Tango.ColorConversion NativePMR<ConversionInput, ConversionOutput> nativePMR = new NativePMR<ConversionInput, ConversionOutput>(convert); ConversionOutput output = nativePMR.Invoke(conversionInput); - if (conversionInput.UseLightInks) - { - try - { - InputLiquid cyan = conversionInput.InputCoordinates.InputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Cyan); - OutputLiquid lightCyan = output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.LightCyan); + //if (conversionInput.UseLightInks) + //{ + // try + // { + // InputLiquid cyan = conversionInput.InputCoordinates.InputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Cyan); + // OutputLiquid lightCyan = output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.LightCyan); - InputLiquid magenta = conversionInput.InputCoordinates.InputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Magenta); - OutputLiquid lightMagenta = output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.LightMagenta); + // InputLiquid magenta = conversionInput.InputCoordinates.InputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Magenta); + // OutputLiquid lightMagenta = output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.LightMagenta); - InputLiquid yellow = conversionInput.InputCoordinates.InputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Yellow); - OutputLiquid lightYellow = output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.LightYellow); + // InputLiquid yellow = conversionInput.InputCoordinates.InputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.Yellow); + // OutputLiquid lightYellow = output.SingleCoordinates.OutputLiquids.SingleOrDefault(x => x.LiquidType == PMR.ColorLab.LiquidType.LightYellow); - if (lightCyan != null && lightCyan.Volume > 0) - { - lightCyan.Volume = lightCyan.Volume.ReplaceDecimalPart(cyan.Volume); - } - if (lightMagenta != null && lightMagenta.Volume > 0) - { - lightMagenta.Volume = lightMagenta.Volume.ReplaceDecimalPart(magenta.Volume); - } - if (lightYellow != null && lightYellow.Volume > 0) - { - lightYellow.Volume = lightYellow.Volume.ReplaceDecimalPart(yellow.Volume); - } - } - catch (Exception) - { - LogManager.Default.Log("Error while correcting light inks decimal parts.", LogCategory.Error); - } - } + // if (lightCyan != null && lightCyan.Volume > 0) + // { + // lightCyan.Volume = (double)((decimal)cyan.Volume * 10m); + // } + // if (lightMagenta != null && lightMagenta.Volume > 0) + // { + // lightMagenta.Volume = (double)((decimal)magenta.Volume * 10m); + + // } + // if (lightYellow != null && lightYellow.Volume > 0) + // { + // lightYellow.Volume = (double)((decimal)yellow.Volume * 10m); + + // } + // } + // catch (Exception) + // { + // LogManager.Default.Log("Error while correcting light inks decimal parts.", LogCategory.Error); + // } + //} bool result = NativeMethods.FreeLibrary(pDll); diff --git a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs index cf3f9224c..6b32567a6 100644 --- a/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs +++ b/Software/Visual_Studio/Tango.Emulations/Emulators/MachineEmulator.cs @@ -36,6 +36,7 @@ using Tango.PMR.Power; using Tango.PMR.ThreadLoading; using Tango.PMR.IFS; using Tango.PMR.DataStore; +using Tango.Core.Threading; namespace Tango.Emulations.Emulators { @@ -83,7 +84,7 @@ namespace Tango.Emulations.Emulators private bool _abortPowerDown; private bool _isThreadLoadingStarted; private String _threadLoadingToken; - private DateTime _connectionTime; + private DateTime _connectionTime; private int _jobAbortCounter; private bool _abortHeadCleaning; private String _machineStatusRequestToken; @@ -2436,6 +2437,26 @@ namespace Tango.Emulations.Emulators } } + public async void RequestWasteEmptying() + { + try + { + ThreadFactory.StartNew(() => + { + Thread.Sleep(2000); + EventsStates.First(x => x.EventType == PMR.Diagnostics.EventType.CartridgesCoverOpen).IsActive = true; + Thread.Sleep(2000); + EventsStates.First(x => x.EventType == PMR.Diagnostics.EventType.CartridgesCoverOpen).IsActive = false; + }); + var response = await Transporter.SendRequest<WasteReplaceRequest, WasteReplaceResponse>(new WasteReplaceRequest(), new TransportRequestConfig() { Timeout = TimeSpan.FromSeconds(30) }); + LogManager.Log($"Waste Replace Approved: {response.Message.Approved}"); + } + catch (Exception ex) + { + LogManager.Log(ex); + } + } + #endregion } } diff --git a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs index d8a5ef6b8..1b229831f 100644 --- a/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs +++ b/Software/Visual_Studio/Tango.Integration/Operation/MachineOperator.cs @@ -1418,8 +1418,11 @@ namespace Tango.Integration.Operation protected virtual void OnWasteReplacementRequired(string token, WasteReplaceRequest wasteReplaceRequest) { - _lastWasteReplaceRequestToken = token; - WasteReplacementRequired?.Invoke(this, new EventArgs()); + if (_lastWasteReplaceRequestToken == null) + { + _lastWasteReplaceRequestToken = token; + WasteReplacementRequired?.Invoke(this, new EventArgs()); + } } #endregion @@ -4684,6 +4687,7 @@ namespace Tango.Integration.Operation if (_lastWasteReplaceRequestToken != null) { await SendResponse<WasteReplaceResponse>(new WasteReplaceResponse() { Approved = approved }, _lastWasteReplaceRequestToken); + _lastWasteReplaceRequestToken = null; } } diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs index 6c09cdc59..66433afc4 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs @@ -112,13 +112,13 @@ namespace Tango.Touch.Controls } public static readonly DependencyProperty MaximumProperty = DependencyProperty.Register("Maximum", typeof(double), typeof(TouchNumericTextBox), new PropertyMetadata(null)); - + public double Step { get { return (double)GetValue(StepProperty); } set { SetValue(StepProperty, value); } } - + public static readonly DependencyProperty StepProperty = DependencyProperty.Register("Step", typeof(double), typeof(TouchNumericTextBox), new PropertyMetadata(null)); @@ -154,7 +154,7 @@ namespace Tango.Touch.Controls set { SetValue(RippleBrushProperty, value); } } public static readonly DependencyProperty RippleBrushProperty = - DependencyProperty.Register("RippleBrush", typeof(Brush), typeof(TouchNumericTextBox), new PropertyMetadata(new SolidColorBrush(Color.FromRgb(189,189,189)) { Opacity = 0.28 })); + DependencyProperty.Register("RippleBrush", typeof(Brush), typeof(TouchNumericTextBox), new PropertyMetadata(new SolidColorBrush(Color.FromRgb(189, 189, 189)) { Opacity = 0.28 })); public virtual bool HasError @@ -164,7 +164,7 @@ namespace Tango.Touch.Controls return Validation.GetHasError(this); } } - + public override void OnApplyTemplate() { @@ -214,7 +214,7 @@ namespace Tango.Touch.Controls int coef = (int)((value + Step - 1) / Step); value = coef * Step; } - if(Minimum > 0 && value < Minimum) + if (Minimum > 0 && value < Minimum) { value = Minimum; } @@ -229,7 +229,7 @@ namespace Tango.Touch.Controls { value = Maximum; } - + } } @@ -276,16 +276,16 @@ namespace Tango.Touch.Controls { _prevent_text_change = true; - if (StringFormat != null) - { - _text_box.Text = Value.ToString(StringFormat); - } - else - { - _text_box.Text = Value.ToString(); - } + //if (StringFormat != null) + //{ + // _text_box.Text = Value.ToString(StringFormat); + //} + //else + //{ + _text_box.Text = Value.ToString(); + //} - _text_block.Text = _text_box.Text; + _text_block.Text = Value.ToString(StringFormat); _prevent_text_change = false; } @@ -316,7 +316,7 @@ namespace Tango.Touch.Controls e.Handled = true; return; } - else if(e.Text == "." && HasDecimalPoint) + else if (e.Text == "." && HasDecimalPoint) { e.Handled = false; return; diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericUpDownConrol.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericUpDownConrol.xaml index 8eea1bfbe..7d997ee08 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericUpDownConrol.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericUpDownConrol.xaml @@ -82,7 +82,7 @@ <Border Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" CornerRadius="2" Width="{Binding NumericPartWidth,RelativeSource={RelativeSource AncestorType=local:TouchNumericUpDownConrol}}" > <local:TouchNumericTextBox x:Name="Number_PART" Margin="0 4 0 0" FontSize="20" HorizontalContentAlignment="Center" VerticalAlignment="Center" BorderBrush="{TemplateBinding BorderBrush}" VerticalContentAlignment="Center" UpdateBindingOnlyWhenFocused="True" - Value="{Binding Value,RelativeSource={RelativeSource AncestorType=local:TouchNumericUpDownConrol}}" Minimum="{Binding MinValue,RelativeSource={RelativeSource AncestorType=local:TouchNumericUpDownConrol}}" Maximum="{Binding MaxValue,RelativeSource={RelativeSource AncestorType=local:TouchNumericUpDownConrol}}" HasDecimalPoint="True" StringFormat="0.##"/> + Value="{Binding Value,RelativeSource={RelativeSource AncestorType=local:TouchNumericUpDownConrol}}" Minimum="{Binding MinValue,RelativeSource={RelativeSource AncestorType=local:TouchNumericUpDownConrol}}" Maximum="{Binding MaxValue,RelativeSource={RelativeSource AncestorType=local:TouchNumericUpDownConrol}}" HasDecimalPoint="True" StringFormat="N2"/> </Border> <Border Margin="10 0 0 0" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="80"> diff --git a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerCMYKControl.cs b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerCMYKControl.cs index 20eb8b4e7..ba94ed30f 100644 --- a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerCMYKControl.cs +++ b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerCMYKControl.cs @@ -283,7 +283,7 @@ namespace Tango.Touch.Controls TouchColorPickerCMYKControl TouchColorPickerCMYKControl = (TouchColorPickerCMYKControl)d; if (TouchColorPickerCMYKControl != null) { - TouchColorPickerCMYKControl.OnCyanPropertyChanged((double)e.OldValue, Math.Round((double)e.NewValue, 2, MidpointRounding.AwayFromZero)); + TouchColorPickerCMYKControl.OnCyanPropertyChanged((double)e.OldValue, (double)e.NewValue); } } @@ -300,7 +300,7 @@ namespace Tango.Touch.Controls TouchColorPickerCMYKControl TouchColorPickerCMYKControl = (TouchColorPickerCMYKControl)d; if (TouchColorPickerCMYKControl != null) { - TouchColorPickerCMYKControl.OnMagentaLabPropertyChanged((double)e.OldValue, Math.Round((double)e.NewValue, 2, MidpointRounding.AwayFromZero)); + TouchColorPickerCMYKControl.OnMagentaLabPropertyChanged((double)e.OldValue, (double)e.NewValue); } } @@ -317,7 +317,7 @@ namespace Tango.Touch.Controls TouchColorPickerCMYKControl TouchColorPickerCMYKControl = (TouchColorPickerCMYKControl)d; if (TouchColorPickerCMYKControl != null) { - TouchColorPickerCMYKControl.OnYellowPropertyChanged((double)e.OldValue, Math.Round((double)e.NewValue, 2, MidpointRounding.AwayFromZero)); + TouchColorPickerCMYKControl.OnYellowPropertyChanged((double)e.OldValue, (double)e.NewValue); } } private void OnYellowPropertyChanged(double oldValue, double newValue) @@ -333,7 +333,7 @@ namespace Tango.Touch.Controls TouchColorPickerCMYKControl TouchColorPickerCMYKControl = (TouchColorPickerCMYKControl)d; if (TouchColorPickerCMYKControl != null) { - TouchColorPickerCMYKControl.OnKeyPropertyChanged((double)e.OldValue, Math.Round((double)e.NewValue, 2, MidpointRounding.AwayFromZero)); + TouchColorPickerCMYKControl.OnKeyPropertyChanged((double)e.OldValue, (double)e.NewValue); } } private void OnKeyPropertyChanged(double oldValue, double newValue) diff --git a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.cs b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.cs index 4f8082413..ae94cf9ac 100644 --- a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.cs +++ b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.cs @@ -9,7 +9,7 @@ using System.Windows.Media; namespace Tango.Touch.Controls { - public class TouchColorPickerControl: Control + public class TouchColorPickerControl : Control { private const string PART_ColorPickerSlider = "PART_ColorPickerSlider"; private const string PART_ColorPickerNumericUpDown = "PART_ColorPickerNumericUpDown"; @@ -40,12 +40,13 @@ namespace Tango.Touch.Controls } } + public double MinValue { get { return (double)GetValue(MinValueProperty); } set { SetValue(MinValueProperty, value); } } - + /// <summary> /// The slider minimum value property /// </summary> @@ -58,7 +59,7 @@ namespace Tango.Touch.Controls get { return (double)GetValue(MaxValueProperty); } set { SetValue(MaxValueProperty, value); } } - + /// <summary> /// The slider maximum value property /// </summary> @@ -75,10 +76,10 @@ namespace Tango.Touch.Controls } public void OnMaxPropertyChanged() { - if(_colorPickerNumericUpDown != null) + if (_colorPickerNumericUpDown != null) _colorPickerNumericUpDown.MaxValue = Math.Round(MaxValue, 2, MidpointRounding.AwayFromZero); - if(_colorPickerSlider != null) - _colorPickerSlider.Maximum = MaxValue; + if (_colorPickerSlider != null) + _colorPickerSlider.Maximum = MaxValue; } @@ -204,7 +205,7 @@ namespace Tango.Touch.Controls { _colorPickerNumericUpDown.MinValue = MinValue; _colorPickerNumericUpDown.MaxValue = Math.Round(MaxValue, 2, MidpointRounding.AwayFromZero); - _colorPickerNumericUpDown.Value = Math.Round( ColorValue, 2, MidpointRounding.AwayFromZero); + _colorPickerNumericUpDown.Value = ColorValue; //Math.Round( ColorValue, 2, MidpointRounding.AwayFromZero); _colorPickerNumericUpDown.ColorNumberChanged += ColorPickerNumber_ValueChanged; } } @@ -222,7 +223,7 @@ namespace Tango.Touch.Controls } public void ColorPickerSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) { - var newvalue = Math.Round(e.NewValue, 2, MidpointRounding.AwayFromZero); + var newvalue = e.NewValue;// Math.Round(e.NewValue, 2, MidpointRounding.AwayFromZero); if (_colorPickerNumericUpDown != null && _colorPickerNumericUpDown.Value != newvalue) { _colorPickerNumericUpDown.SetValueAnotherControl(newvalue); @@ -230,7 +231,7 @@ namespace Tango.Touch.Controls } } - + private void OnPickerSliderValueChanged(double oldValue, double newValue) { ColorValue = newValue; diff --git a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs index be77ee217..6b97bae31 100644 --- a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/ViewModels/MainViewVM.cs @@ -146,6 +146,8 @@ namespace Tango.MachineEM.UI.ViewModels public RelayCommand PerformDataStoreTestCommand { get; set; } + public RelayCommand RequestWasteReplaceCommand { get; set; } + #endregion #region Constructors @@ -179,6 +181,7 @@ namespace Tango.MachineEM.UI.ViewModels StartThreadLoadingCommand = new RelayCommand(StartThreadLoading, (x) => Emulator.IsStarted && !_isThreadLoading); FinalizeThreadLoadingCommand = new RelayCommand(FinalizeThreadLoading, (x) => Emulator.IsStarted && _isThreadLoading); AbortJobCommand = new RelayCommand(() => Emulator?.AbortJob(), (x) => Emulator.IsStarted); + RequestWasteReplaceCommand = new RelayCommand(RequestWasteReplace, (x) => Emulator.IsStarted); Ports = new List<string>() { @@ -411,6 +414,11 @@ namespace Tango.MachineEM.UI.ViewModels } } + private void RequestWasteReplace() + { + Emulator.RequestWasteEmptying(); + } + #endregion } } diff --git a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Views/MainView.xaml b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Views/MainView.xaml index c3c086065..98e70d6a5 100644 --- a/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Views/MainView.xaml +++ b/Software/Visual_Studio/Utilities/Tango.MachineEM.UI/Views/MainView.xaml @@ -82,6 +82,12 @@ <TextBlock VerticalAlignment="Center" Margin="10 0 10 0">CARTRIDGE VALIDATION</TextBlock> </StackPanel> </Button> + <Button Padding="10 0 0 0" Margin="5" Height="45" HorizontalContentAlignment="Left" Style="{StaticResource AccentedSquareButtonStyle}" mahapps:ButtonHelper.PreserveTextCase="True" BorderThickness="0" Command="{Binding RequestWasteReplaceCommand}"> + <StackPanel Orientation="Horizontal"> + <fa:ImageAwesome Icon="Recycle" Width="16"></fa:ImageAwesome> + <TextBlock VerticalAlignment="Center" Margin="10 0 10 0">REQUEST WASTE REPLACE</TextBlock> + </StackPanel> + </Button> <ToggleButton Style="{StaticResource AccentedSquareButtonStyle}" BorderThickness="0" x:Name="toggleLevels" Height="45" Margin="5"> <StackPanel Orientation="Horizontal"> <TextBlock VerticalAlignment="Center" Margin="10 0 10 0">MACHINE STATUS</TextBlock> |
