diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2022-01-30 14:45:35 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2022-01-30 14:45:35 +0200 |
| commit | 7340cf3da145a6eff01903fc7cf9da15983bf8af (patch) | |
| tree | e027e35068749df40174c6725c133669d83cb8fe /Software/Visual_Studio | |
| parent | 99ab23894ab92eb93774cca163c5558c43e6180f (diff) | |
| parent | 94506b081ec7cd46a7088718902313401999cb90 (diff) | |
| download | Tango-7340cf3da145a6eff01903fc7cf9da15983bf8af.tar.gz Tango-7340cf3da145a6eff01903fc7cf9da15983bf8af.zip | |
Merged Vica Fixes to new PPC UI.
Diffstat (limited to 'Software/Visual_Studio')
14 files changed, 90 insertions, 156 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/JobRunsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/JobRunsViewVM.cs index b671e053e..c8556960d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/JobRunsViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/JobRunsViewVM.cs @@ -659,7 +659,7 @@ namespace Tango.MachineStudio.Statistics.ViewModels "LightYellow" }, }); - var selection = JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.JobRun.EndDate != null && z.JobRun.ActualStartDate != null); + var selection = JobRuns;// item 5861 (all available jobs should be saved) .Where(z => z.JobRun.EndPosition > 0 && z.JobRun.EndDate != null && z.JobRun.ActualStartDate != null); foreach (var jobRunModel in selection) { ExcelModel excel_model = new ExcelModel(); diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs index 10fe6e821..0412cb64a 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionViewVM.cs @@ -290,7 +290,7 @@ namespace Tango.PPC.Jobs.Dialogs public ColorSelectionViewVM() { - SelectedColorTab = ColorTab.RGB; + SelectedColorTab = ColorTab.Volume; _volumeConversionTimer = new ActionTimer(TimeSpan.FromMilliseconds(50)); _converter = new DefaultColorConverter(); CollectionFilter = new DefaultCollectionFilter(); @@ -356,7 +356,7 @@ namespace Tango.PPC.Jobs.Dialogs else { SelectedBrushStop = DialogEditObject.BrushStopForEdit; - SelectedColorTab = ColorTab.RGB; + SelectedColorTab = ColorTab.Volume; SelectedCatalog = Catalogs.FirstOrDefault(); } SelectedBrushStop.ColorCatalogsItemChanged -= OnColorSelectionItemChanged; diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs index 03ae2bbab..2033fac48 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/BrushStopModel.cs @@ -613,21 +613,31 @@ namespace Tango.PPC.Jobs.Models LiquidVolumesOutOfRange = false; } - public BrushStopModel(BrushStop brushStop, SegmentModel segmentModel) + public BrushStopModel(BrushStop brushStop, SegmentModel segmentModel, int version) { SegmentModel = segmentModel; OffsetPercent = brushStop.OffsetPercent; Color = brushStop.Color; BestMatchColor = brushStop.Color; ColorSpace = brushStop.ColorSpace.Space; - ColorCatalogsItem = brushStop.ColorCatalogsItem; - StopIndex = brushStop.StopIndex; + _colorcatalogsitem = brushStop.ColorCatalogsItem; + _stopindex = brushStop.StopIndex; PreventPropertyUpdate = true; - Cyan = brushStop.Cyan; - Magenta = brushStop.Magenta; - Yellow = brushStop.Yellow; - Black = brushStop.Black; + if(version == 1) + { + Cyan = brushStop.GetVolume(LiquidTypes.Cyan); + Magenta = brushStop.GetVolume(LiquidTypes.Magenta); + Yellow = brushStop.GetVolume(LiquidTypes.Yellow); + Black = brushStop.GetVolume(LiquidTypes.Black); + } + else + { + Cyan = brushStop.Cyan; + Magenta = brushStop.Magenta; + Yellow = brushStop.Yellow; + Black = brushStop.Black; + } Red = brushStop.Red; Green = brushStop.Green; Blue = brushStop.Blue; @@ -1081,7 +1091,8 @@ namespace Tango.PPC.Jobs.Models } catch (Exception ex) { - LogManager.Log(ex, "An error occurred while trying to get volume => RGB from conversion engine."); + LogManager.Log(ex, "An error occurred while trying to get volume => RGB from conversion engine." + ex); + //convertedString = Regex.Replace(ex,@"\xEF\xBF\xBD"," "); } finally { @@ -1274,7 +1285,7 @@ namespace Tango.PPC.Jobs.Models } catch (Exception ex) { - LogManager.Log(ex, "An error occurred while trying to get volume => RGB from conversion engine."); + LogManager.Log(ex, "An error occurred while trying to get volume => RGB from conversion engine." + ex); BestMatchColor = Color.FromRgb((byte)Red, (byte)Green, (byte)Blue); } finally diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs index c7b9d9b6d..0106d82c4 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs @@ -384,7 +384,7 @@ namespace Tango.PPC.Jobs.Models public bool HasSelectedItems { get { - bool test = Segments.ToList().Any(x => x.IsSelected); + //bool test = Segments.ToList().Any(x => x.IsSelected); return Segments.ToList().Any(x => x.IsSelected); } } public List<SegmentModel> SegmentsToCopy { get; set; } @@ -541,8 +541,11 @@ namespace Tango.PPC.Jobs.Models private void OnInterSegmentlengthChanged() { _preventChange = true; - int max = Segments.Max(x => x.SegmentIndex); - Segments.Where(i => i.SegmentIndex != max).ToList().ForEach(x => x.EnableInterSegment = InterSegmentLength > 0); + if (Segments.Count > 0) + { + int max = Segments.Max(x => x.SegmentIndex); + Segments.Where(i => i.SegmentIndex != max).ToList().ForEach(x => x.EnableInterSegment = InterSegmentLength > 0); + } _preventChange = false; } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobSummeryViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobSummeryViewVM.cs index 467013607..10593cc36 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobSummeryViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobSummeryViewVM.cs @@ -182,10 +182,12 @@ namespace Tango.PPC.Jobs.ViewModels LogManager.Log(ex, "Error calculating recommended process parameters."); } }); - IsPreparingJob = false; - - _canStartJob = true; + if(Job.Segments.Where( x=>x.BrushStops.Count == 0).ToList().Count == 0) + { + _canStartJob = true; + } + InvalidateRelayCommands(); } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs index d770dbe51..d00cf14fd 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs @@ -193,35 +193,6 @@ namespace Tango.PPC.Jobs.ViewModels set { _approvalFineTuneItems = value; RaisePropertyChangedAuto(); } } - //private bool _isFineTuneExpanded; - ///// <summary> - ///// Gets or sets a value indicating whether the fine tuning region is expanded. - ///// </summary> - //public bool IsFineTuneExpanded - //{ - // get { return _isFineTuneExpanded; } - // set - // { - // _isFineTuneExpanded = value; - // RaisePropertyChangedAuto(); - - // if (_isFineTuneExpanded) - // { - // SyncFineTuneItemsToBrushStops(); - // } - // } - //} - - //private bool _isJobDetailsExpanded; - ///// <summary> - ///// Gets or sets a value indicating whether the job details area is expanded. - ///// </summary> - //public bool IsJobDetailsExpanded - //{ - // get { return _isJobDetailsExpanded; } - // set { _isJobDetailsExpanded = value; RaisePropertyChangedAuto(); } - //} - /// <summary> /// Gets or sets the twine catalog automatic complete provider. /// </summary> @@ -549,8 +520,7 @@ namespace Tango.PPC.Jobs.ViewModels ColorSpace = Job.ColorSpace, SpoolType = Job.SpoolType, User = Job.User, - Machine = Job.Machine, - InterSegmentLength = Job.EnableInterSegment ? Job.InterSegmentLength : 0 + Machine = Job.Machine }; foreach (var segm in Job.Segments) @@ -578,8 +548,8 @@ namespace Tango.PPC.Jobs.ViewModels brushes[index].Segment = currentSegment; brushes[index + 1].Segment = currentSegment; csegmentModel.Length = (lengthOfOldSegment * (brushes[index + 1].OffsetPercent - brushes[index].OffsetPercent) / 100d); - BrushStopModel brushStopModelFirst = new BrushStopModel(brushes[index], csegmentModel); - BrushStopModel brushStopModelSecond = new BrushStopModel(brushes[index + 1], csegmentModel); + BrushStopModel brushStopModelFirst = new BrushStopModel(brushes[index], csegmentModel, 1); + BrushStopModel brushStopModelSecond = new BrushStopModel(brushes[index + 1], csegmentModel, 1); csegmentModel.CreateGradientBrushes(brushStopModelFirst, brushStopModelSecond); jobModel.Segments.Add(csegmentModel); @@ -597,7 +567,7 @@ namespace Tango.PPC.Jobs.ViewModels }; foreach (var brushStop in segm.BrushStops) { - BrushStopModel brushStopModel = new BrushStopModel(brushStop, segmentModel); + BrushStopModel brushStopModel = new BrushStopModel(brushStop, segmentModel, Job.Version); segmentModel.BrushStops.Add(brushStopModel); } @@ -605,6 +575,8 @@ namespace Tango.PPC.Jobs.ViewModels jobModel.Segments.Add(segmentModel); } } + + jobModel.InterSegmentLength = Job.EnableInterSegment ? Job.InterSegmentLength : 0; jobModel.Segments.Last().IsLast = true; JobModel = jobModel; SegmentsCollectionView = CollectionViewSource.GetDefaultView(JobModel.Segments); @@ -1131,9 +1103,9 @@ namespace Tango.PPC.Jobs.ViewModels } catch (Exception ex) { - LogManager.Log(ex, "Error saving job to database."); + LogManager.Log(ex, "Error saving job to database. " + ex.InnerException.Message); await NotificationProvider.ShowError("Error saving the current job."); - return false; + return true; } } @@ -1180,8 +1152,13 @@ namespace Tango.PPC.Jobs.ViewModels private async void DeleteSegments() { - if (false == JobModel.Segments.ToList().Any(x => x.IsSelected)) + if (!JobModel.HasSelectedItems) + return; + if(JobModel.Segments.ToList().Where(x => x.IsSelected).ToList().Count == JobModel.Segments.Count) + { + await NotificationProvider.ShowInfo("A job must contain at least one segment. Please, change selection."); return; + } if (JobModel.Segments.Count > 1) { @@ -1317,7 +1294,7 @@ namespace Tango.PPC.Jobs.ViewModels } Job.LastUpdated = DateTime.UtcNow; Job.IsSynchronized = false; - Job.JobStatus = BL.Enumerations.JobStatuses.Draft; + //Job.JobStatus = BL.Enumerations.JobStatuses.Draft; //_current_job_string = Job.ToJobFileWhenLoaded().ToString(); RaiseMessage(new JobSavedMessage() { Job = Job }); diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs index 3b1d6d9e6..85d469ac1 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs @@ -424,9 +424,9 @@ namespace Tango.PPC.Jobs.ViewModels } JobCreationViewVM vm = new JobCreationViewVM( _spoolTypes.ToList(), _rmls.ToList(), 0, false ); var selectedRmlGuid = Settings.DefaultRmlGuid; - var selectedSpoolTypeGuid = Settings.DefaultSpoolTypeGuid; + var selectedSpoolTypeGuid = Settings.SpoolTypeGuid; vm.SelectedRML = _rmls.FirstOrDefault(x => x.Guid == Settings.DefaultRmlGuid); - vm.SelectedSpoolType = _spoolTypes.FirstOrDefault( x=>x.Guid == Settings.DefaultSpoolTypeGuid ); + vm.SelectedSpoolType = _spoolTypes.FirstOrDefault( x=>x.Guid == Settings.SpoolTypeGuid ); if (twnFile == null) { vm = await NotificationProvider.ShowDialog<JobCreationViewVM>(vm); @@ -854,7 +854,7 @@ namespace Tango.PPC.Jobs.ViewModels job.Machine = await new MachineBuilder(db).Set(job.MachineGuid).WithCats().WithConfiguration().BuildAsync(); job.Rml = await new RmlBuilder(db).Set(job.RmlGuid).WithActiveParametersGroup().WithCAT(MachineProvider.Machine.Guid).WithCCT().WithLiquidFactors().BuildAsync(); job.WindingMethodGuid = Adapter.WindingMethods.FirstOrDefault().Guid; - job.SpoolTypeGuid = Settings.DefaultSpoolTypeGuid != null ? Settings.DefaultSpoolTypeGuid : Adapter.SpoolTypes.FirstOrDefault().Guid; + job.SpoolTypeGuid = Settings.SpoolTypeGuid != null ? Settings.SpoolTypeGuid : Adapter.SpoolTypes.FirstOrDefault().Guid; foreach (var segment in segments) { diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml index b8930089d..2e3884479 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml @@ -197,13 +197,13 @@ </DataTemplate> <DataTemplate x:Key="Segment_Template" DataType="{x:Type entities:Segment}"> - <Grid Height="430" Margin="57 15 57 0"> + <Grid Height="380" Margin="57 15 57 0"> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> - <RowDefinition Height="Auto" /> + <RowDefinition Height="1*" /> </Grid.RowDefinitions> <DockPanel> @@ -346,7 +346,7 @@ <Grid Grid.Row="4" x:Name="add_new_segment_gap" HorizontalAlignment="Stretch" Margin="0 30 0 0" > <Grid.RowDefinitions> <RowDefinition Height="Auto"/> - <RowDefinition Height="Auto"/> + <RowDefinition Height="1*"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <Rectangle Stroke="{StaticResource TangoDividerBrush}" StrokeThickness="1" VerticalAlignment="Top" /> @@ -626,7 +626,7 @@ <!--Border x:Name="borderDockFloat" Height="10" Margin="0 0 0 0" BorderBrush="Transparent" > <DockPanel x:Name="dockEdit" LastChildFill="False" Height="10" Width="50" HorizontalAlignment="Right" RenderTransformOrigin="0.58,2.08"/> </Border> --> - <ListBox x:Name="listSegments" Margin="10 0 10 40" ItemsSource="{Binding SegmentsCollectionView}" ItemTemplate="{StaticResource Segment_Template}" Style="{StaticResource SegmentsListBox}" + <ListBox x:Name="listSegments" Margin="10 0 10 60" ItemsSource="{Binding SegmentsCollectionView}" ItemTemplate="{StaticResource Segment_Template}" Style="{StaticResource SegmentsListBox}" ScrollViewer.VerticalScrollBarVisibility="Visible" Visibility="{Binding IsFullMode, Converter={StaticResource BooleanToVisibilityConverter}}" /> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml.cs index 31a7f7918..6693f67e0 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobView.xaml.cs @@ -48,96 +48,11 @@ namespace Tango.PPC.Jobs.Views } - //private void OnBrushStopFieldValueChanged(object sender, Touch.Controls.DoubleValueChangedEventArgs e) - //{ - // _vm.OnBrushStopFieldValueChanged((sender as FrameworkElement).DataContext as BrushStop); - //} - - public void DisplaySampleDye() - { - //expander_sample_dye.IsExpanded = true; - //await Task.Delay(500); - //scrollViewer.ScrollToElement(expander_sample_dye); - } - - public void DisplayFineTuning() - { - //expander_fine_tuning.IsExpanded = true; - //await Task.Delay(500); - //scrollViewer.ScrollToElement(expander_fine_tuning); - } - public void OnNavigatedFrom() { } - - //private void scrollViewer_Scrolling(object sender, Touch.Controls.DoubleValueChangedEventArgs e) - //{ - // if (_vm.JobModel != null && _vm.JobModel.Segments != null && _vm.JobModel.Segments.Count > 3) - // { - // var position = scrollViewer.GetElementPosition(listSegments); - // var stackOutputPosition = scrollViewer.GetElementPosition(stackOutput); - - // if (stackOutputPosition.Y > 100) - // { - // if (position.Y < 110 && !_is_edit_docked) - // { - // DockEditing(); - // } - // else if (position.Y > 110 && _is_edit_docked) - // { - // FloatEditing(); - // } - // } - // else - // { - // borderEditDock.Visibility = Visibility.Collapsed; - // } - // } - // else if (_is_edit_docked) - // { - // FloatEditing(); - // } - //} - - //private void DockEditing() - //{ - // _is_edit_docked = true; - // borderDockFloat.Child = null; - // borderEditDock.Child = dockEdit; - // borderEditDock.Visibility = Visibility.Visible; - //} - - //private void FloatEditing() - //{ - // _is_edit_docked = false; - // borderEditDock.Child = null; - // borderDockFloat.Child = dockEdit; - // borderEditDock.Visibility = Visibility.Collapsed; - //} - - //private void OnLiquidVolumeFieldValueChanged(object sender, Touch.Controls.DoubleValueChangedEventArgs e) - //{ - // var liquidVolume = (sender as FrameworkElement).DataContext as LiquidVolume; - - // if (liquidVolume != null) - // { - // _vm.OnBrushStopFieldValueChanged(liquidVolume.BrushStop); - // } - //} - public void ScrollToTop() - { - if(listSegments.IsVisible && listSegments.Items.Count > 0) - { - listSegments.ScrollIntoView(listSegments.Items[0]); - - } - //FloatEditing(); - //scrollViewer.ScrollToTop(); - } - private void Length_ValueChanged(object sender, Touch.Controls.DoubleValueChangedEventArgs e) { var segmentModel = (sender as FrameworkElement).DataContext as SegmentModel; @@ -156,5 +71,20 @@ namespace Tango.PPC.Jobs.Views } } + + public void DisplaySampleDye() + { + + } + + public void DisplayFineTuning() + { + + } + + public void ScrollToTop() + { + + } } } diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/ColorSpaces.cs b/Software/Visual_Studio/Tango.BL/Enumerations/ColorSpaces.cs index d254475d9..00fb75b42 100644 --- a/Software/Visual_Studio/Tango.BL/Enumerations/ColorSpaces.cs +++ b/Software/Visual_Studio/Tango.BL/Enumerations/ColorSpaces.cs @@ -49,5 +49,11 @@ namespace Tango.BL.Enumerations [Description("Catalog")] Catalog = 4, + /// <summary> + /// (Catalog) + /// </summary> + [Description("HSB")] + HSB = 5, + } } diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs index 224f2d25b..77891b36b 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericTextBox.cs @@ -280,6 +280,11 @@ namespace Tango.Touch.Controls e.Handled = true; return; } + else if(e.Text == "." && HasDecimalPoint) + { + e.Handled = false; + return; + } if (e.Text == "-" && !_text_box.Text.Contains("-")) { diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericUpDownConrol.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericUpDownConrol.xaml index 8963c9c3e..a47d890b7 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericUpDownConrol.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericUpDownConrol.xaml @@ -81,7 +81,7 @@ <Border Background="Transparent" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" CornerRadius="2" Width="54"> <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}}"/> + 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.#"/> </Border> <Border Margin="10 0 0 0" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="80"> diff --git a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.cs b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.cs index 12ac39f3f..ab319b479 100644 --- a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.cs +++ b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.cs @@ -76,7 +76,7 @@ namespace Tango.Touch.Controls public void OnMaxPropertyChanged() { if(_colorPickerNumericUpDown != null) - _colorPickerNumericUpDown.MaxValue = MaxValue; + _colorPickerNumericUpDown.MaxValue = Math.Round(MaxValue, 1, MidpointRounding.AwayFromZero); if(_colorPickerSlider != null) _colorPickerSlider.Maximum = MaxValue; @@ -203,8 +203,8 @@ namespace Tango.Touch.Controls if (_colorPickerNumericUpDown != null) { _colorPickerNumericUpDown.MinValue = MinValue; - _colorPickerNumericUpDown.MaxValue = MaxValue; - _colorPickerNumericUpDown.Value = ColorValue; + _colorPickerNumericUpDown.MaxValue = Math.Round(MaxValue, 1, MidpointRounding.AwayFromZero); + _colorPickerNumericUpDown.Value = Math.Round( ColorValue, 1, MidpointRounding.AwayFromZero); _colorPickerNumericUpDown.ColorNumberChanged += ColorPickerNumber_ValueChanged; } } @@ -222,9 +222,9 @@ namespace Tango.Touch.Controls } public void ColorPickerSlider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e) { - if (_colorPickerNumericUpDown != null && _colorPickerNumericUpDown.Value != e.NewValue) + if (_colorPickerNumericUpDown != null && _colorPickerNumericUpDown.Value != Math.Round(e.NewValue, 1, MidpointRounding.AwayFromZero)) { - _colorPickerNumericUpDown.Value = e.NewValue; + _colorPickerNumericUpDown.Value = Math.Round(e.NewValue, 1, MidpointRounding.AwayFromZero); OnPickerSliderValueChanged(e.OldValue, e.NewValue); } } diff --git a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.xaml b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.xaml index 5e2d2eb87..906e181c8 100644 --- a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.xaml +++ b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.xaml @@ -22,7 +22,7 @@ </Grid.ColumnDefinitions> <Grid Grid.Row="0"> <TextBlock FontSize="{StaticResource TangoComboBoxItemFontSize}" TextBlock.Text="{Binding ColorPickerText, RelativeSource={RelativeSource AncestorType=local:TouchColorPickerControl}}" HorizontalAlignment="Left" Margin="6 0 0 0" FontWeight="SemiBold" VerticalAlignment="Center" /> - <local:TouchNumericUpDownConrol x:Name="PART_ColorPickerNumericUpDown" HorizontalAlignment="Right" BorderThickness="0.8" BorderBrush="{TemplateBinding BorderBrush}" Margin="0 0 5 0" MaxValue="{Binding RelativeSource={RelativeSource AncestorType=local:TouchColorPickerControl}, Path=MaxValue}"/> + <local:TouchNumericUpDownConrol x:Name="PART_ColorPickerNumericUpDown" HorizontalAlignment="Right" BorderThickness="0.8" BorderBrush="{TemplateBinding BorderBrush}" Margin="0 0 5 0" MaxValue="{Binding RelativeSource={RelativeSource AncestorType=local:TouchColorPickerControl}, Path=MaxValue, StringFormat='0.##'}"/> </Grid> <local:TouchColorPickerSlider x:Name="PART_ColorPickerSlider" Grid.Row="1" Margin=" 0 10 0 0" Background="{TemplateBinding Background}" ThumbHeightInside ="{Binding RelativeSource={RelativeSource AncestorType=local:TouchColorPickerControl}, Path=ThumbHeightInside}" @@ -32,7 +32,7 @@ Maximum="{Binding MaxValue, RelativeSource={RelativeSource AncestorType=local:TouchColorPickerControl}}"/> <DockPanel Grid.Row="2" Margin=" 0 0 0 0"> <TextBlock DockPanel.Dock="Left" FontSize="{StaticResource TangoSmallFontSize}" TextBlock.Text="{Binding RelativeSource={RelativeSource AncestorType=local:TouchColorPickerControl}, Path=MinValue}" HorizontalAlignment="Left" Margin="6 0 0 0" VerticalAlignment="Center" FontWeight="SemiBold"/> - <TextBlock DockPanel.Dock="Right" FontSize="{StaticResource TangoSmallFontSize}" TextBlock.Text="{Binding RelativeSource={RelativeSource AncestorType=local:TouchColorPickerControl}, Path=MaxValue}" HorizontalAlignment="Right" Margin="6 0 0 0" VerticalAlignment="Center" FontWeight="SemiBold" /> + <TextBlock DockPanel.Dock="Right" FontSize="{StaticResource TangoSmallFontSize}" TextBlock.Text="{Binding RelativeSource={RelativeSource AncestorType=local:TouchColorPickerControl}, Path=MaxValue, StringFormat='0.0'}" HorizontalAlignment="Right" Margin="6 0 0 0" VerticalAlignment="Center" FontWeight="SemiBold" /> </DockPanel> </Grid> </ControlTemplate> |
