diff options
| author | Roy <Roy.mail.net@gmail.com> | 2023-10-22 16:43:49 +0300 |
|---|---|---|
| committer | Roy <Roy.mail.net@gmail.com> | 2023-10-22 16:43:49 +0300 |
| commit | 4cebc14d3183ee4dc4ade0f85d9bf72cec44533c (patch) | |
| tree | b940003b7572fa616fd385ef5c5be00b06f5c01b /Software/Visual_Studio/PPC/Modules | |
| parent | f35fea4ffd1219e844f94a0b72c12cc91af2c94e (diff) | |
| parent | 648437dec6e56e32218d88b7a85e70ac00b6e98a (diff) | |
| download | Tango-4cebc14d3183ee4dc4ade0f85d9bf72cec44533c.tar.gz Tango-4cebc14d3183ee4dc4ade0f85d9bf72cec44533c.zip | |
Merge branch 'software' of https://twinetfs.visualstudio.com/Tango/_git/Tango into software
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules')
14 files changed, 349 insertions, 74 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml index e737a8f7a..c60fed143 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Dialogs/ColorSelectionView.xaml @@ -51,7 +51,7 @@ <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}"> <touch:TouchScrollViewer CanContentScroll="True" Padding="{TemplateBinding Padding}" Focusable="False" Style="{StaticResource TouchVerticalScrollViewer}"> - <ItemsPresenter /> + <ItemsPresenter HorizontalAlignment="Stretch"/> </touch:TouchScrollViewer> </Border> </ControlTemplate> @@ -170,7 +170,7 @@ </Grid> <Canvas Grid.Column="1" Width="28" Height="28" VerticalAlignment="Top" HorizontalAlignment="Left"> - <touch:TouchToggleButton Canvas.Left="0" Canvas.Top="0" x:Name="addColorToGroup" EnableDropShadow="False" Foreground="{StaticResource TangoKeyboardKeyDarkTextBrush}" Background="Transparent" BorderThickness="0" Command="{Binding SaveMyColorsCommand}" > + <touch:TouchToggleButton Canvas.Left="0" Canvas.Top="0" x:Name="addColorToGroup" EnableDropShadow="False" Foreground="{StaticResource TangoKeyboardKeyDarkTextBrush}" Background="Transparent" BorderThickness="0" Command="{Binding OpenCloseAddMyColorDialogCommand}" > <touch:TouchToggleButton.Style> <Style TargetType="touch:TouchToggleButton" BasedOn="{StaticResource TangoTouchToggleButtonNoDisable}"> <Setter Property="IsEnabled" Value="True"/> @@ -376,18 +376,31 @@ <touch:TouchTextBox Width="220" Height="40" FontSize="{StaticResource TangoButtonFontSize}" Margin=" 20 0 10 0" Text="{Binding MyColorName}" FocusSelectionMode="SelectAll"></touch:TouchTextBox> </StackPanel> <Grid Margin="14 10 14 10" > - <ListBox HorizontalAlignment="Stretch" MaxHeight="220" ItemsSource="{Binding Libraries}" Style="{StaticResource ListBoxVerticalScroll}" - ScrollViewer.VerticalScrollBarVisibility="Visible" > + <ListBox HorizontalAlignment="Stretch" MaxHeight="220" ItemsSource="{Binding Libraries}" Style="{StaticResource ListBoxVerticalScroll}" SelectedItem="{Binding SelectedColorLibraryMyColor}" + ScrollViewer.VerticalScrollBarVisibility="Visible" HorizontalContentAlignment="Stretch" ScrollViewer.HorizontalScrollBarVisibility="Disabled"> <ListBox.ItemsPanel> <ItemsPanelTemplate> - <WrapPanel Orientation="Vertical" /> + <UniformGrid Columns="1" VerticalAlignment="Top" /> </ItemsPanelTemplate> </ListBox.ItemsPanel> <ListBox.ItemTemplate> <DataTemplate DataType="{x:Type models:ColorLibrary}"> - <touch:TouchButton Command="{Binding DataContext.AddColorToLibraryCommand, ElementName=colorSelectionView}" Style="{StaticResource TangoFlatButton}" CommandParameter="{Binding }" Background="Transparent"> - <TextBlock Text="{Binding Name}" FontSize="{StaticResource TangoButtonFontSize}"></TextBlock> - </touch:TouchButton> + <Grid HorizontalAlignment="Stretch" > + <Grid.Style > + <Style TargetType="Grid"> + <Setter Property="Background" Value="Transparent"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsSelected}" Value="True"> + <Setter Property="Background" Value="{StaticResource TangoLightSelectedBrush}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> + + <touch:TouchButton Command="{Binding DataContext.SelectLibraryCommand, ElementName=colorSelectionView}" Style="{StaticResource TangoFlatButton}" CommandParameter="{Binding }" Background="Transparent"> + <TextBlock Text="{Binding Name}" FontSize="{StaticResource TangoButtonFontSize}"></TextBlock> + </touch:TouchButton> + </Grid> </DataTemplate> </ListBox.ItemTemplate> </ListBox> @@ -678,25 +691,25 @@ <Grid.Background> <SolidColorBrush Color="{StaticResource TangoDisabledBackgroundColor}" Opacity="0.65" /> </Grid.Background> - <Border Margin="72 20 69 325" CornerRadius="20" Background="{StaticResource TangoPrimaryBackgroundBrush}"> + <Border Margin="72 30 69 290" CornerRadius="20" Background="{StaticResource TangoPrimaryBackgroundBrush}"> <Border.Effect> <DropShadowEffect Opacity="0.5" ShadowDepth="6" Color="Silver" BlurRadius="10" Direction="270"/> </Border.Effect> <Border CornerRadius="20" Background="{StaticResource TangoPrimaryBackgroundBrush}"> <Grid> <DockPanel > - <Grid DockPanel.Dock="Bottom" Height="137"> - <Rectangle Height="1" Stroke="{StaticResource TangoDividerBrush}" HorizontalAlignment="Stretch"/> - <Grid Margin="48 30 0 0" > + <Grid DockPanel.Dock="Bottom" Height="136"> + <Rectangle Height="3" Stroke="{StaticResource TangoDividerBrush}" HorizontalAlignment="Stretch" VerticalAlignment="Top" Margin="0 10 0 0"/> + <Grid Margin="48 10 0 0" > <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="1*"/> </Grid.ColumnDefinitions> - <touch:TouchImageButton HorizontalAlignment="Left" Width="28" Height="38" Margin="0 20 23 0" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{ Binding AddGroupCommand}" Image="{StaticResource Add_group_mycolors}"/> - <TextBlock Grid.Column="1" Margin="20 20 0 0" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="{StaticResource TangoButtonFontSize}" FontWeight="SemiBold" Visibility="{Binding AddGroupMode, Converter={StaticResource BooleanToVisibilityInverseConverter}}">Add Group</TextBlock> + <touch:TouchImageButton HorizontalAlignment="Left" Width="28" Height="38" Margin="0 0 23 0" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{ Binding AddGroupCommand}" Image="{StaticResource Add_group_mycolors}"/> + <TextBlock Grid.Column="1" Margin="20 0 0 0" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="{StaticResource TangoButtonFontSize}" FontWeight="SemiBold" Visibility="{Binding AddGroupMode, Converter={StaticResource BooleanToVisibilityInverseConverter}}">Add Group</TextBlock> <DockPanel Visibility="{Binding AddGroupMode, Converter={StaticResource BooleanToVisibilityConverter}}" Grid.Column="1" Margin=" 20 0 0 20"> - <touch:TouchTextBox DockPanel.Dock="Left" Margin="0 0 80 0" x:Name="newGroupNametext" MinWidth="200" Height="Auto" Text="{Binding NewGroupName, Mode=TwoWay,UpdateSourceTrigger=LostFocus}"></touch:TouchTextBox> - <touch:TouchButton DockPanel.Dock="Right" Width="160" Height="40" CornerRadius="20" Background="Transparent" EnableDropShadow="False" TextElement.Foreground="{StaticResource TangoKeyboardKeyDarkTextBrush}" HorizontalAlignment="Right" Margin="10 26 20 0" VerticalAlignment="Bottom" + <touch:TouchTextBox DockPanel.Dock="Left" Margin="0 0 80 0" x:Name="newGroupNametext" MinWidth="350" Height="Auto" Text="{Binding NewGroupName, Mode=TwoWay,UpdateSourceTrigger=LostFocus}" VerticalAlignment="Center"></touch:TouchTextBox> + <touch:TouchButton DockPanel.Dock="Right" Width="160" Height="40" CornerRadius="20" Background="Transparent" EnableDropShadow="False" TextElement.Foreground="{StaticResource TangoKeyboardKeyDarkTextBrush}" HorizontalAlignment="Right" Margin="10 20 20 0" VerticalAlignment="Center" BorderThickness="1" BorderBrush="{StaticResource TangoKeyboardKeyDarkBrush}" Command="{Binding AddNewGroupCommand}" CommandParameter="{Binding ElementName=newGroupNametext, Path=Text}">Add</touch:TouchButton> </DockPanel> @@ -707,25 +720,30 @@ <TextBlock DockPanel.Dock="Left" Margin="43 53 0 28" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="{StaticResource TangoHeaderFontSize}" FontWeight="SemiBold">My Colors</TextBlock> <touch:TouchImageButton DockPanel.Dock="Top" Width="32" Height="32" Image="{StaticResource Close_mycolorsdlg}" HorizontalAlignment="Right" Margin="0 20 23 0" EnableDropShadow="False" Background="Transparent" BorderThickness="0" Command="{Binding CloseMyColorsCommand}"/> </DockPanel> - <StackPanel Orientation="Vertical" Margin="0"> - <DockPanel> + <StackPanel Orientation="Vertical" Margin="0 20 0 0"> + <DockPanel VerticalAlignment="Top"> <touch:TouchButton DockPanel.Dock="Right" Height="48" Command="{Binding DataContext.EditColorsLibrariesCommand, ElementName=colorSelectionView}" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0 0 30 10" Background="Transparent" ShadowDepth="0" ShadowColor="Transparent"> - <StackPanel Height="48" Width="160" Orientation="Horizontal"> - <touch:TouchIcon Margin="0 7 0 0" VerticalAlignment="Center" Foreground="{StaticResource TangoBlackInkBrush}" Height="16.5" Icon="PencilAltSolid" /> - <TextBlock Text="{Binding EditColorButtonName, Mode=TwoWay, TargetNullValue=EDIT}" Height="30" Margin="25 10 0 0" FontSize="{StaticResource TangoButtonFontSize}" FontWeight="SemiBold" VerticalAlignment="Center" Foreground="{StaticResource TangoBlackInkBrush}" ></TextBlock> + <StackPanel Height="48" Width="160" Orientation="Horizontal" > + <touch:TouchIcon Margin="0 9 0 0" Foreground="{StaticResource TangoBlackInkBrush}" Height="25" Icon="PencilAltSolid" /> + <TextBlock Text="{Binding EditColorButtonName, Mode=TwoWay, TargetNullValue=EDIT}" Height="30" Margin="25 12 0 0" FontSize="{StaticResource TangoButtonFontSize}" FontWeight="SemiBold" VerticalAlignment="Bottom" Foreground="{StaticResource TangoBlackInkBrush}" ></TextBlock> </StackPanel> </touch:TouchButton> - <Grid DockPanel.Dock="Left" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="60 0 0 0" Width="280"> + <Grid DockPanel.Dock="Left" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="60 0 0 0" Width="280" Height="48"> <DockPanel> <Image DockPanel.Dock="Left" HorizontalAlignment="Left" VerticalAlignment="Bottom" Width="40" Height="40" Source="{StaticResource SearchImage}"/> <!--<touch:TouchIcon DockPanel.Dock="Left" Foreground="{StaticResource TangoGrayBrush}" Width="20" Height="20" VerticalAlignment="Bottom" Icon="Magnify" />--> - <touch:TouchTextBox Margin="5 0 0 0" Width="300" Text="{Binding SearchColorText,Mode=TwoWay, UpdateSourceTrigger=LostFocus}" ></touch:TouchTextBox> + <touch:TouchTextBox Margin="15 0 0 0" Width="300" Text="{Binding SearchColorText,Mode=TwoWay, UpdateSourceTrigger=LostFocus}" VerticalAlignment="Center" ></touch:TouchTextBox> </DockPanel> </Grid> </DockPanel> - <ListBox x:Name="listLibraries" Grid.Row="1" Margin="10 0 10 60" ItemsSource="{Binding Libraries}" Style="{StaticResource ListBoxVerticalScroll}" + <ListBox x:Name="listLibraries" Margin="10 16 10 10" ItemsSource="{Binding Libraries}" Style="{StaticResource ListBoxVerticalScroll}" ScrollViewer.VerticalScrollBarVisibility="Visible" Width="560" ItemTemplate="{StaticResource ColorLibrary_Template}" Height="580"> </ListBox> + + <StackPanel Height="38" Width="160" Orientation="Horizontal" HorizontalAlignment="Left" Margin=" 50 20 20 0" VerticalAlignment="Bottom"> + <touch:TouchIconButton Margin="0 7 0 10" VerticalAlignment="Bottom" Foreground="{StaticResource TangoBlackInkBrush}" Width="26" Icon="Upload" Command="{Binding UploadFileCommand}"/> + <touch:TouchIconButton Margin="30 7 0 10" VerticalAlignment="Bottom" Foreground="{StaticResource TangoBlackInkBrush}" Width="26" Icon="Download" Command="{Binding DownloadFileCommand}"/> + </StackPanel> </StackPanel> </DockPanel> </Grid> 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 3146da179..cc8ddc84e 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 @@ -1,9 +1,11 @@ using ColorMine.ColorSpaces; +using Microsoft.Win32; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Collections.Specialized; using System.ComponentModel; +using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -323,6 +325,24 @@ namespace Tango.PPC.Jobs.Dialogs private ColorLibrary SelectedColorLibrary { get; set; } + private ColorLibrary _selectedColorLibraryMyColor; + + public ColorLibrary SelectedColorLibraryMyColor + { + get { return _selectedColorLibraryMyColor; } + set { + if(_selectedColorLibraryMyColor != null) + _selectedColorLibraryMyColor.IsSelected = false; + + _selectedColorLibraryMyColor = value; + + if (_selectedColorLibraryMyColor != null) + _selectedColorLibraryMyColor.IsSelected = true; + RaisePropertyChangedAuto(); + } + } + + private FavoriteColor _selectedColor; public FavoriteColor SelectedColor @@ -439,17 +459,36 @@ namespace Tango.PPC.Jobs.Dialogs set { _editColorButtonName = value; RaisePropertyChangedAuto();} } - + + private PPCSettings _settings; + /// <summary> + /// Gets the main PPC settings. + /// </summary> + public PPCSettings Settings + { + get + { + if (_settings == null) + { + _settings = SettingsManager.Default.GetOrCreate<PPCSettings>(); + } + + return _settings; + } + private set { _settings = value; } + } + #endregion #region commands /// <summary> /// Gets or sets the save my colors command. /// </summary> + public RelayCommand OpenCloseAddMyColorDialogCommand { get; set; } public RelayCommand SaveMyColorsCommand { get; set; } public RelayCommand<string> AddNewGroupCommand { get; set; } public RelayCommand<string> AddNewGroupAndColorCommand { get; set; } - public RelayCommand<ColorLibrary> AddColorToLibraryCommand { get; set; } + public RelayCommand<ColorLibrary> SelectLibraryCommand { get; set; } /// <summary> /// Gets or sets the open my colors command. @@ -464,6 +503,8 @@ namespace Tango.PPC.Jobs.Dialogs public RelayCommand<object> DeleteColorCommand { get; set; } public RelayCommand VectorFineTuningCommand { get; set; } + public RelayCommand UploadFileCommand { get; set; } + public RelayCommand DownloadFileCommand { get; set; } #endregion @@ -501,6 +542,7 @@ namespace Tango.PPC.Jobs.Dialogs } }); + OpenCloseAddMyColorDialogCommand = new RelayCommand(OpenCloseAddMyColorDialog); SaveMyColorsCommand = new RelayCommand(SaveMyColors); OpenMyColorsCommand = new RelayCommand(() => { MyColorsMode = true; }); CloseMyColorsCommand = new RelayCommand(() => { MyColorsMode = false; SearchColorText = "";}); @@ -508,11 +550,15 @@ namespace Tango.PPC.Jobs.Dialogs AddGroupCommand = new RelayCommand(AddGroup); AddNewGroupCommand = new RelayCommand<string>(AddNewGroup); AddNewGroupAndColorCommand = new RelayCommand<string>(AddNewGroupAndColor); - AddColorToLibraryCommand = new RelayCommand<ColorLibrary>(AddColorToLibrary); + + SelectLibraryCommand = new RelayCommand<ColorLibrary>(SelectLibrary); DeleteGroupCommand = new RelayCommand<ColorLibrary>(DeleteGroup); EditColorsLibraryCommand = new RelayCommand<ColorLibrary>(EditColorsLibrary); EditColorsLibrariesCommand = new RelayCommand(EditColorsLibraries); DeleteColorCommand = new RelayCommand<object>(DeleteColor); + UploadFileCommand = new RelayCommand(UploadFile); + DownloadFileCommand = new RelayCommand(DownloadFile); + MyColorsMode = false; EditColorsGroupMode = false; SaveMyColorMode = false; @@ -616,9 +662,7 @@ namespace Tango.PPC.Jobs.Dialogs CheckIsSelectedColorInLibrary(); SelectedBrushStop.ConvertColor();//test OOG } - - private void OnSelectedtabChanged() { switch (SelectedColorTab) @@ -824,7 +868,7 @@ namespace Tango.PPC.Jobs.Dialogs #region MyColors - private void SaveMyColors() + private void OpenCloseAddMyColorDialog() { if(IsBusy) return; @@ -866,17 +910,37 @@ namespace Tango.PPC.Jobs.Dialogs else { SaveMyColorMode = !SaveMyColorMode; + //Init MyColorName on open the dialog String colorName = "MyColor"; - if (SelectedBrushStop != null && SelectedBrushStop.SegmentModel != null - && SelectedBrushStop.SegmentModel.Job != null) + if ( SelectedBrushStop != null && SelectedBrushStop.SegmentModel != null && SelectedBrushStop.SegmentModel.Job != null ) { colorName = SelectedBrushStop.SegmentModel.Job.Name; if(colorName.Length > 40) colorName = colorName.Substring(0, 40); } MyColorName = colorName; + SelectedColorLibraryMyColor = null; + AddGroupMode = false; } - + IsBusy = false; + + } + + /// <summary> + /// Saves my colors on OK button of dialog "Add my Color" + /// </summary> + private void SaveMyColors() + { + if (IsBusy) + return; + IsBusy = true; + if (SelectedColorLibraryMyColor != null) + { + AddColorToLibrary(SelectedColorLibraryMyColor); + } + SelectedColorLibraryMyColor = null; + AddGroupMode = false; + SaveMyColorMode = false; IsBusy = false; } @@ -932,14 +996,15 @@ namespace Tango.PPC.Jobs.Dialogs { NotificationProvider.ShowInfo("A group with this name already exists. Try adding a different name."); } + SelectedColorLibrary = library; - AddColorToLibrary(library); + // AddColorToLibrary(library); } NewGroupName = "Library" + (Libraries.Count() + 1); - SaveMyColorMode = false; - AddGroupMode = false; + //SaveMyColorMode = false; + //AddGroupMode = false; } - + /// <summary> /// Adds the selected color to library in Save my Colors. /// </summary> @@ -985,6 +1050,11 @@ namespace Tango.PPC.Jobs.Dialogs SaveMyColorMode = false; } + private void SelectLibrary(ColorLibrary library) + { + SelectedColorLibraryMyColor = library; + } + private void SelectColor(FavoriteColor favoriteColor) { SelectedColor = favoriteColor; @@ -1101,6 +1171,70 @@ namespace Tango.PPC.Jobs.Dialogs } } + private async void UploadFile() + { + if (Settings.StorageRootPath == null || false == Directory.Exists(Settings.StorageRootPath)) + { + Settings.StorageRootPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Twine", "Storage"); + Directory.CreateDirectory(Settings.StorageRootPath); + } + SaveFileDialog dlg = new SaveFileDialog(); + dlg.InitialDirectory = Path.GetFullPath(Settings.StorageRootPath); + dlg.RestoreDirectory = true; + dlg.Filter = "Tango Update My Colors|*.colr"; + dlg.FileName = "MyColors"; + dlg.DefaultExt = ".colr"; + if (dlg.ShowDialog().Value) + { + try + { + IsFree = false; + MyColorsEngine.Default.ToFile(dlg.FileName); + await NotificationProvider.ShowSuccess("My colors file saved successfully."); + LogManager.Log($"My colors file saved successfully to file {dlg.FileName}."); + } + catch (Exception ex) + { + LogManager.Log(ex, "Error saving My colors to file."); + await NotificationProvider.ShowError($"Error creating My colors file:\n{ex.Message}"); + } + finally + { + IsFree = true; + } + } + } + + private void DownloadFile() + { + if (Settings.StorageRootPath == null || false == Directory.Exists(Settings.StorageRootPath)) + { + Settings.StorageRootPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Twine", "Storage"); + Directory.CreateDirectory(Settings.StorageRootPath); + } + if (Directory.Exists(Settings.StorageRootPath)) + { + Microsoft.Win32.OpenFileDialog openFileDialog = new Microsoft.Win32.OpenFileDialog + { + InitialDirectory = Settings.StorageRootPath, + Title = "Browse My Colors Files", + + CheckFileExists = true, + CheckPathExists = true, + + DefaultExt = "colr", + Filter = "job files (*.colr)|*.colr", + ReadOnlyChecked = true, + ShowReadOnly = true + }; + if (openFileDialog.ShowDialog().Value) + { + MyColorsEngine.Default.FromFile(openFileDialog.FileName); + Libraries = MyColorsEngine.Default.GetAll().ToObservableCollection(); + } + } + } + private void LoadLibraryDictionary() { _colorSpaceToFavoriteColorDictionary = new Dictionary<ColorSpaces, List<FavoriteColor>>(); diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/select_all.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/select_all.png Binary files differnew file mode 100644 index 000000000..0a27c2aaa --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Images/JobView/select_all.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/ColorLibrary.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/ColorLibrary.cs index 62dc7ec1b..284b2c787 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/ColorLibrary.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/ColorLibrary.cs @@ -16,6 +16,7 @@ namespace Tango.PPC.Jobs.Models { public class ColorLibrary: ExtendedObject { + #region Properties private ObservableCollection<FavoriteColor> _colorList; public ObservableCollection<FavoriteColor> ColorList { @@ -51,7 +52,23 @@ namespace Tango.PPC.Jobs.Models OnEditGroupModeChanged(); RaisePropertyChangedAuto(); } } - + + private bool _isSelected; + [BsonIgnore] + public bool IsSelected + { + get { + return _isSelected; + } + set { + _isSelected = value; + RaisePropertyChangedAuto(); + } + } + + + #endregion + public ColorLibrary() { _colorList = new ObservableCollection<FavoriteColor>(); diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/FavoriteColor.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/FavoriteColor.cs index 00c8293bd..1d7b7c7c2 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/FavoriteColor.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/FavoriteColor.cs @@ -10,6 +10,7 @@ using System.Windows; using ColorMine.ColorSpaces; using Tango.Core; using LiteDB; +using Newtonsoft.Json; namespace Tango.PPC.Jobs.Models { @@ -86,14 +87,18 @@ namespace Tango.PPC.Jobs.Models } [BsonIgnore] + [JsonIgnore] public SolidColorBrush Brush { get { return new SolidColorBrush(Color); } } [BsonIgnore] + [JsonIgnore] private bool _isSelected; + [BsonIgnore] + [JsonIgnore] public bool IsSelected { get { return _isSelected; } @@ -117,5 +122,17 @@ namespace Tango.PPC.Jobs.Models ColorSpace = ColorSpaces.Volume; IsSelected = false; } + + public bool Equals(FavoriteColor color) + { + if(color == null) + return false; + + return (ColorSpace == color.ColorSpace + && Cyan == color.Cyan && Magenta == color.Magenta && Yellow == color.Yellow && Black ==color.Black + && Red == color.Red && Green == color.Green && Blue == color.Blue + && L == color.L && A == color.A && B == color.B + && Hue == color.Hue && Saturation == color.Saturation && Brightness == color.Brightness); + } } } 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 d8a71fc78..983719e57 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 @@ -79,7 +79,7 @@ namespace Tango.PPC.Jobs.Models if (Segments != null) { if((EnableInterSegment && IsAllSegmentsPerSpool)) - return GroupingSegments.Count > 0 ? (GroupingSegments.Sum(x => x.LengthWithInterSegment) - InterSegmentLength) : 0; + return GroupingSegments.Count > 0 ? (GroupingSegments.Sum(x => x.LengthWithInterSegment) ) : 0; return GroupingSegments.Sum(x => x.FullLength); //return Segments.Sum(x => x.LengthWithInterSegment); // return Segments.Sum(x => x.LengthWithFactor) + ((EnableInterSegment && IsAllSegmentsPerSpool) ? (InterSegmentLength * (Segments.Count > 0 ? Segments.Count - 1 : Segments.Count)) : 0); @@ -1097,8 +1097,9 @@ namespace Tango.PPC.Jobs.Models // NumberOfUnits = (int)maxRep; //} } - RaisePropertyChanged(nameof(Length)); + OnUpdateLengthhWeight(); + RaisePropertyChanged(nameof(Length)); } RaisePropertyChanged(nameof(GetEstimatedDuration)); @@ -1131,8 +1132,11 @@ namespace Tango.PPC.Jobs.Models int max = GroupingSegments.Max(x => x.SegmentIndex); GroupingSegments.Where(i => i.SegmentIndex != max).ToList().ForEach(x => x.EnableInterSegment = InterSegmentLength > 0); } + _enableintersegment = InterSegmentLength > 0; _preventChange = false; + OnLengthChanged(); + UpdateEffectiveSegments(); } private void OnNumberOfSpoolsChanged() diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/MyColors/MyColorsEngine.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/MyColors/MyColorsEngine.cs index 27dabc2e7..2963d290b 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/MyColors/MyColorsEngine.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/MyColors/MyColorsEngine.cs @@ -6,11 +6,15 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.PPC.Jobs.Models; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; namespace Tango.PPC.Jobs.MyColors { public class MyColorsEngine : IDisposable { + private JsonSerializerSettings _settings; + private LiteDatabase _db; private ILiteCollection<ColorLibrary> _collection; @@ -35,6 +39,14 @@ namespace Tango.PPC.Jobs.MyColors Directory.CreateDirectory(dbFolder); _db = new LiteDatabase($"Filename={Path.Combine(dbFolder, "color_library.db")}"); _collection = _db.GetCollection<ColorLibrary>("Libraries"); + + _settings = new JsonSerializerSettings() + { + TypeNameHandling = TypeNameHandling.Auto, + Formatting = Formatting.Indented, + ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore, + PreserveReferencesHandling = Newtonsoft.Json.PreserveReferencesHandling.Objects + }; } public void UpdateLibrary(ColorLibrary library) @@ -72,5 +84,34 @@ namespace Tango.PPC.Jobs.MyColors { _collection.Delete(library.ID); } + + public void ToFile( string flePath) + { + string jsonCollection = JsonConvert.SerializeObject(GetAll(), _settings); + File.WriteAllText(flePath, jsonCollection); + } + + public void FromFile(String fileName) + { + string json = File.ReadAllText(fileName); + List<ColorLibrary> colorCollection = JsonConvert.DeserializeObject<List<ColorLibrary>>(json, _settings); + foreach(var colorLib in colorCollection) + { + var currentLib = _collection.FindOne(x => x.Name == colorLib.Name); + if (currentLib != null) + { + var newlist = colorLib.ColorList.Where(s => !currentLib.ColorList.Any(p => p.Equals(s))); + foreach( var x in newlist) + currentLib.ColorList.Add(x); + + UpdateLibrary(currentLib); + } + else + { + _collection.Insert(colorLib); + } + + } + } } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Tango.PPC.JobsV2.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Tango.PPC.JobsV2.csproj index 96083d842..33ccc5b53 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Tango.PPC.JobsV2.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Tango.PPC.JobsV2.csproj @@ -752,10 +752,13 @@ <ItemGroup> <Resource Include="Images\ColorSelection\SearchImage.png" /> </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\select_all.png" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file 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 345231e57..8a01e07cc 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 @@ -110,6 +110,17 @@ namespace Tango.PPC.Jobs.ViewModels } } + public bool CanDropResume + { + get + { + return Job != null && HasResumeModel && + (!MachineProvider.MachineOperator.IsPrinting + || (MachineProvider.MachineOperator.RunningJob != null + && MachineProvider.MachineOperator.RunningJob.Guid != Job.Guid)); + } + } + private ICollectionView _segmentsCollectionView; /// <summary> /// Gets or sets the job segments collection view. @@ -280,19 +291,7 @@ namespace Tango.PPC.Jobs.ViewModels } } } - - private bool _showAdvanced; - - public bool ShowAdvanced - { - get { return _showAdvanced; } - set - { - _showAdvanced = value; - RaisePropertyChangedAuto(); - } - } - + private JobResumeModel _resumeModel; public JobResumeModel ResumeModel { @@ -435,7 +434,7 @@ namespace Tango.PPC.Jobs.ViewModels CopyCommand = new RelayCommand(Copy); UndoCommand = new RelayCommand(Undo);//(x) => { return UndoRedoManager.Instance.IsEnableUndoOperation(); } RedoCommand = new RelayCommand(Redo);//(x) => { return UndoRedoManager.Instance.IsEnableRedoOperation();} - DropResumeCommand = new RelayCommand(DropResume); + DropResumeCommand = new RelayCommand(DropResume, (x)=> CanDropResume); NavigateBackToJobs = new RelayCommand(NavigateBack); @@ -522,6 +521,7 @@ namespace Tango.PPC.Jobs.ViewModels } RaisePropertyChanged(nameof(CanEdit)); + DropResumeCommand.RaiseCanExecuteChanged(); Job.NameChanged -= Job_NameChanged; Job.NameChanged += Job_NameChanged; @@ -547,7 +547,7 @@ namespace Tango.PPC.Jobs.ViewModels RaisePropertyChanged(nameof(SelectedRML)); await LoadRML(_selectedRML); - if (BuildProvider.IsEureka && Job.Segments.Count == 1 && Job.Segments[0].BrushStops.Count == 1) + if (BuildProvider.IsEureka && Job.Segments.Count == 1 && Job.Segments[0].BrushStops.Count <= 1) { IsBasicMode = true; } @@ -581,7 +581,6 @@ namespace Tango.PPC.Jobs.ViewModels IsFullMode = true; DyeCommand.RaiseCanExecuteChanged(); - ShowAdvanced = Settings.ShowAdvancedOptions; } catch (Exception ex) { @@ -633,8 +632,8 @@ namespace Tango.PPC.Jobs.ViewModels JobType = Job.JobType, InterSegmentLength = Job.InterSegmentLength, EnableInterSegment = Job.EnableInterSegment, - NumberSpools = (BuildProvider.IsEureka ? Job.Spools : 1), - Copies = (BuildProvider.IsEureka ? Job.NumberOfUnits * Job.Spools : Job.NumberOfUnits) + NumberSpools = (BuildProvider.IsEureka ? Job.NumberOfSpools : 1), + Copies = (BuildProvider.IsEureka ? Job.NumberOfUnits * Job.NumberOfSpools : Job.NumberOfUnits) }; Dictionary<string, SegmentsGroupModel> guidToGroup = new Dictionary<string, SegmentsGroupModel>(); if (Job.Version < 2) @@ -781,6 +780,7 @@ namespace Tango.PPC.Jobs.ViewModels var handler = await PrintingManager.Print(Job, _db, printConfig); RaisePropertyChanged(nameof(CanEdit)); + DropResumeCommand.RaiseCanExecuteChanged(); if (!BuildProvider.IsEureka) { @@ -1607,6 +1607,7 @@ namespace Tango.PPC.Jobs.ViewModels { Job.SpoolType = _spoolTypes.FirstOrDefault(x => x.Code == (int)BL.Enumerations.SpoolTypes.StandardSpool); } + Job.NumberOfSpools = JobModel.NumberSpools; var oldSegments = Job.Segments.ToList(); @@ -1786,6 +1787,10 @@ namespace Tango.PPC.Jobs.ViewModels private void MachineOperator_PrintingStarted(object sender, PrintingEventArgs e) { RaisePropertyChanged(nameof(CanEdit)); + InvokeUI( () => + { + DropResumeCommand.RaiseCanExecuteChanged(); + }); } private void MachineOperator_PrintingEnded(object sender, Integration.Operation.PrintingEventArgs e) @@ -1796,6 +1801,10 @@ namespace Tango.PPC.Jobs.ViewModels } RaisePropertyChanged(nameof(CanEdit)); + InvokeUI(() => + { + DropResumeCommand.RaiseCanExecuteChanged(); + }); } 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 e5e41b382..5f005385e 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 @@ -185,6 +185,16 @@ namespace Tango.PPC.Jobs.ViewModels set { _collectionFilter = value; RaisePropertyChangedAuto(); } } + private bool _selectAll; + + public bool SelectAll + { + get { return _selectAll; } + set { _selectAll = value; + RaisePropertyChangedAuto();} + } + + #endregion @@ -230,6 +240,8 @@ namespace Tango.PPC.Jobs.ViewModels /// </summary> public RelayCommand MoveToListJobsCommand { get; set; } + public RelayCommand SelectAllJobsCommand { get; set; } + #endregion #region Constructors @@ -257,6 +269,7 @@ namespace Tango.PPC.Jobs.ViewModels CloneJobsCommand = new RelayCommand(() => CloneJobs(SelectedJobs)); ExportJobCommand = new RelayCommand(ExportJob); MoveToListJobsCommand = new RelayCommand(() => MoveToListJobs(SelectedJobs)); + SelectAllJobsCommand = new RelayCommand(SelectAllJobs); RegisterForMessage<JobRemovedMessage>(HandleJobRemovedMessage); RegisterForMessage<JobSavedMessage>(HandleJobSavedMessage); @@ -421,6 +434,12 @@ namespace Tango.PPC.Jobs.ViewModels IsMultiSelecting = false; } + private void SelectAllJobs() + { + SelectAll = !SelectAll; + } + + /// <summary> /// Adds a new job. /// </summary> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml index d348b2cc7..adf8c22d5 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml @@ -962,7 +962,7 @@ </Grid.RowDefinitions> <Grid Grid.Row="0"> <DockPanel x:Name="ColorPropertiesPanel" VerticalAlignment="Top" > - <StackPanel x:Name="AdvansedOptions" DockPanel.Dock="Right" Orientation="Horizontal" VerticalAlignment="Top" Margin="0 5 18 0" Height="55" HorizontalAlignment="Right" Width="Auto" Visibility="{Binding ShowAdvanced, Converter={StaticResource BooleanToVisibilityConverter}}"> + <StackPanel x:Name="AdvansedOptions" DockPanel.Dock="Right" Orientation="Horizontal" Margin="0 5 18 0" Height="55" HorizontalAlignment="Right" Width="Auto" VerticalAlignment="Center"> <TextBlock FontSize="20" VerticalAlignment="Center" >Advanced Options</TextBlock> <touch:TouchToggleSlider Style="{StaticResource TangoToggleButtonGreenAccent}" Height="28" CornerRadius="14" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="10 0 0 0" Width="54" IsChecked="{Binding IsBasicMode, Converter={StaticResource BooleanInverseConverter}, Mode=TwoWay}"></touch:TouchToggleSlider> </StackPanel> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobsView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobsView.xaml index d3fdedde5..ec080ebed 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobsView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobsView.xaml @@ -35,6 +35,8 @@ <sharedConverters:EnumToItemsSourceConverter x:Key="EnumToItemsSourceConverter" /> <converters:JobsCategoryToVisibilityConverter x:Key="JobsCategoryToVisibilityConverter" /> <converters:JobsCategoryToOpacityConverter x:Key="JobsCategoryToOpacityConverter" /> + + <BitmapImage x:Key="SelectAll" UriSource="../Images/JobView/select_all.png" /> </ResourceDictionary> </UserControl.Resources> @@ -94,6 +96,22 @@ <touch:TouchIconButton Command="{Binding ClearSelectionCommand}" Visibility="{Binding IsMultiSelecting,Converter={StaticResource BooleanToVisibilityConverter}}" Margin="0 0 30 0" Padding="20" Icon="Close" Width="50" Height="50" Style="{StaticResource TangoRoundTouchIconButton}"> </touch:TouchIconButton> + <!--<touch:TouchIconButton Command="{Binding SelectAllJobsCommand}" Margin="0 0 30 0" Padding="20" Icon="CheckboxMultipleMarkedOutline" Style="{StaticResource TangoRoundTouchIconButton}">>--> + <touch:TouchButton x:Name="SelectAllButton" Command="{Binding SelectAllJobsCommand}" Margin="0 0 30 0" EnableDropShadow="False"> + <touch:TouchButton.Style> + <Style TargetType="touch:TouchButton" > + <Setter Property="Background" Value="{StaticResource TangoMidAccentBrush}"></Setter> + <Setter Property="RenderOptions.EdgeMode" Value="Unspecified"></Setter> + <Setter Property="RenderOptions.BitmapScalingMode" Value="Fant"></Setter> + <Setter Property="CornerRadius" Value="50"></Setter> + <Setter Property="RippleCentered" Value="True"></Setter> + <Setter Property="RippleFactor" Value="2"></Setter> + <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight}"></Setter> + </Style> + </touch:TouchButton.Style> + <Image Source="{StaticResource SelectAll}" Width="24" Height="24"></Image> + </touch:TouchButton> + <!--</touch:TouchIconButton>--> <touch:TouchIconButton Command="{Binding MoveToListJobsCommand}" Margin="0 0 30 0" Padding="20" > <touch:TouchIconButton.Style> <Style TargetType="touch:TouchIconButton" BasedOn="{StaticResource TangoRoundTouchIconButton}"> @@ -205,7 +223,7 @@ <Grid Grid.Row="1" x:Name="moveGrid"> <touch:TouchLoadingPanel IsLoading="{Binding IsLoadingJobs}" Visibility="{Binding SelectedCategory,Converter={StaticResource JobsCategoryToVisibilityConverter},ConverterParameter='Draft'}"> - <touch:LightTouchDataGrid CollectionFilter="{Binding CollectionFilter}" AnimateSorting="False" RenderOptions.EdgeMode="Unspecified" Style="{StaticResource TangoJobsGrid}" x:Name="dataGridJobs" SelectedItems="{Binding SelectedJobs}" IsMultiSelecting="{Binding IsMultiSelecting,Mode=TwoWay}" OnDragAndDropCommand="{Binding JobDragedDroppedCommand}" ItemsSource="{Binding DraftJobsCollectionView}" ItemSelectedCommand="{Binding JobSelectedCommand}" Margin="10"> + <touch:LightTouchDataGrid CollectionFilter="{Binding CollectionFilter}" AnimateSorting="False" RenderOptions.EdgeMode="Unspecified" Style="{StaticResource TangoJobsGrid}" x:Name="dataGridJobs" SelectedItems="{Binding SelectedJobs}" IsMultiSelecting="{Binding IsMultiSelecting,Mode=TwoWay}" OnDragAndDropCommand="{Binding JobDragedDroppedCommand}" ItemsSource="{Binding DraftJobsCollectionView}" ItemSelectedCommand="{Binding JobSelectedCommand}" Margin="10" SelectAll="{Binding SelectAll,Mode=TwoWay}"> <touch:LightTouchDataGrid.Columns> <!--<touch:LightTouchDataGridColumn Width="90"> <touch:LightTouchDataGridColumn.Header> @@ -267,7 +285,7 @@ <MultiBinding Converter="{StaticResource LengthWithSpoolsConverter}" StringFormat="#,0.0" TargetNullValue='0' FallbackValue='0' Mode="OneWay"> <Binding Path="LengthIncludingNumberOfUnits" Mode="OneWay"/> <Binding Path="DataContext.BuildProvider.IsEureka" Mode="OneWay" RelativeSource="{RelativeSource AncestorType=UserControl}"/> - <Binding Path="Spools" Mode="OneWay"/> + <Binding Path="NumberOfSpools" Mode="OneWay"/> </MultiBinding> </TextBlock.Text> </TextBlock> @@ -336,7 +354,7 @@ </touch:TouchLoadingPanel> <touch:TouchLoadingPanel IsLoading="{Binding IsLoadingJobs}" Visibility="{Binding SelectedCategory,Converter={StaticResource JobsCategoryToVisibilityConverter},ConverterParameter='History'}"> - <touch:LightTouchDataGrid CollectionFilter="{Binding CollectionFilter}" AnimateSorting="False" EnableDragAndDrop="False" RenderOptions.EdgeMode="Unspecified" x:Name="dataGridJobsHistory" Style="{StaticResource TangoJobsGrid}" SelectedItems="{Binding SelectedJobs}" IsMultiSelecting="{Binding IsMultiSelecting,Mode=TwoWay}" ItemsSource="{Binding HistoryJobsCollectionView}" ItemSelectedCommand="{Binding JobSelectedCommand}" Margin="10"> + <touch:LightTouchDataGrid CollectionFilter="{Binding CollectionFilter}" AnimateSorting="False" EnableDragAndDrop="False" RenderOptions.EdgeMode="Unspecified" x:Name="dataGridJobsHistory" Style="{StaticResource TangoJobsGrid}" SelectedItems="{Binding SelectedJobs}" IsMultiSelecting="{Binding IsMultiSelecting,Mode=TwoWay}" ItemsSource="{Binding HistoryJobsCollectionView}" ItemSelectedCommand="{Binding JobSelectedCommand}" Margin="10" SelectAll="{Binding SelectAll,Mode=TwoWay}"> <touch:LightTouchDataGrid.Columns> <touch:LightTouchDataGridColumn Width="50"> <touch:LightTouchDataGridColumn.Header> @@ -390,7 +408,7 @@ <MultiBinding Converter="{StaticResource LengthWithSpoolsConverter}" StringFormat="0.0" TargetNullValue='0' FallbackValue='0'> <Binding Path="LengthIncludingNumberOfUnits" Mode="OneWay"/> <Binding Path="DataContext.BuildProvider.IsEureka" Mode="OneWay" RelativeSource="{RelativeSource AncestorType=UserControl}"/> - <Binding Path="Spools" Mode="OneWay"/> + <Binding Path="NumberOfSpools" Mode="OneWay"/> </MultiBinding> </TextBlock.Text> </TextBlock> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml index 764f044d0..7de2818f8 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml @@ -457,15 +457,10 @@ <DockPanel Margin="0 20 0 0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> <TextBlock VerticalAlignment="Center">Min limit dL (Fine Tuning)</TextBlock> - <touch:TouchNumericTextBox Minimum="0" Maximum="10" KeyboardContainer="{Binding ElementName=Container}" Value="{Binding Settings.FineTuningMinLimitdL}" Margin="0 0 100 0" DockPanel.Dock="Right" HorizontalAlignment="Right" Width="90" HasDecimalPoint="True"></touch:TouchNumericTextBox> + <touch:TouchNumericTextBox Minimum="0" Maximum="10" KeyboardContainer="{Binding ElementName=Container}" Value="{Binding Settings.FineTuningMinLimitdL}" Margin="0 0 100 0" DockPanel.Dock="Right" HorizontalAlignment="Right" Width="90" HasDecimalPoint="True" ></touch:TouchNumericTextBox> </DockPanel> - <DockPanel Margin="0 20 0 0" TextElement.FontSize="{StaticResource TangoDefaultFontSize}"> - <TextBlock VerticalAlignment="Center">Show advanced options (Segments & Gradients) in the Job Editor</TextBlock> - <touch:TouchToggleSlider IsChecked="{Binding Settings.ShowAdvancedOptions}" Margin="0 0 100 0" DockPanel.Dock="Right" Style="{StaticResource TangoToggleButtonGrayAccent}" HorizontalAlignment="Right" Width="90"></touch:TouchToggleSlider> - </DockPanel> - - <DockPanel Margin="0 20 0 0"> + <DockPanel Margin="0 20 0 10"> <touch:TouchIcon VerticalAlignment="Top" Icon="InformationOutline" Foreground="{StaticResource TangoGrayTextBrush}"></touch:TouchIcon> <TextBlock Margin="10 0 0 0" VerticalAlignment="Top" TextWrapping="Wrap" FontSize="{StaticResource TangoSmallFontSize}" Foreground="{StaticResource TangoGrayTextBrush}"> Please restart the application for advanced settings to take effect. diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs index ed7784b2b..b3cb5673b 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs @@ -201,9 +201,9 @@ namespace Tango.PPC.Storage.ViewModels public override Task<bool> OnNavigateBackRequest() { - String path = Settings.StorageRootPath != null ? Settings.StorageRootPath : StorageProvider.Drive.RootDirectory.FullName; - - if (_allow_exit || CurrentPath == path) + if (_allow_exit || + (Settings.StorageRootPath != null && Settings.StorageRootPath == CurrentPath) + || (StorageProvider.Drive != null && StorageProvider.Drive.RootDirectory != null && CurrentPath == StorageProvider.Drive.RootDirectory.FullName)) { return Task.FromResult(true); } |
