diff options
18 files changed, 317 insertions, 106 deletions
diff --git a/Software/PMR/Messages/Exports/JobFileBrushStop.proto b/Software/PMR/Messages/Exports/JobFileBrushStop.proto index bbcedbf4a..224d86d0f 100644 --- a/Software/PMR/Messages/Exports/JobFileBrushStop.proto +++ b/Software/PMR/Messages/Exports/JobFileBrushStop.proto @@ -29,4 +29,5 @@ message JobFileBrushStop string ColorCatalogGuid = 22; string ColorCatalogItemGuid = 23; bool IsTransparent = 25; + int32 StopIndex = 26; }
\ No newline at end of file diff --git a/Software/PMR/Messages/Exports/JobFileSegment.proto b/Software/PMR/Messages/Exports/JobFileSegment.proto index 8a2218ffa..8f81f89e7 100644 --- a/Software/PMR/Messages/Exports/JobFileSegment.proto +++ b/Software/PMR/Messages/Exports/JobFileSegment.proto @@ -10,4 +10,6 @@ message JobFileSegment string Name = 1; double Length = 2; repeated JobFileBrushStop BrushStops = 3; + repeated JobFileSegment Segments = 4; + int32 Repeats = 5; }
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationView.xaml index 2aac7320a..5ab26458c 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/JobCreationView.xaml @@ -30,14 +30,14 @@ <!--<Image Source="../Images/JobView/job-details.png" Width="34" />--> <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0 0 0 0" FontSize="{StaticResource TangoHeaderFontSize}">Job Details</TextBlock> <Border BorderThickness="0 0 1 0" BorderBrush="{StaticResource TangoDividerBrush}" Margin="30 0 0 0"> - <touch:TouchImageButton Width="32" Height="32" Image="{StaticResource Close_mycolorsdlg}" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0 0 23 0" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding CloseCommand}" /> + <touch:TouchImageButton Width="32" Height="32" Image="{StaticResource Close_mycolorsdlg}" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0 0 23 0" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding CloseCommand}" Focusable="False"/> </Border> </Grid> <Grid Grid.Row="1" Margin="24 17 24 31" Background="{StaticResource TangoPrimaryBackgroundBrush}"> <Grid x:Name="Container" keyboard:KeyboardView.ContainerOffset="40"> <DockPanel Margin="47 38 54 40" > <Grid DockPanel.Dock="Bottom"> - <touch:TouchButton HorizontalAlignment="Center" CornerRadius="25" Command="{Binding OKCommand}" KeyboardNavigation.TabIndex="4" Width="180" Height="48" VerticalAlignment="Bottom" keyboard:KeyboardView.Container="{Binding ElementName=Container}" TextElement.Foreground="{StaticResource TangoLightForegroundBrush}" FontSize="{StaticResource TangoButtonFontSize}" Content="OK"> + <touch:TouchButton HorizontalAlignment="Center" CornerRadius="25" Command="{Binding OKCommand}" KeyboardNavigation.TabIndex="3" Width="180" Height="48" VerticalAlignment="Bottom" keyboard:KeyboardView.Container="{Binding ElementName=Container}" TextElement.Foreground="{StaticResource TangoLightForegroundBrush}" FontSize="{StaticResource TangoButtonFontSize}" Content="OK"> <touch:TouchButton.Style > <Style TargetType="touch:TouchButton" > <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter> @@ -72,7 +72,7 @@ <DockPanel HorizontalAlignment="Stretch" Margin="0 50 0 0"> <TextBlock HorizontalAlignment="Left" Margin="0 10 0 0" Text="Thread Type" FontSize="{StaticResource TangoDialogFontSize}" Width="155"/> <Border Margin="49 0 0 0" BorderThickness="1" Height="44" CornerRadius="22" BorderBrush="{StaticResource TangoMidAccentBrush}"> - <touch:TouchComboBox Margin="20 0 10 10" ItemsSource="{Binding Rmls}" SelectedItem="{Binding SelectedRML,Mode=TwoWay}" KeyboardNavigation.TabIndex="2" keyboard:KeyboardView.Container="{Binding ElementName=Container}"> + <touch:TouchComboBox Margin="20 0 10 10" ItemsSource="{Binding Rmls}" SelectedItem="{Binding SelectedRML,Mode=TwoWay}" Focusable="False" > <touch:TouchComboBox.ItemTemplate> <DataTemplate> <TextBlock Margin="20 10 10 10" TextTrimming="CharacterEllipsis" FontSize="{StaticResource TangoDialogFontSize}" Text="{Binding Name}"> @@ -89,7 +89,7 @@ </Border> </DockPanel> <DockPanel Margin="210 15 0 0" TextElement.Foreground="{StaticResource TangoGrayTextBrush}" Visibility="{Binding LubricationLevel,Converter={StaticResource IsNullToVisibilityConverter}}"> - <touch:TouchIcon Icon="AlertCircleOutline" Width="16" Foreground="{StaticResource TangoGrayTextBrush}" /> + <touch:TouchIcon Icon="AlertCircleOutline" Width="16" Foreground="{StaticResource TangoGrayTextBrush}" Focusable="False"/> <TextBlock Margin="5 0 0 0"> <Run Text="{Binding LubricationLevel.LubricationLevel,Mode=OneWay,Converter={StaticResource EnumToDescriptionConverter}}"></Run> <Run>Lubrication</Run> @@ -97,7 +97,7 @@ </DockPanel> <StackPanel TextElement.Foreground="{StaticResource TangoGrayTextBrush}" Margin="210 5 0 0" HorizontalAlignment="Left" Visibility="{Binding MachineProvider.Machine.BtsrInstalled,Converter={StaticResource BooleanToVisibilityConverter}}"> <DockPanel> - <touch:TouchIcon Icon="AlertCircleOutline" Width="16" Foreground="{StaticResource TangoGrayTextBrush}" /> + <touch:TouchIcon Icon="AlertCircleOutline" Width="16" Foreground="{StaticResource TangoGrayTextBrush}" Focusable="False" /> <TextBlock Margin="5 0 0 0" VerticalAlignment="Center"> <Run>Required tensioner level is </Run> <Run Text="{Binding BtsrSpoolTension}" FontWeight="Bold"></Run> @@ -133,21 +133,21 @@ <Run Text="[m]" FontWeight="SemiBold"></Run> </TextBlock> <Border Margin="49 0 0 0" BorderThickness="1" Height="44" CornerRadius="22" BorderBrush="{StaticResource TangoMidAccentBrush}"> - <touch:TouchNumericTextBox Margin="20 0 0 10" FontSize="{StaticResource TangoComboBoxItemFontSize}" Value="{Binding WhiteGap, Mode=TwoWay}" IsEnabled="True" HorizontalAlignment="Left" MinWidth="250" VerticalAlignment="Center" FocusSelectionMode="SelectAll" KeyboardNavigation.TabIndex="3" keyboard:KeyboardView.Container="{Binding ElementName=Container}"></touch:TouchNumericTextBox> + <touch:TouchNumericTextBox Margin="20 0 0 10" FontSize="{StaticResource TangoComboBoxItemFontSize}" Value="{Binding WhiteGap, Mode=TwoWay}" IsEnabled="True" HorizontalAlignment="Left" MinWidth="250" VerticalAlignment="Center" FocusSelectionMode="SelectAll" KeyboardNavigation.TabIndex="2"></touch:TouchNumericTextBox> </Border> </DockPanel > </StackPanel> <Grid Grid.Row="2" Margin="0 70 0 0" HorizontalAlignment="Stretch" Visibility="{Binding ShowDuplicate, Converter={StaticResource BooleanToVisibilityConverter}}"> <TextBlock HorizontalAlignment="Left" Margin="0 10 0 0" Text="Duplicate Job As New" FontWeight="Normal" FontSize="{StaticResource TangoDialogFontSize}" Width="Auto"/> - <touch:TouchButton CornerRadius="25" Command="{Binding DuplicateCommand}" Width="180" Height="48" VerticalAlignment="Center" HorizontalAlignment="Right" Background="{StaticResource TangoPrimaryAccentBrush}" TextElement.Foreground="{StaticResource TangoLightForegroundBrush}" FontSize="{StaticResource TangoButtonFontSize}">Duplicate</touch:TouchButton> + <touch:TouchButton CornerRadius="25" Command="{Binding DuplicateCommand}" Width="180" Height="48" VerticalAlignment="Center" HorizontalAlignment="Right" Background="{StaticResource TangoPrimaryAccentBrush}" TextElement.Foreground="{StaticResource TangoLightForegroundBrush}" FontSize="{StaticResource TangoButtonFontSize}" Focusable="False">Duplicate</touch:TouchButton> </Grid> <Grid Grid.Row="3" Margin="0 70 0 0" HorizontalAlignment="Stretch" Visibility="{Binding ShowDuplicate, Converter={StaticResource BooleanToVisibilityConverter}}"> <TextBlock HorizontalAlignment="Left" Margin="0 10 0 0" Text="Save Job As PDF" FontWeight="Normal" FontSize="{StaticResource TangoDialogFontSize}" Width="Auto"/> <touch:TouchButton CornerRadius="25" Width="180" Height="48" VerticalAlignment="Center" HorizontalAlignment="Right" TextElement.Foreground="{StaticResource TangoLightForegroundBrush}" - FontSize="{StaticResource TangoButtonFontSize}" Content="Export" IsEnabled="False"> + FontSize="{StaticResource TangoButtonFontSize}" Content="Export" IsEnabled="False" Focusable="False"> <touch:TouchButton.Style > <Style TargetType="touch:TouchButton" > <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter> 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 b7106a8a3..465fd426a 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 @@ -626,7 +626,7 @@ namespace Tango.PPC.Jobs.Models ColorSpace = brushStop.ColorSpace.Space; _colorcatalogsitem = brushStop.ColorCatalogsItem; _stopindex = brushStop.StopIndex; - + PreventPropertyUpdate = true; if(version == 1) { 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 735eb77e2..6aaa368c1 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 @@ -16,6 +16,7 @@ namespace Tango.PPC.Jobs.Models private bool _preventChange; #region Properties + protected String _name; public String Name @@ -121,7 +122,6 @@ namespace Tango.PPC.Jobs.Models RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(LengthIncludingNumberOfUnits)); RaisePropertyChanged(nameof(GetEstimatedDuration)); - } } } @@ -317,6 +317,8 @@ namespace Tango.PPC.Jobs.Models } public JobTypes JobType { get; set; } + public bool JobChanged { get; set; } + protected SynchronizedObservableCollection<SegmentModel> _segments; /// <summary> @@ -458,6 +460,8 @@ namespace Tango.PPC.Jobs.Models #endregion + #region constructors + public JobModel(List<ColorSpace> list) { ColorSpacesList = list; @@ -474,8 +478,11 @@ namespace Tango.PPC.Jobs.Models GroupingSegments.CollectionChanged += SegmentsGroup_CollectionChanged; SelectAllSegments = false; NumberOfUnits = 1; + JobChanged = false; } + #endregion + #region modifications private void OnSegmentsChanged() 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 cadbc6275..e37686a33 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 @@ -614,6 +614,7 @@ namespace Tango.PPC.Jobs.ViewModels } segmentModel.ArrangeBrushStopsPosition(); + segmentModel.UpdateMiddleColorBrush(); return segmentModel; } @@ -701,6 +702,7 @@ namespace Tango.PPC.Jobs.ViewModels Job.EnableInterSegment = vm.WhiteGap > 0; JobModel.InterSegmentLength = vm.WhiteGap; JobModel.EnableInterSegment = vm.WhiteGap > 0; + JobModel.JobChanged = true; Job.SpoolType = vm.SelectedSpoolType; JobModel.SpoolType = vm.SelectedSpoolType;//update length!!!! @@ -830,6 +832,7 @@ namespace Tango.PPC.Jobs.ViewModels LogManager.Log("Adding new segment..."); UndoRedoManager.Instance.InsertAndExecuteCommand(new AddNewSegmentCommand(JobModel, segment, Settings.DefaultSegmentLength > 0 ? Settings.DefaultSegmentLength : 10)); + JobModel.JobChanged = true; ArrangeSegmentsIndixes(); } catch (Exception ex) @@ -852,6 +855,7 @@ namespace Tango.PPC.Jobs.ViewModels if (vm.DialogResult) { group.Repeats = vm.Repeats; + JobModel.JobChanged = true; } } @@ -867,6 +871,7 @@ namespace Tango.PPC.Jobs.ViewModels if (await NotificationProvider.ShowQuestion("Are you sure you want to remove the selected segment?")) { UndoRedoManager.Instance.InsertAndExecuteCommand(new RemoveSegmentCommand(JobModel, segment)); + JobModel.JobChanged = true; ArrangeSegmentsIndixes(); DyeCommand.RaiseCanExecuteChanged(); @@ -895,6 +900,7 @@ namespace Tango.PPC.Jobs.ViewModels UndoRedoManager.Instance.InsertAndExecuteCommand(new DeleteSegmentsGroupCommand(JobModel, segmentsGroup)); ArrangeSegmentsIndixes(); + JobModel.JobChanged = true; DyeCommand.RaiseCanExecuteChanged(); } @@ -917,6 +923,7 @@ namespace Tango.PPC.Jobs.ViewModels { UndoRedoManager.Instance.InsertAndExecuteCommand(new DuplicateSegmentCommand(JobModel, segment)); ArrangeSegmentsIndixes(); + JobModel.JobChanged = true; DyeCommand.RaiseCanExecuteChanged(); } @@ -990,6 +997,7 @@ namespace Tango.PPC.Jobs.ViewModels { UndoRedoManager.Instance.InsertAndExecuteCommand(new EditBrushStopColorCommand(segment, brushStop, vm.SelectedBrushStop)); DyeCommand.RaiseCanExecuteChanged(); + JobModel.JobChanged = true; } } @@ -1013,8 +1021,8 @@ namespace Tango.PPC.Jobs.ViewModels } } UndoRedoManager.Instance.InsertAndExecuteCommand(new AddBrushStopCommand(JobModel, segment, newBrushStop)); - ArrangeSegmentsIndixes(); + JobModel.JobChanged = true; } #endregion @@ -1206,6 +1214,7 @@ namespace Tango.PPC.Jobs.ViewModels UndoRedoManager.Instance.InsertAndExecuteCommand(new ReverseCommand(JobModel)); ArrangeSegmentsIndixes(); + JobModel.JobChanged = true; } private async void DeleteSegments() @@ -1227,6 +1236,7 @@ namespace Tango.PPC.Jobs.ViewModels UndoRedoManager.Instance.InsertAndExecuteCommand(new RemoveSegmentsCommand(JobModel)); ArrangeSegmentsIndixes(); + JobModel.JobChanged = true; DyeCommand.RaiseCanExecuteChanged(); } } @@ -1248,24 +1258,28 @@ namespace Tango.PPC.Jobs.ViewModels return; UndoRedoManager.Instance.InsertAndExecuteCommand(new RepeatCommand(JobModel)); ArrangeSegmentsIndixes(); + JobModel.JobChanged = true; } private void UngroupSegments(SegmentsGroupModel segmentsGroup) { UndoRedoManager.Instance.InsertAndExecuteCommand(new UnGroupSegmentsCommand(JobModel, segmentsGroup)); ArrangeSegmentsIndixes(); + JobModel.JobChanged = true; } private void Paste() { UndoRedoManager.Instance.InsertAndExecuteCommand(new PasteSegmentsCommand(JobModel)); ArrangeSegmentsIndixes(); + JobModel.JobChanged = true; } private void Copy() { UndoRedoManager.Instance.InsertAndExecuteCommand(new CopySegmentCommand(JobModel)); ArrangeSegmentsIndixes(); + JobModel.JobChanged = true; } private void Undo() @@ -1423,6 +1437,11 @@ namespace Tango.PPC.Jobs.ViewModels } Job.LastUpdated = DateTime.UtcNow; Job.IsSynchronized = false; + if(Job.JobStatus == JobStatuses.Completed && JobModel.JobChanged == true) + { + Job.JobStatus = BL.Enumerations.JobStatuses.Draft; + JobModel.JobChanged = false; + } //Job.JobStatus = BL.Enumerations.JobStatuses.Draft; //_current_job_string = Job.ToJobFileWhenLoaded().ToString(); RaiseMessage(new JobSavedMessage() { Job = Job }); diff --git a/Software/Visual_Studio/Tango.BL/Entities/Job.cs b/Software/Visual_Studio/Tango.BL/Entities/Job.cs index c5223b4db..de66cce57 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/Job.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/Job.cs @@ -157,7 +157,7 @@ namespace Tango.BL.Entities ObservableCollection<Segment> effectiveSegments = new ObservableCollection<Segment>(); - foreach( var s in segments) + foreach (var s in segments) { if (s is Segment) { @@ -251,7 +251,7 @@ namespace Tango.BL.Entities return Segments.OrderBy(x => x.SegmentIndex).ToObservableCollection(); } } - + /// <summary> /// Gets the ordered segments and groups /// </summary> @@ -263,12 +263,12 @@ namespace Tango.BL.Entities { if (Segments == null) return null; - List<ISegment> orderedSegmentsWithGroups = new List<ISegment>(); - + List<ISegment> orderedSegmentsWithGroups = new List<ISegment>(); + orderedSegmentsWithGroups.AddRange(Segments.Where(x => x.SegmentsGroupGuid == null)); orderedSegmentsWithGroups.AddRange(SegmentsGroups); return orderedSegmentsWithGroups.OrderBy(x => x.SegmentIndex).ToObservableCollection(); - // return Segments.OrderBy(x => x.SegmentIndex).ToObservableCollection(); + // return Segments.OrderBy(x => x.SegmentIndex).ToObservableCollection(); } } @@ -450,7 +450,7 @@ namespace Tango.BL.Entities segment.JobGuid = cloned.Guid; segment.Job = cloned; } - + return cloned; } @@ -475,14 +475,14 @@ namespace Tango.BL.Entities { SegmentsGroup segmentsGroup = s as SegmentsGroup; List<Segment> groupSegments = segmentsGroup.Segments.ToList(); - if(EnableInterSegment && IsAllSegmentsPerSpool) + if (EnableInterSegment && IsAllSegmentsPerSpool) { for (int repeats = 0; repeats < segmentsGroup.Repeats; repeats++) { for (int i = 0; i < groupSegments.Count; i++) { length += groupSegments[i].LengthWithFactor; - + if (EnableInterSegment && !(repeats == (segmentsGroup.Repeats - 1) && i == (groupSegments.Count - 1))) { length += InterSegmentLength; @@ -773,42 +773,60 @@ namespace Tango.BL.Entities jobFile.Type = job.Type; jobFile.WindingMethodGuid = job.WindingMethodGuid; jobFile.ColorCatalogGuid = job.ColorCatalogGuid.ToStringOrEmpty(); - - foreach (var segment in job.OrderedSegments) + + foreach (var segm in job.OrderedSegmentsWithGroups) { JobFileSegment s = new JobFileSegment(); - s.Length = segment.Length; - s.Name = segment.Name.ToStringOrEmpty(); + if (segm is SegmentsGroup group) + { + s.Repeats = group.Repeats; + foreach(var innerSegment in group.Segments) + { + JobFileSegment innerFileSegment = new JobFileSegment(); + innerFileSegment.Length = innerSegment.Length; + innerFileSegment.Name = innerSegment.Name.ToStringOrEmpty(); + FillFileSegmentStops(innerFileSegment, innerSegment, machine); + s.Segments.Add(innerFileSegment); + } + } + else if (segm is Segment segment) + { + s.Length = segment.Length; + s.Name = segment.Name.ToStringOrEmpty(); + FillFileSegmentStops(s, segment, machine); + } jobFile.Segments.Add(s); + } - foreach (var stop in segment.BrushStops.OrderBy(x => x.StopIndex)) - { - JobFileBrushStop st = new JobFileBrushStop(); - stop.MapPropertiesTo(st, MappingFlags.NoReferenceTypes | MappingFlags.NoNullStrings); - st.ColorCatalogItemGuid = stop.ColorCatalogsItemGuid.ToStringOrEmpty(); + return jobFile; + } - foreach (var idsPack in machine.Configuration.NoneEmptyIdsPacks) + private static void FillFileSegmentStops(JobFileSegment s, Segment segment, Machine machine) + { + foreach (var stop in segment.BrushStops.OrderBy(x => x.StopIndex)) + { + JobFileBrushStop st = new JobFileBrushStop(); + stop.MapPropertiesTo(st, MappingFlags.NoReferenceTypes | MappingFlags.NoNullStrings); + st.ColorCatalogItemGuid = stop.ColorCatalogsItemGuid.ToStringOrEmpty(); + + foreach (var idsPack in machine.Configuration.NoneEmptyIdsPacks) + { + try { - try - { - var volume = stop.GetVolume(idsPack.PackIndex); - st.LiquidVolumes.Add(new JobFileLiquidVolume() - { - LiquidTypeName = idsPack.LiquidType.Name, - Volume = volume, - }); - } - catch (Exception ex) + var volume = stop.GetVolume(idsPack.PackIndex); + st.LiquidVolumes.Add(new JobFileLiquidVolume() { - throw new InvalidOperationException($"Error extracting liquid volume from ids pack {idsPack.PackIndex}", ex); - } + LiquidTypeName = idsPack.LiquidType.Name, + Volume = volume, + }); } - - s.BrushStops.Add(st); + catch (Exception ex) + { + throw new InvalidOperationException($"Error extracting liquid volume from ids pack {idsPack.PackIndex}", ex); + } } + s.BrushStops.Add(st); } - - return jobFile; } public static Task<Job> FromJobFile(JobFile jobFile, String machineGuid, String userGuid) @@ -894,64 +912,94 @@ namespace Tango.BL.Entities for (int i = 0; i < jobFile.Segments.Count; i++) { var segment = jobFile.Segments[i]; - Segment s = new Segment(); - s.JobGuid = job.Guid; - s.Name = segment.Name.ToNullIfEmpty(); - s.Length = segment.Length; - s.SegmentIndex = i + 1; - job.Segments.Add(s); - for (int j = 0; j < segment.BrushStops.Count; j++) + if (segment.IsGroup()) { - var stop = segment.BrushStops[j]; - - var stop_color_space = db.ColorSpaces.SingleOrDefault(x => x.Guid == stop.ColorSpaceGuid); - if (stop_color_space == null) throw new ArgumentException("Could not load the specified job file. Job brush stop color space could not be located on database."); + SegmentsGroup group = new SegmentsGroup(); + group.JobGuid = job.Guid; + group.SegmentIndex = i + 1; + group.Repeats = segment.Repeats; + job.SegmentsGroups.Add(group); - BrushStop st = new BrushStop(); - st.StopIndex = j + 1; - st.SegmentGuid = s.Guid; - stop.MapPropertiesTo(st, MappingFlags.NoReferenceTypes | MappingFlags.NoNullStrings); - - foreach (var volume in stop.LiquidVolumes) + for (int innerSegmentIndex = 0; innerSegmentIndex < segment.Segments.Count; innerSegmentIndex++) { - var idsPack = machine.Configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Name == volume.LiquidTypeName); + var innerSegment = segment.Segments[innerSegmentIndex]; - if (idsPack == null) - { - throw new InvalidOperationException($"Liquid type '{volume.LiquidTypeName}' is not configured on the target machine."); - } + Segment s = new Segment(); + s.JobGuid = job.Guid; + s.Name = innerSegment.Name.ToNullIfEmpty(); + s.Length = innerSegment.Length; + s.SegmentIndex = innerSegmentIndex + 1; + group.Segments.Add(s); - st.SetVolume(idsPack.PackIndex, volume.Volume); + FillSegmentStops(innerSegment, s, db, machine); } + } + else + { + Segment s = new Segment(); + s.JobGuid = job.Guid; + s.Name = segment.Name.ToNullIfEmpty(); + s.Length = segment.Length; + s.SegmentIndex = i + 1; + job.Segments.Add(s); + FillSegmentStops(segment, s, db, machine); + } + } - if (!String.IsNullOrWhiteSpace(stop.ColorCatalogGuid)) - { - var stop_color_catalog = db.ColorCatalogs.SingleOrDefault(x => x.Guid == stop.ColorCatalogGuid); - if (stop_color_catalog == null) throw new ArgumentException("Could not load the specified job file. Job brush stop color catalog could not be located on database."); + return job; + } + }); + } - stop.ColorCatalogGuid = stop_color_catalog.Guid; - } + private static void FillSegmentStops(JobFileSegment segment, Segment s, ObservablesContext db, Machine machine) + { + for (int j = 0; j < segment.BrushStops.Count; j++) + { + var stop = segment.BrushStops[j]; - if (!String.IsNullOrWhiteSpace(stop.ColorCatalogItemGuid)) - { - var stop_color_catalog_item = db.ColorCatalogsItems.SingleOrDefault(x => x.Guid == stop.ColorCatalogItemGuid); - if (stop_color_catalog_item == null) throw new ArgumentException("Could not load the specified job file. Job brush stop catalog color could not be located on database."); + var stop_color_space = db.ColorSpaces.SingleOrDefault(x => x.Guid == stop.ColorSpaceGuid); + if (stop_color_space == null) throw new ArgumentException("Could not load the specified job file. Job brush stop color space could not be located on database."); - st.ColorCatalogsItemGuid = stop.ColorCatalogItemGuid; - } + BrushStop st = new BrushStop(); + st.StopIndex = stop.StopIndex; + st.SegmentGuid = s.Guid; + stop.MapPropertiesTo(st, MappingFlags.NoReferenceTypes | MappingFlags.NoNullStrings); + foreach (var volume in stop.LiquidVolumes) + { + var idsPack = machine.Configuration.NoneEmptyIdsPacks.SingleOrDefault(x => x.LiquidType.Name == volume.LiquidTypeName); - s.BrushStops.Add(st); - } + if (idsPack == null) + { + throw new InvalidOperationException($"Liquid type '{volume.LiquidTypeName}' is not configured on the target machine."); } - return job; + st.SetVolume(idsPack.PackIndex, volume.Volume); } - }); - } + + if (!String.IsNullOrWhiteSpace(stop.ColorCatalogGuid)) + { + var stop_color_catalog = db.ColorCatalogs.SingleOrDefault(x => x.Guid == stop.ColorCatalogGuid); + if (stop_color_catalog == null) throw new ArgumentException("Could not load the specified job file. Job brush stop color catalog could not be located on database."); + + stop.ColorCatalogGuid = stop_color_catalog.Guid; + } + + if (!String.IsNullOrWhiteSpace(stop.ColorCatalogItemGuid)) + { + var stop_color_catalog_item = db.ColorCatalogsItems.SingleOrDefault(x => x.Guid == stop.ColorCatalogItemGuid); + if (stop_color_catalog_item == null) throw new ArgumentException("Could not load the specified job file. Job brush stop catalog color could not be located on database."); + + st.ColorCatalogsItemGuid = stop.ColorCatalogItemGuid; + } + s.BrushStops.Add(st); + } + s.UpdateMiddleColorBrush(); + } + /// <summary> /// Removes this entity and all dependent entities from the specified db context. /// </summary> diff --git a/Software/Visual_Studio/Tango.BL/Entities/Segment.cs b/Software/Visual_Studio/Tango.BL/Entities/Segment.cs index c097bbc0e..630309397 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/Segment.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/Segment.cs @@ -253,6 +253,28 @@ namespace Tango.BL.Entities } } + public void UpdateMiddleColorBrush() + { + if (BrushStops.Count == 5) + { + BrushStops[2].Color = GetRelativeRGB(BrushStops[1].Color, BrushStops[3].Color, 0, 1, 0.5); + } + } + + public static Color GetRelativeRGB(Color first, Color second, double firstOffset, double secondOffset, double offset) + { + var color = new Color(); + var range = (secondOffset - firstOffset); + var realoffset = offset - firstOffset; + + color.ScA = (float)(realoffset * (second.ScA - first.ScA) / range + first.ScA); + color.ScR = (float)(realoffset * (second.ScR - first.ScR) / range + first.ScR); + color.ScG = (float)(realoffset * (second.ScG - first.ScG) / range + first.ScG); + color.ScB = (float)(realoffset * (second.ScB - first.ScB) / range + first.ScB); + + return color; + } + /// <summary> /// Raises the <see cref="SegmentBrush"/> property changed event. /// </summary> diff --git a/Software/Visual_Studio/Tango.PMR/Exports/JobFileBrushStop.cs b/Software/Visual_Studio/Tango.PMR/Exports/JobFileBrushStop.cs index 2b4d84ac6..308057cbb 100644 --- a/Software/Visual_Studio/Tango.PMR/Exports/JobFileBrushStop.cs +++ b/Software/Visual_Studio/Tango.PMR/Exports/JobFileBrushStop.cs @@ -23,7 +23,7 @@ namespace Tango.PMR.Exports { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "ChZKb2JGaWxlQnJ1c2hTdG9wLnByb3RvEhFUYW5nby5QTVIuRXhwb3J0cxoZ", - "Sm9iRmlsZUxpcXVpZFZvbHVtZS5wcm90byLrAgoQSm9iRmlsZUJydXNoU3Rv", + "Sm9iRmlsZUxpcXVpZFZvbHVtZS5wcm90byL+AgoQSm9iRmlsZUJydXNoU3Rv", "cBIWCg5Db2xvclNwYWNlR3VpZBgBIAEoCRIVCg1PZmZzZXRQZXJjZW50GAIg", "ASgBEgwKBEN5YW4YAyABKAESDwoHTWFnZW50YRgEIAEoARIOCgZZZWxsb3cY", "BSABKAESDQoFQmxhY2sYBiABKAESCwoDUmVkGAcgASgFEg0KBUdyZWVuGAgg", @@ -31,12 +31,12 @@ namespace Tango.PMR.Exports { "DCABKAESPQoNTGlxdWlkVm9sdW1lcxgYIAMoCzImLlRhbmdvLlBNUi5FeHBv", "cnRzLkpvYkZpbGVMaXF1aWRWb2x1bWUSEQoJQ29ycmVjdGVkGBUgASgIEhgK", "EENvbG9yQ2F0YWxvZ0d1aWQYFiABKAkSHAoUQ29sb3JDYXRhbG9nSXRlbUd1", - "aWQYFyABKAkSFQoNSXNUcmFuc3BhcmVudBgZIAEoCEIdChtjb20udHdpbmUu", - "dGFuZ28ucG1yLmV4cG9ydHNiBnByb3RvMw==")); + "aWQYFyABKAkSFQoNSXNUcmFuc3BhcmVudBgZIAEoCBIRCglTdG9wSW5kZXgY", + "GiABKAVCHQobY29tLnR3aW5lLnRhbmdvLnBtci5leHBvcnRzYgZwcm90bzM=")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Tango.PMR.Exports.JobFileLiquidVolumeReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Exports.JobFileBrushStop), global::Tango.PMR.Exports.JobFileBrushStop.Parser, new[]{ "ColorSpaceGuid", "OffsetPercent", "Cyan", "Magenta", "Yellow", "Black", "Red", "Green", "Blue", "L", "A", "B", "LiquidVolumes", "Corrected", "ColorCatalogGuid", "ColorCatalogItemGuid", "IsTransparent" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Exports.JobFileBrushStop), global::Tango.PMR.Exports.JobFileBrushStop.Parser, new[]{ "ColorSpaceGuid", "OffsetPercent", "Cyan", "Magenta", "Yellow", "Black", "Red", "Green", "Blue", "L", "A", "B", "LiquidVolumes", "Corrected", "ColorCatalogGuid", "ColorCatalogItemGuid", "IsTransparent", "StopIndex" }, null, null, null) })); } #endregion @@ -84,6 +84,7 @@ namespace Tango.PMR.Exports { colorCatalogGuid_ = other.colorCatalogGuid_; colorCatalogItemGuid_ = other.colorCatalogItemGuid_; isTransparent_ = other.isTransparent_; + stopIndex_ = other.stopIndex_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -277,6 +278,17 @@ namespace Tango.PMR.Exports { } } + /// <summary>Field number for the "StopIndex" field.</summary> + public const int StopIndexFieldNumber = 26; + private int stopIndex_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int StopIndex { + get { return stopIndex_; } + set { + stopIndex_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as JobFileBrushStop); @@ -307,6 +319,7 @@ namespace Tango.PMR.Exports { if (ColorCatalogGuid != other.ColorCatalogGuid) return false; if (ColorCatalogItemGuid != other.ColorCatalogItemGuid) return false; if (IsTransparent != other.IsTransparent) return false; + if (StopIndex != other.StopIndex) return false; return true; } @@ -330,6 +343,7 @@ namespace Tango.PMR.Exports { if (ColorCatalogGuid.Length != 0) hash ^= ColorCatalogGuid.GetHashCode(); if (ColorCatalogItemGuid.Length != 0) hash ^= ColorCatalogItemGuid.GetHashCode(); if (IsTransparent != false) hash ^= IsTransparent.GetHashCode(); + if (StopIndex != 0) hash ^= StopIndex.GetHashCode(); return hash; } @@ -405,6 +419,10 @@ namespace Tango.PMR.Exports { output.WriteRawTag(200, 1); output.WriteBool(IsTransparent); } + if (StopIndex != 0) { + output.WriteRawTag(208, 1); + output.WriteInt32(StopIndex); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -459,6 +477,9 @@ namespace Tango.PMR.Exports { if (IsTransparent != false) { size += 2 + 1; } + if (StopIndex != 0) { + size += 2 + pb::CodedOutputStream.ComputeInt32Size(StopIndex); + } return size; } @@ -516,6 +537,9 @@ namespace Tango.PMR.Exports { if (other.IsTransparent != false) { IsTransparent = other.IsTransparent; } + if (other.StopIndex != 0) { + StopIndex = other.StopIndex; + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -594,6 +618,10 @@ namespace Tango.PMR.Exports { IsTransparent = input.ReadBool(); break; } + case 208: { + StopIndex = input.ReadInt32(); + break; + } } } } diff --git a/Software/Visual_Studio/Tango.PMR/Exports/JobFileSegment.cs b/Software/Visual_Studio/Tango.PMR/Exports/JobFileSegment.cs index 0f01474a4..67a0660c1 100644 --- a/Software/Visual_Studio/Tango.PMR/Exports/JobFileSegment.cs +++ b/Software/Visual_Studio/Tango.PMR/Exports/JobFileSegment.cs @@ -23,14 +23,16 @@ namespace Tango.PMR.Exports { byte[] descriptorData = global::System.Convert.FromBase64String( string.Concat( "ChRKb2JGaWxlU2VnbWVudC5wcm90bxIRVGFuZ28uUE1SLkV4cG9ydHMaFkpv", - "YkZpbGVCcnVzaFN0b3AucHJvdG8iZwoOSm9iRmlsZVNlZ21lbnQSDAoETmFt", - "ZRgBIAEoCRIOCgZMZW5ndGgYAiABKAESNwoKQnJ1c2hTdG9wcxgDIAMoCzIj", - "LlRhbmdvLlBNUi5FeHBvcnRzLkpvYkZpbGVCcnVzaFN0b3BCHQobY29tLnR3", - "aW5lLnRhbmdvLnBtci5leHBvcnRzYgZwcm90bzM=")); + "YkZpbGVCcnVzaFN0b3AucHJvdG8irQEKDkpvYkZpbGVTZWdtZW50EgwKBE5h", + "bWUYASABKAkSDgoGTGVuZ3RoGAIgASgBEjcKCkJydXNoU3RvcHMYAyADKAsy", + "Iy5UYW5nby5QTVIuRXhwb3J0cy5Kb2JGaWxlQnJ1c2hTdG9wEjMKCFNlZ21l", + "bnRzGAQgAygLMiEuVGFuZ28uUE1SLkV4cG9ydHMuSm9iRmlsZVNlZ21lbnQS", + "DwoHUmVwZWF0cxgFIAEoBUIdChtjb20udHdpbmUudGFuZ28ucG1yLmV4cG9y", + "dHNiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Tango.PMR.Exports.JobFileBrushStopReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, new pbr::GeneratedClrTypeInfo[] { - new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Exports.JobFileSegment), global::Tango.PMR.Exports.JobFileSegment.Parser, new[]{ "Name", "Length", "BrushStops" }, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Tango.PMR.Exports.JobFileSegment), global::Tango.PMR.Exports.JobFileSegment.Parser, new[]{ "Name", "Length", "BrushStops", "Segments", "Repeats" }, null, null, null) })); } #endregion @@ -64,6 +66,8 @@ namespace Tango.PMR.Exports { name_ = other.name_; length_ = other.length_; brushStops_ = other.brushStops_.Clone(); + segments_ = other.segments_.Clone(); + repeats_ = other.repeats_; } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -103,6 +107,27 @@ namespace Tango.PMR.Exports { get { return brushStops_; } } + /// <summary>Field number for the "Segments" field.</summary> + public const int SegmentsFieldNumber = 4; + private static readonly pb::FieldCodec<global::Tango.PMR.Exports.JobFileSegment> _repeated_segments_codec + = pb::FieldCodec.ForMessage(34, global::Tango.PMR.Exports.JobFileSegment.Parser); + private readonly pbc::RepeatedField<global::Tango.PMR.Exports.JobFileSegment> segments_ = new pbc::RepeatedField<global::Tango.PMR.Exports.JobFileSegment>(); + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public pbc::RepeatedField<global::Tango.PMR.Exports.JobFileSegment> Segments { + get { return segments_; } + } + + /// <summary>Field number for the "Repeats" field.</summary> + public const int RepeatsFieldNumber = 5; + private int repeats_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + public int Repeats { + get { return repeats_; } + set { + repeats_ = value; + } + } + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] public override bool Equals(object other) { return Equals(other as JobFileSegment); @@ -119,6 +144,8 @@ namespace Tango.PMR.Exports { if (Name != other.Name) return false; if (Length != other.Length) return false; if(!brushStops_.Equals(other.brushStops_)) return false; + if(!segments_.Equals(other.segments_)) return false; + if (Repeats != other.Repeats) return false; return true; } @@ -128,6 +155,8 @@ namespace Tango.PMR.Exports { if (Name.Length != 0) hash ^= Name.GetHashCode(); if (Length != 0D) hash ^= Length.GetHashCode(); hash ^= brushStops_.GetHashCode(); + hash ^= segments_.GetHashCode(); + if (Repeats != 0) hash ^= Repeats.GetHashCode(); return hash; } @@ -147,6 +176,11 @@ namespace Tango.PMR.Exports { output.WriteDouble(Length); } brushStops_.WriteTo(output, _repeated_brushStops_codec); + segments_.WriteTo(output, _repeated_segments_codec); + if (Repeats != 0) { + output.WriteRawTag(40); + output.WriteInt32(Repeats); + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -159,6 +193,10 @@ namespace Tango.PMR.Exports { size += 1 + 8; } size += brushStops_.CalculateSize(_repeated_brushStops_codec); + size += segments_.CalculateSize(_repeated_segments_codec); + if (Repeats != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Repeats); + } return size; } @@ -174,6 +212,10 @@ namespace Tango.PMR.Exports { Length = other.Length; } brushStops_.Add(other.brushStops_); + segments_.Add(other.segments_); + if (other.Repeats != 0) { + Repeats = other.Repeats; + } } [global::System.Diagnostics.DebuggerNonUserCodeAttribute] @@ -196,6 +238,14 @@ namespace Tango.PMR.Exports { brushStops_.AddEntriesFrom(input, _repeated_brushStops_codec); break; } + case 34: { + segments_.AddEntriesFrom(input, _repeated_segments_codec); + break; + } + case 40: { + Repeats = input.ReadInt32(); + break; + } } } } diff --git a/Software/Visual_Studio/Tango.PMR/ExtensionMethods.cs b/Software/Visual_Studio/Tango.PMR/ExtensionMethods.cs index be0912220..d6fdee50c 100644 --- a/Software/Visual_Studio/Tango.PMR/ExtensionMethods.cs +++ b/Software/Visual_Studio/Tango.PMR/ExtensionMethods.cs @@ -104,4 +104,16 @@ public static class ExtensionMethods return response.Type; } } + + /// <summary> + /// Determines whether this segment is a group. + /// </summary> + /// <param name="segment">The segment.</param> + /// <returns> + /// <c>true</c> if the specified segment is group; otherwise, <c>false</c>. + /// </returns> + public static bool IsGroup(this Tango.PMR.Exports.JobFileSegment segment) + { + return segment.Segments != null && segment.Segments.Count > 0; + } } diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericUpDownConrol.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericUpDownConrol.xaml index a47d890b7..31c32be83 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericUpDownConrol.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNumericUpDownConrol.xaml @@ -22,6 +22,7 @@ <Style TargetType="local:TouchNumericUpDownConrol"> <Setter Property="Background" Value="{StaticResource TangoNotificationBarMaskBrush}"/> <Setter Property="Height" Value="32"/> + <Setter Property="Focusable" Value="False"></Setter> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="local:TouchNumericUpDownConrol"> @@ -86,14 +87,14 @@ </Border> <Border Margin="10 0 0 0" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0.8" Width="80"> <StackPanel Orientation="Horizontal"> - <RepeatButton Background="Transparent" Margin="8 0 8 0" Padding="2" Style="{StaticResource emptyButton}" + <RepeatButton Focusable="False" Background="Transparent" Margin="8 0 8 0" Padding="2" Style="{StaticResource emptyButton}" Command="{Binding Path=DecrementCommand,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:TouchNumericUpDownConrol}, Mode=TwoWay}"> - <local:TouchIcon Icon="Minus" Width="16" Height="3"/> + <local:TouchIcon Focusable="False" Icon="Minus" Width="16" Height="3"/> </RepeatButton> <Rectangle Margin="1 0 0 0" Width="0.8" Fill="{StaticResource TangoGrayBrush}"></Rectangle> - <RepeatButton Background="Transparent" Margin="8 0 0 0" Padding="4" Style="{StaticResource emptyButton}" + <RepeatButton Focusable="False" Background="Transparent" Margin="8 0 0 0" Padding="4" Style="{StaticResource emptyButton}" Command="{Binding Path=IncrementCommand,RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=local:TouchNumericUpDownConrol}, Mode=TwoWay}"> - <local:TouchIcon Icon="Plus" Width="16"/> + <local:TouchIcon Focusable="False" Icon="Plus" Width="16"/> </RepeatButton> </StackPanel> </Border> diff --git a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/MultiRangeSlider.cs b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/MultiRangeSlider.cs index b0b7167ee..4ee029bbb 100644 --- a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/MultiRangeSlider.cs +++ b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/MultiRangeSlider.cs @@ -216,10 +216,10 @@ namespace Tango.Touch.Controls args.RoutedEvent = MultiRangeSlider.MultiRangeSliderValueChangedEvent; RaiseEvent(args); } - else - { - Value = oldValue; - } + //else + //{ + // Value = oldValue; + //} m_isBlocked = false; diff --git a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerCMYKControl.xaml b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerCMYKControl.xaml index cfd5a3cc2..5821680de 100644 --- a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerCMYKControl.xaml +++ b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerCMYKControl.xaml @@ -1,5 +1,6 @@ <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:keyboard="clr-namespace:Tango.Touch.Keyboard" xmlns:local="clr-namespace:Tango.Touch.Controls"> <ResourceDictionary.MergedDictionaries> @@ -8,10 +9,13 @@ <Style TargetType="{x:Type local:TouchColorPickerCMYKControl}"> <Setter Property="Background" Value="Transparent"/> + <Setter Property="keyboard:KeyboardView.Mode" Value="{Binding RelativeSource={RelativeSource Self},Path=KeyboardMode}"></Setter> + <Setter Property="keyboard:KeyboardView.Action" Value="{Binding RelativeSource={RelativeSource Self},Path=KeyboardAction}"></Setter> + <Setter Property="keyboard:KeyboardView.Container" Value="{Binding RelativeSource={RelativeSource Self},Path=KeyboardContainer}"></Setter> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type local:TouchColorPickerCMYKControl}"> - <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True" CornerRadius="16" Padding="0"> + <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True" CornerRadius="16" Padding="0" keyboard:KeyboardView.Container="{TemplateBinding local:TouchInput.KeyboardContainer}"> <UniformGrid Margin="0" Columns="1" Rows="4"> <local:TouchColorPickerControl x:Name="PART_CTouchColorPickerControl" Grid.Row="0" Margin=" 0 10 0 0" HorizontalAlignment="Stretch" BorderBrush="{TemplateBinding BorderBrush}" MinWidth="160" VerticalAlignment="Bottom" MinValue="0" ThumbHeight="{Binding ThumbHeight, RelativeSource={RelativeSource AncestorType=local:TouchColorPickerCMYKControl}}" diff --git a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.xaml b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.xaml index 906e181c8..92cc2be65 100644 --- a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.xaml +++ b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerControl.xaml @@ -8,6 +8,7 @@ <Style TargetType="{x:Type local:TouchColorPickerControl}" > <Setter Property="Background" Value="Transparent"/> + <Setter Property="Focusable" Value="False"></Setter> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type local:TouchColorPickerControl}"> @@ -29,6 +30,7 @@ ThumbHeight="{Binding RelativeSource={RelativeSource AncestorType=local:TouchColorPickerControl}, Path=ThumbHeight}" ThumbColor="{Binding ThumbColor, RelativeSource={RelativeSource AncestorType=local:TouchColorPickerControl}}" SelectedColor="{Binding SelectedColor, RelativeSource={RelativeSource AncestorType=local:TouchColorPickerControl}}" + Focusable="False" 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"/> diff --git a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerHSBControl.xaml b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerHSBControl.xaml index bd596a7c7..367113ad5 100644 --- a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerHSBControl.xaml +++ b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerHSBControl.xaml @@ -1,5 +1,6 @@ <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:keyboard="clr-namespace:Tango.Touch.Keyboard" xmlns:local="clr-namespace:Tango.Touch.Controls"> @@ -9,10 +10,13 @@ <Style TargetType="{x:Type local:TouchColorPickerHSBControl}"> <Setter Property="Background" Value="Transparent"/> + <Setter Property="keyboard:KeyboardView.Mode" Value="{Binding RelativeSource={RelativeSource Self},Path=KeyboardMode}"></Setter> + <Setter Property="keyboard:KeyboardView.Action" Value="{Binding RelativeSource={RelativeSource Self},Path=KeyboardAction}"></Setter> + <Setter Property="keyboard:KeyboardView.Container" Value="{Binding RelativeSource={RelativeSource Self},Path=KeyboardContainer}"></Setter> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type local:TouchColorPickerHSBControl}"> - <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True" CornerRadius="16" Padding="0"> + <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True" CornerRadius="16" Padding="0" keyboard:KeyboardView.Container="{TemplateBinding local:TouchInput.KeyboardContainer}"> <UniformGrid Margin="0" Columns="1" Rows="3"> <local:TouchColorPickerControl x:Name="PART_HColorPickerControl" Grid.Row="0" Margin=" 0 10 0 0" HorizontalAlignment="Stretch" BorderBrush="{TemplateBinding BorderBrush}" MinWidth="160" VerticalAlignment="Bottom" MinValue="0" MaxValue="360" ThumbHeight="{Binding ThumbHeight, RelativeSource={RelativeSource AncestorType=local:TouchColorPickerHSBControl}}" diff --git a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerLABControl.xaml b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerLABControl.xaml index b39796540..8d64bd281 100644 --- a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerLABControl.xaml +++ b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerLABControl.xaml @@ -1,5 +1,6 @@ <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:keyboard="clr-namespace:Tango.Touch.Keyboard" xmlns:local="clr-namespace:Tango.Touch.Controls"> @@ -9,10 +10,13 @@ <Style TargetType="{x:Type local:TouchColorPickerLABControl}"> <Setter Property="Background" Value="Transparent"/> + <Setter Property="keyboard:KeyboardView.Mode" Value="{Binding RelativeSource={RelativeSource Self},Path=KeyboardMode}"></Setter> + <Setter Property="keyboard:KeyboardView.Action" Value="{Binding RelativeSource={RelativeSource Self},Path=KeyboardAction}"></Setter> + <Setter Property="keyboard:KeyboardView.Container" Value="{Binding RelativeSource={RelativeSource Self},Path=KeyboardContainer}"></Setter> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type local:TouchColorPickerLABControl}"> - <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True" CornerRadius="16" Padding="0"> + <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True" CornerRadius="16" Padding="0" keyboard:KeyboardView.Container="{TemplateBinding local:TouchInput.KeyboardContainer}"> <UniformGrid Margin="0" Columns="1" Rows="3"> <local:TouchColorPickerControl x:Name="PART_LTouchColorPickerControl" Grid.Row="0" Margin=" 0 10 0 0" HorizontalAlignment="Stretch" BorderBrush="{TemplateBinding BorderBrush}" MinWidth="160" VerticalAlignment="Bottom" MinValue="0" MaxValue="360" ThumbHeight="{Binding ThumbHeight, RelativeSource={RelativeSource AncestorType=local:TouchColorPickerLABControl}}" diff --git a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerRGBControl.xaml b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerRGBControl.xaml index 4940e38fd..5f6ba75b7 100644 --- a/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerRGBControl.xaml +++ b/Software/Visual_Studio/Tango.Touch/TouchColorPickerControls/TouchColorPickerRGBControl.xaml @@ -1,16 +1,23 @@ <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:keyboard="clr-namespace:Tango.Touch.Keyboard" xmlns:local="clr-namespace:Tango.Touch.Controls"> + + <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="../Resources/Colors.xaml" /> </ResourceDictionary.MergedDictionaries> <Style TargetType="{x:Type local:TouchColorPickerRGBControl}"> <Setter Property="Background" Value="Transparent"/> + <Setter Property="keyboard:KeyboardView.Mode" Value="{Binding RelativeSource={RelativeSource Self},Path=KeyboardMode}"></Setter> + <Setter Property="keyboard:KeyboardView.Action" Value="{Binding RelativeSource={RelativeSource Self},Path=KeyboardAction}"></Setter> + <Setter Property="keyboard:KeyboardView.Container" Value="{Binding RelativeSource={RelativeSource Self},Path=KeyboardContainer}"></Setter> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type local:TouchColorPickerRGBControl}"> - <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True" CornerRadius="16" Padding="0"> + <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True" CornerRadius="16" Padding="0" + keyboard:KeyboardView.Container="{TemplateBinding local:TouchInput.KeyboardContainer}"> <UniformGrid Margin="0" Columns="1" Rows="3"> <local:TouchColorPickerControl x:Name="PART_RTouchColorPickerControl" Grid.Row="0" Margin=" 0 10 0 0" HorizontalAlignment="Stretch" BorderBrush="{TemplateBinding BorderBrush}" VerticalAlignment="Stretch" MinValue="0" MaxValue="255" ThumbHeight="{Binding ThumbHeight, RelativeSource={RelativeSource AncestorType=local:TouchColorPickerRGBControl}}" |
