diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-12-30 18:18:27 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-12-30 18:18:27 +0200 |
| commit | 62abc03d76ecfd8ab16ffefe6a4f6a7b94f62203 (patch) | |
| tree | 58a7ce6bc30d7e049bf2b4c1aa272306796350eb /Software/Visual_Studio/PPC/Modules | |
| parent | 80221695b6c6fd48f7a3e2e70850e68788560b31 (diff) | |
| parent | 71e6a3ec2197eba8b5e1b295914653426064f745 (diff) | |
| download | Tango-62abc03d76ecfd8ab16ffefe6a4f6a7b94f62203.tar.gz Tango-62abc03d76ecfd8ab16ffefe6a4f6a7b94f62203.zip | |
BAD MERGE.
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules')
14 files changed, 392 insertions, 762 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml index bd0bbfd11..afe331145 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml @@ -3,12 +3,11 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL" xmlns:entities="clr-namespace:Tango.BL.Entities;assembly=Tango.BL" xmlns:local="clr-namespace:Tango.PPC.Jobs.Controls" mc:Ignorable="d" - d:DesignHeight="60" d:DesignWidth="500" Height="38" x:Name="control"> + d:DesignHeight="60" d:DesignWidth="500" Height="38" d:DataContext="{d:DesignInstance Type=entities:Job, IsDesignTimeCreatable=False}" x:Name="control"> <Grid> <Grid.ColumnDefinitions> @@ -21,7 +20,7 @@ <RowDefinition Height="1*" /> </Grid.RowDefinitions> - <ItemsControl ClipToBounds="False" ItemsSource="{Binding ElementName=control,Path=Job.EffectiveSegments}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DisplayMarkers,Converter={StaticResource BooleanToVisibilityConverter}}"> + <ItemsControl ClipToBounds="False" ItemsSource="{Binding EffectiveSegments,IsAsync=True}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DisplayMarkers,Converter={StaticResource BooleanToVisibilityConverter}}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <StackPanel Orientation="Horizontal" ClipToBounds="False"></StackPanel> @@ -32,15 +31,15 @@ <Grid x:Name="grid"> <Grid.Width> <MultiBinding Converter="{StaticResource SegmentLengthToWidthConverter}"> - <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="Job.Length"></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.Length"></Binding> <Binding RelativeSource="{RelativeSource AncestorType=ItemsControl}" Path="ActualWidth"></Binding> <Binding Path="LengthWithFactor"></Binding> </MultiBinding> </Grid.Width> - <DockPanel HorizontalAlignment="Center" TextElement.FontSize="{StaticResource TangoSmallFontSize}"> - <DockPanel.Style> - <Style TargetType="DockPanel"> + <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoSmallFontSize}"> + <TextBlock.Style> + <Style TargetType="TextBlock"> <Setter Property="Visibility" Value="Visible"></Setter> <Style.Triggers> <DataTrigger Binding="{Binding ElementName=grid,Path=ActualWidth,Converter={StaticResource SmallerThanToBooleanConverter},ConverterParameter=20}" Value="True"> @@ -48,10 +47,9 @@ </DataTrigger> </Style.Triggers> </Style> - </DockPanel.Style> - <controls:FastTextBlock Text="{Binding LengthWithFactor,Mode=OneWay,StringFormat=N0}" /> - <controls:FastTextBlock Text="m" /> - </DockPanel> + </TextBlock.Style> + <Run Text="{Binding LengthWithFactor,Mode=OneWay,StringFormat=N0,IsAsync=True}"></Run><Run Text="m"></Run> + </TextBlock> </Grid> </DataTemplate> </ItemsControl.ItemTemplate> @@ -68,8 +66,11 @@ </RectangleGeometry.Rect> </RectangleGeometry> </Border.Clip> + <Border.Background> + <ImageBrush ImageSource="../Images/JobView/transparent_small.jpg" Stretch="None" TileMode="Tile" AlignmentX="Left" ViewportUnits="Absolute" Viewport="0,0,94,30" /> + </Border.Background> <Grid> - <ItemsControl ClipToBounds="False" ItemsSource="{Binding ElementName=control,Path=Job.EffectiveSegments}"> + <ItemsControl ClipToBounds="False" ItemsSource="{Binding EffectiveSegments,IsAsync=True}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <StackPanel Orientation="Horizontal" ClipToBounds="False"></StackPanel> @@ -80,7 +81,7 @@ <Grid> <Grid.Width> <MultiBinding Converter="{StaticResource SegmentLengthToWidthConverter}"> - <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="Job.Length"></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.Length"></Binding> <Binding RelativeSource="{RelativeSource AncestorType=ItemsControl}" Path="ActualWidth"></Binding> <Binding Path="LengthWithFactor"></Binding> </MultiBinding> @@ -103,7 +104,7 @@ <Style.Triggers> <MultiDataTrigger> <MultiDataTrigger.Conditions> - <Condition Binding="{Binding ElementName=control,Path=Job.JobType}" Value="{x:Static enumerations:JobTypes.Embroidery}" /> + <Condition Binding="{Binding JobType}" Value="{x:Static enumerations:JobTypes.Embroidery}" /> <Condition Binding="{Binding ElementName=control,Path=IsActive}" Value="False" /> </MultiDataTrigger.Conditions> <Setter Property="Visibility" Value="Visible"></Setter> @@ -113,7 +114,7 @@ </Grid.Style> <TextBlock Margin="10 0 0 -2" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}"> - <Run Text="x"></Run><Run Text="{Binding ElementName=control,Path=Job.NumberOfUnits}"></Run> + <Run Text="x"></Run><Run Text="{Binding NumberOfUnits}"></Run> </TextBlock> </Grid> </Grid> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml.cs index c977e71d0..1c0b90f91 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml.cs @@ -23,18 +23,6 @@ namespace Tango.PPC.Jobs.Controls /// <seealso cref="System.Windows.Markup.IComponentConnector" /> public partial class JobSummeryViewer : UserControl { - - /// <summary> - /// Gets or sets the job. - /// </summary> - public Job Job - { - get { return (Job)GetValue(JobProperty); } - set { SetValue(JobProperty, value); } - } - public static readonly DependencyProperty JobProperty = - DependencyProperty.Register("Job", typeof(Job), typeof(JobSummeryViewer), new PropertyMetadata(null)); - /// <summary> /// Maybe not necessary! /// </summary> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportCsvJobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportCsvJobView.xaml deleted file mode 100644 index e1caea66d..000000000 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportCsvJobView.xaml +++ /dev/null @@ -1,38 +0,0 @@ -<UserControl x:Class="Tango.PPC.Jobs.Dialogs.ImportCsvJobView" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:local="clr-namespace:Tango.PPC.Jobs.Dialogs" - xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" - mc:Ignorable="d" - Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DesignHeight="555" d:DesignWidth="560" Width="570" Height="700" d:DataContext="{d:DesignInstance Type=local:ImportCsvJobViewVM, IsDesignTimeCreatable=False}"> - <Grid Margin="20"> - <DockPanel> - <Grid DockPanel.Dock="Bottom"> - <touch:TouchButton HorizontalAlignment="Left" CornerRadius="25" Command="{Binding CloseCommand}" Style="{StaticResource TangoHollowButton}" Width="150" Height="50" VerticalAlignment="Bottom">CANCEL</touch:TouchButton> - <touch:TouchButton HorizontalAlignment="Right" CornerRadius="25" Command="{Binding OKCommand}" Style="{StaticResource TangoHollowButton}" Width="150" Height="50" VerticalAlignment="Bottom">IMPORT</touch:TouchButton> - </Grid> - <StackPanel> - <Grid HorizontalAlignment="Center"> - <Image Source="../Images/job.png" Stretch="Uniform" Height="120"></Image> - <Image Source="../Images/csv.png" Stretch="Uniform" Height="48" HorizontalAlignment="Right" VerticalAlignment="Bottom" RenderOptions.BitmapScalingMode="Fant" Margin="10"></Image> - </Grid> - <TextBlock HorizontalAlignment="Center" Margin="0 20 0 0" FontSize="{StaticResource TangoHeaderFontSize}">IMPORT CSV JOB</TextBlock> - <TextBlock Margin="20 10" HorizontalAlignment="Center" TextWrapping="Wrap" TextAlignment="Center">A csv job file has been selected from the storage device. press 'IMPORT' to add the job to your job list.</TextBlock> - - <StackPanel Margin="80"> - <StackPanel> - <TextBlock FontSize="{StaticResource TangoSmallFontSize}">Job Name</TextBlock> - <touch:TouchTextBox Text="{Binding Name}" Watermark="Name" Margin="0 -2 0 0"></touch:TouchTextBox> - </StackPanel> - - <StackPanel Margin="0 40 0 0"> - <TextBlock FontSize="{StaticResource TangoSmallFontSize}">Thread Type</TextBlock> - <touch:TouchComboBox ItemsSource="{Binding Rmls}" SelectedItem="{Binding SelectedRml}" DisplayMemberPath="Name"></touch:TouchComboBox> - </StackPanel> - </StackPanel> - </StackPanel> - </DockPanel> - </Grid> -</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportCsvJobView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportCsvJobView.xaml.cs deleted file mode 100644 index 67fc5ec82..000000000 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportCsvJobView.xaml.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace Tango.PPC.Jobs.Dialogs -{ - /// <summary> - /// Interaction logic for ImportJobView.xaml - /// </summary> - public partial class ImportCsvJobView : UserControl - { - public ImportCsvJobView() - { - InitializeComponent(); - } - } -} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportCsvJobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportCsvJobViewVM.cs deleted file mode 100644 index ffa406795..000000000 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/ImportCsvJobViewVM.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Tango.BL; -using Tango.BL.Builders; -using Tango.BL.Entities; -using Tango.Core.Commands; -using Tango.Core.DI; -using Tango.PPC.Common; -using Tango.PPC.Common.Connection; -using Tango.Settings; -using Tango.SharedUI; - -namespace Tango.PPC.Jobs.Dialogs -{ - public class ImportCsvJobViewVM : DialogViewVM - { - [TangoInject] - private IMachineProvider MachineProvider { get; set; } - - private String _name; - public String Name - { - get { return _name; } - set { _name = value; RaisePropertyChangedAuto(); } - } - - private List<Rml> _rmls; - public List<Rml> Rmls - { - get { return _rmls; } - set { _rmls = value; RaisePropertyChangedAuto(); } - } - - private Rml _selectedRml; - public Rml SelectedRml - { - get { return _selectedRml; } - set { _selectedRml = value; RaisePropertyChangedAuto(); } - } - - private bool _importAndEdit; - public bool ImportAndEdit - { - get { return _importAndEdit; } - set { _importAndEdit = value; RaisePropertyChangedAuto(); } - } - - public ImportCsvJobViewVM() - { - TangoIOC.Default.Inject(this); - } - - public async Task Init() - { - var settings = SettingsManager.Default.GetOrCreate<PPCSettings>(); - - using (ObservablesContext db = ObservablesContext.CreateDefault()) - { - Rmls = await new RmlsCollectionBuilder(db).SetAll().ForHeadType(MachineProvider.Machine.MachineHeadType).ForSite(MachineProvider.Machine.SiteGuid).BuildListAsync(); - - if (settings.DefaultRmlGuid != null) - { - SelectedRml = Rmls.SingleOrDefault(x => x.Guid == settings.DefaultRmlGuid); - } - - if (SelectedRml == null) - { - SelectedRml = Rmls.FirstOrDefault(); - } - } - } - } -} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/csv.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/csv.png Binary files differdeleted file mode 100644 index 5ff44818b..000000000 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/csv.png +++ /dev/null diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj index 278b7376b..33b9de808 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj @@ -92,10 +92,6 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> - <Page Include="Dialogs\ImportCsvJobView.xaml"> - <Generator>MSBuild:Compile</Generator> - <SubType>Designer</SubType> - </Page> <Page Include="Dialogs\ImportTwnFileView.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> @@ -197,10 +193,6 @@ <DependentUpon>BasicColorCorrectionView.xaml</DependentUpon> </Compile> <Compile Include="Dialogs\BasicColorCorrectionViewVM.cs" /> - <Compile Include="Dialogs\ImportCsvJobView.xaml.cs"> - <DependentUpon>ImportCsvJobView.xaml</DependentUpon> - </Compile> - <Compile Include="Dialogs\ImportCsvJobViewVM.cs" /> <Compile Include="Dialogs\ImportTwnFileView.xaml.cs"> <DependentUpon>ImportTwnFileView.xaml</DependentUpon> </Compile> @@ -514,13 +506,10 @@ <ItemGroup> <Resource Include="Images\sync_job.png" /> </ItemGroup> - <ItemGroup> - <Resource Include="Images\csv.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.Jobs/ViewModels/JobSummeryViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs index 0e40e0d6a..a2acf5893 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs @@ -155,6 +155,16 @@ namespace Tango.PPC.Jobs.ViewModels .WithBrushStops() .BuildAsync(); + if (Job.ColorSpace.Space == BL.Enumerations.ColorSpaces.Catalog) + { + if (_context.ColorCatalogs.SingleOrDefault(x => x.Guid == Job.ColorCatalogGuid) == null) + { + await NotificationProvider.ShowError("The selected color catalog for this job could not be found.\nCannot load job."); + await NavigationManager.NavigateBack(); + return; + } + } + await Task.Factory.StartNew(() => { try diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs index 6f7717a90..5e90d3b5b 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs @@ -37,8 +37,6 @@ using Tango.PPC.Storage; using System.IO; using Tango.ColorConversion; using Tango.Integration.Operation; -using Tango.BL.Enumerations; -using Tango.PPC.Common.Lubrication; namespace Tango.PPC.Jobs.ViewModels { @@ -190,23 +188,39 @@ namespace Tango.PPC.Jobs.ViewModels set { _isJobDetailsExpanded = value; RaisePropertyChangedAuto(); } } + private List<ColorCatalogsItem> _catalogItems; /// <summary> - /// Gets or sets the twine catalog automatic complete provider. + /// Gets or sets the twine catalog items. /// </summary> - public IAutoCompleteProvider CatalogAutoCompleteProvider { get; set; } + public List<ColorCatalogsItem> CatalogItems + { + get { return _catalogItems; } + set { _catalogItems = value; RaisePropertyChangedAuto(); } + } - private List<ColorCatalog> _availableCatalogs; - public List<ColorCatalog> AvailableCatalogs + private ColorCatalogsItem _selectedCatalogItem; + /// <summary> + /// Gets or sets the selected catalog item. + /// </summary> + public ColorCatalogsItem SelectedCatalogItem { - get { return _availableCatalogs; } - set { _availableCatalogs = value; RaisePropertyChangedAuto(); } + get { return _selectedCatalogItem; } + set { _selectedCatalogItem = value; RaisePropertyChangedAuto(); } } - private RmlLubricationLevel _lubricationLevel; - public RmlLubricationLevel LubricationLevel + /// <summary> + /// Gets or sets the twine catalog automatic complete provider. + /// </summary> + public IAutoCompleteProvider CatalogAutoCompleteProvider { get; set; } + + private ColorCatalog _selectedCatalog; + /// <summary> + /// Gets or sets the selected catalog. + /// </summary> + public ColorCatalog SelectedCatalog { - get { return _lubricationLevel; } - set { _lubricationLevel = value; RaisePropertyChangedAuto(); } + get { return _selectedCatalog; } + set { _selectedCatalog = value; RaisePropertyChangedAuto(); } } #endregion @@ -348,6 +362,7 @@ namespace Tango.PPC.Jobs.ViewModels FineTuneItems = new ObservableCollection<FineTuneItem>(); ApprovalFineTuneItems = new ObservableCollection<FineTuneItem>(); + CatalogItems = new List<ColorCatalogsItem>(); CustomersAutoCompleteProvider = new AutoCompleteProvider<Customer>((customer, filter) => { @@ -430,14 +445,6 @@ namespace Tango.PPC.Jobs.ViewModels if (_db != null) { - if (Job != null) - { - foreach (var stop in Job.Segments.SelectMany(x => x.BrushStops).ToList()) - { - stop.ColorSpaceChanged -= Stop_ColorSpaceChanged; - } - } - Rmls.ForEach(x => x.Cct = null); Rmls = null; _db.Dispose(); @@ -461,22 +468,36 @@ namespace Tango.PPC.Jobs.ViewModels Job.ValidateOnPropertyChanged = true; - GetLubricationLevel(); - LogManager.Log("Loading RMLS..."); Rmls = (await new RmlsCollectionBuilder(_db).SetAll().WithActiveParametersGroup().WithCAT(Job.MachineGuid).WithCCT().WithLiquidFactors().WithSpools().ForHeadType(MachineProvider.Machine.MachineHeadType).ForSite(MachineProvider.Machine.SiteGuid).BuildAsync()).ToList(); LogManager.Log("Loading Color Spaces..."); - ColorSpaces = await _db.ColorSpaces.Where(x => x.Code != (int)BL.Enumerations.ColorSpaces.CMYK).ToListAsync(); + ColorSpaces = await _db.ColorSpaces.ToListAsync(); LogManager.Log("Loading Spool Types..."); SpoolTypes = await _db.SpoolTypes.ToListAsync(); LogManager.Log("Loading Customers..."); Customers = await _db.Customers.Where(x => x.OrganizationGuid == MachineProvider.Machine.OrganizationGuid).ToListAsync(); - AvailableCatalogs = await new CatalogsCollectionBuilder(_db).SetAll().WithGroups().WithItems().ForSite(MachineProvider.Machine.SiteGuid).BuildListAsync(); + if (Job.ColorSpace.Space == BL.Enumerations.ColorSpaces.Catalog) + { + SelectedCatalog = await new CatalogBuilder(_db).Set(Job.ColorCatalogGuid).WithGroups().WithItems().BuildAsync(); + + if (SelectedCatalog != null) + { + CatalogItems = SelectedCatalog.ColorCatalogsGroups.SelectMany(x => x.ColorCatalogsItems).OrderBy(x => x.ItemIndex).ToList(); + } + else + { + await NotificationProvider.ShowError("The selected color catalog for this job could not be found.\nCannot load job."); + Job = null; + _can_navigate_back = true; + await NavigationManager.NavigateBack(); + return; + } + } foreach (var segment in Job.Segments) { - SetSegmentLiquidVolumes(segment); + SetSegmentLiquidVolumesIfVolume(segment); } if (!_check_gamut_thread.IsAlive) @@ -519,8 +540,6 @@ namespace Tango.PPC.Jobs.ViewModels ValidateBrushStops(); - CoerceBrushStopsColorSpaceChange(); - DyeCommand.RaiseCanExecuteChanged(); StartSampleDyeCommand.RaiseCanExecuteChanged(); StartFineTuningCommand.RaiseCanExecuteChanged(); @@ -683,8 +702,6 @@ namespace Tango.PPC.Jobs.ViewModels // stop.ColorCatalog = replacement; //} - GetLubricationLevel(); - ResetFineTuning(); } @@ -701,8 +718,7 @@ namespace Tango.PPC.Jobs.ViewModels { LogManager.Log("Adding new solid segment..."); var s = Job.AddSolidSegment(Settings.DefaultSegmentLength > 0 ? Settings.DefaultSegmentLength : 10); - SetSegmentLiquidVolumes(s); - CoerceBrushStopsColorSpaceChange(); + SetSegmentLiquidVolumesIfVolume(s); return s; } catch (Exception ex) @@ -722,8 +738,7 @@ namespace Tango.PPC.Jobs.ViewModels { LogManager.Log("Adding new gradient segment..."); var s = Job.AddGradientSegment(Settings.DefaultSegmentLength > 0 ? Settings.DefaultSegmentLength : 10); - SetSegmentLiquidVolumes(s); - CoerceBrushStopsColorSpaceChange(); + SetSegmentLiquidVolumesIfVolume(s); return s; } catch (Exception ex) @@ -796,16 +811,19 @@ namespace Tango.PPC.Jobs.ViewModels /// Sets the segment liquid volumes. /// </summary> /// <param name="segment">The segment.</param> - private void SetSegmentLiquidVolumes(Segment segment) + private void SetSegmentLiquidVolumesIfVolume(Segment segment) { - foreach (var stop in segment.BrushStops) + if (Job.ColorSpace.Code == BL.Enumerations.ColorSpaces.Volume.ToInt32()) { - stop.SetLiquidVolumes(Job.Machine.Configuration, Job.Rml, Job.Rml.GetActiveProcessGroup().ProcessParametersTables.FirstOrDefault()); - - var lub = stop.LiquidVolumes.FirstOrDefault(x => x.IdsPack.LiquidType.Code == (int)BL.Enumerations.LiquidTypes.Lubricant); - if (lub != null) + foreach (var stop in segment.BrushStops) { - lub.Volume = 100; + stop.SetLiquidVolumes(Job.Machine.Configuration, Job.Rml, Job.Rml.GetActiveProcessGroup().ProcessParametersTables.FirstOrDefault()); + + var lub = stop.LiquidVolumes.FirstOrDefault(x => x.IdsPack.LiquidType.Code == (int)BL.Enumerations.LiquidTypes.Lubricant); + if (lub != null) + { + lub.Volume = 100; + } } } } @@ -826,24 +844,6 @@ namespace Tango.PPC.Jobs.ViewModels #region Brush Stops Management - private void CoerceBrushStopsColorSpaceChange() - { - if (Job != null) - { - foreach (var stop in Job.Segments.SelectMany(x => x.BrushStops).ToList()) - { - stop.ColorSpaceChanged -= Stop_ColorSpaceChanged; - stop.ColorSpaceChanged += Stop_ColorSpaceChanged; - } - } - } - - private void Stop_ColorSpaceChanged(object sender, ColorSpace e) - { - BrushStop stop = sender as BrushStop; - stop.Segment.BrushStops.Where(x => x != stop).ToList().ForEach(x => x.ColorSpace = stop.ColorSpace); - } - /// <summary> /// Adds a new brush stop to the specified segment. /// </summary> @@ -852,8 +852,7 @@ namespace Tango.PPC.Jobs.ViewModels { LogManager.Log($"Adding new brush stop to segment {segment.SegmentIndex}."); segment.AddBrushStop(); - SetSegmentLiquidVolumes(segment); - CoerceBrushStopsColorSpaceChange(); + SetSegmentLiquidVolumesIfVolume(segment); } /// <summary> @@ -988,56 +987,34 @@ namespace Tango.PPC.Jobs.ViewModels { if (stop != null && stop.ColorSpace != null) { - if (stop.BrushColorSpace == BL.Enumerations.ColorSpaces.Catalog) return; + stop.Corrected = false; + stop.OutOfGamutChecked = false; - _volumeConversionTimer.ResetReplace(() => + if (stop.BrushColorSpace == BL.Enumerations.ColorSpaces.Volume) { - - try + _volumeConversionTimer.ResetReplace(() => { - var output = _converter.Convert(stop, false); - - if (stop.BrushColorSpace == BL.Enumerations.ColorSpaces.Volume) + try { + var output = _converter.Convert(stop, false); + stop.Red = output.SingleCoordinates.Red; stop.Green = output.SingleCoordinates.Green; stop.Blue = output.SingleCoordinates.Blue; - stop.L = output.SingleCoordinates.L; - stop.A = output.SingleCoordinates.A; - stop.B = output.SingleCoordinates.B; stop.Corrected = true; stop.IsOutOfGamut = false; - } - else if (stop.BrushColorSpace == BL.Enumerations.ColorSpaces.LAB) - { - output.ApplyOnBrushStopVolumesOnly(stop); - stop.Corrected = false; - stop.OutOfGamutChecked = false; - } - else if (stop.BrushColorSpace == BL.Enumerations.ColorSpaces.RGB) - { - output.ApplyOnBrushStopVolumesOnly(stop); - stop.Corrected = false; - stop.OutOfGamutChecked = false; - } - try + InvokeUI(() => + { + DyeCommand.RaiseCanExecuteChanged(); + }); + } + catch (Exception ex) { - var closestItem = AvailableCatalogs.SelectMany(x => x.AllItemsOrdered).GetClosestItem(stop.Color); - stop.ColorCatalog = closestItem.ColorCatalogsGroup.ColorCatalog; - stop.ColorCatalogsItem = closestItem; + LogManager.Log(ex, "An error occurred while trying to get volume => RGB from conversion engine."); } - catch { } - - InvokeUI(() => DyeCommand.RaiseCanExecuteChanged()); - } - catch (Exception ex) - { - LogManager.Log(ex, "An error occurred while trying to get volume => RGB from conversion engine."); - } - - }); - + }); + } } } @@ -1050,7 +1027,7 @@ namespace Tango.PPC.Jobs.ViewModels var catalogItem = await NavigationManager.NavigateForResult<JobsModule, TwineCatalogView, ColorCatalogsItem, TwineCatalogNavigationObject>(new TwineCatalogNavigationObject() { SelectedItem = stop.ColorCatalogsItem, - Catalog = stop.ColorCatalog + Catalog = SelectedCatalog }, true); if (catalogItem != null) @@ -1321,9 +1298,9 @@ namespace Tango.PPC.Jobs.ViewModels { Thread.Sleep(500); - if (Job != null && Job.Rml.Cct != null && IsVisible) + if (Job != null && Job.Rml.Cct != null && IsVisible && (Job.ColorSpace != null && (Job.ColorSpace.Code == BL.Enumerations.ColorSpaces.RGB.ToInt32() || Job.ColorSpace.Code == BL.Enumerations.ColorSpaces.LAB.ToInt32()))) { - var brushStops = Job.Segments.SelectMany(x => x.BrushStops).Where(x => (x.BrushColorSpace == BL.Enumerations.ColorSpaces.LAB || x.BrushColorSpace == BL.Enumerations.ColorSpaces.RGB) && !x.Corrected && !x.OutOfGamutChecked).ToList(); + var brushStops = Job.Segments.SelectMany(x => x.BrushStops).Where(x => !x.Corrected && !x.OutOfGamutChecked).ToList(); foreach (var stop in brushStops) { @@ -1358,22 +1335,6 @@ namespace Tango.PPC.Jobs.ViewModels #endregion - #region Lubrication Level - - private void GetLubricationLevel() - { - if (Job != null) - { - LubricationLevel = Settings.LubricationLevels.FirstOrDefault(x => x.RmlGuid == Job.RmlGuid); - } - else - { - LubricationLevel = null; - } - } - - #endregion - #region Export Embroidery private async void ExportEmbroidery() diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs index fe831587c..64931cbe3 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs @@ -39,8 +39,6 @@ using Tango.Core.ExtensionMethods; using Tango.PPC.Common.Synchronization; using Tango.PPC.Jobs.NotificationItems; using Tango.PPC.Storage.Models; -using Tango.BL.Helpers; -using Tango.ColorConversion; namespace Tango.PPC.Jobs.ViewModels { @@ -316,11 +314,11 @@ namespace Tango.PPC.Jobs.ViewModels /// <param name="job">The job.</param> public async void SelectJob(Job job, bool directlyToEdit = false) { - //if (!ApplicationManager.IsInTechnicianMode && job.ColorSpace != null && job.ColorSpace.Code == ColorSpaces.Volume.ToInt32()) - //{ - // await NotificationProvider.ShowError("The selected job is supported only in technician mode."); - // return; - //} + if (!ApplicationManager.IsInTechnicianMode && job.ColorSpace != null && job.ColorSpace.Code == ColorSpaces.Volume.ToInt32()) + { + await NotificationProvider.ShowError("The selected job is supported only in technician mode."); + return; + } LogManager.Log($"Job '{job.Name}' selected."); @@ -740,7 +738,6 @@ namespace Tango.PPC.Jobs.ViewModels StorageProvider.RegisterFileHandler(ExplorerFileDefinition.Job.Extension, HandleJobFileLoaded); StorageProvider.RegisterFileHandler(ExplorerFileDefinition.ColorProfile.Extension, HandleColorProfileFileLoaded); StorageProvider.RegisterFileHandler(ExplorerFileDefinition.Pulse.Extension, HandlePulseFileLoaded); - StorageProvider.RegisterFileHandler(ExplorerFileDefinition.CsvFile.Extension, HandleCsvJobFileLoaded); //Load catalogs. using (ObservablesContext db = ObservablesContext.CreateDefault()) @@ -876,79 +873,6 @@ namespace Tango.PPC.Jobs.ViewModels #endregion - #region Handle CSV Job File Loading From Storage - - private async void HandleCsvJobFileLoaded(List<ExplorerFileItem> files) - { - var item = files.FirstOrDefault(); - if (item == null) return; - - var vm = new ImportCsvJobViewVM(); - vm.Name = Path.GetFileNameWithoutExtension(item.Name); - await vm.Init(); - await NotificationProvider.ShowDialog<ImportCsvJobViewVM>(vm); - - if (vm.DialogResult && vm.SelectedRml != null) - { - try - { - NotificationProvider.SetGlobalBusyMessage("Importing job from file..."); - - using (ObservablesContext db = ObservablesContext.CreateDefault()) - { - var segments = await SegmentsCsvHelper.FromFile(item.Path, MachineProvider.Machine, db); - - Job job = new Job(); - job.LastUpdated = DateTime.UtcNow; - job.JobSource = JobSource.Local; - job.Name = vm.Name; - job.NumberOfHeads = 1; - job.NumberOfUnits = 1; - job.SampleUnitsOrMeters = 1; - job.CreationDate = DateTime.UtcNow; - job.JobStatus = JobStatuses.Draft; - job.JobType = JobTypes.Knitting; - job.EnableLubrication = true; - job.MachineGuid = MachineProvider.Machine.Guid; - job.RmlGuid = vm.SelectedRml.Guid; - job.Machine = await new MachineBuilder(db).Set(job.MachineGuid).WithCats().WithConfiguration().BuildAsync(); - job.Rml = await new RmlBuilder(db).Set(job.RmlGuid).WithActiveParametersGroup().WithCAT(MachineProvider.Machine.Guid).WithCCT().WithLiquidFactors().BuildAsync(); - job.WindingMethodGuid = Adapter.WindingMethods.FirstOrDefault().Guid; - job.SpoolTypeGuid = Settings.DefaultSpoolTypeGuid != null ? Settings.DefaultSpoolTypeGuid : Adapter.SpoolTypes.FirstOrDefault().Guid; - - foreach (var segment in segments) - { - segment.Job = job; - job.Segments.Add(segment); - } - - IColorConverter converter = new DefaultColorConverter(); - - foreach (var stop in segments.SelectMany(x => x.BrushStops.Where(y => y.BrushColorSpace == ColorSpaces.Volume))) - { - var output = converter.Convert(stop, false); - var suggestion = output.CreateSingleSuggestion(); - stop.Color = suggestion.Color; - } - - db.Jobs.Add(job); - await db.SaveChangesAsync(); - LoadJobs(); - } - - NotificationProvider.ReleaseGlobalBusyMessage(); - } - catch (Exception ex) - { - NotificationProvider.ReleaseGlobalBusyMessage(); - LogManager.Log(ex, "Error importing job from CSV."); - await NotificationProvider.ShowError($"Error importing job from csv file.\n{ex.FlattenMessage()}"); - } - } - } - - #endregion - #region Handle TCC File Loading From Storage private async void HandleColorProfileFileLoaded(List<ExplorerFileItem> tccFiles) diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobSummeryView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobSummeryView.xaml index ddda98df9..4785805a6 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobSummeryView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobSummeryView.xaml @@ -92,7 +92,7 @@ </UniformGrid> </Grid> - <controls:JobSummeryViewer Height="40" Job="{Binding Job}" VerticalAlignment="Center" Margin="20 0" Grid.Row="2" /> + <controls:JobSummeryViewer Height="40" DataContext="{Binding Job}" VerticalAlignment="Center" Margin="20 0" Grid.Row="2" /> </Grid> </DockPanel> </Border> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml index 5d676c15d..6a94034db 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml @@ -51,7 +51,7 @@ <ItemsControl.ItemTemplate> <DataTemplate> <Border> - <touch:TouchNumericTextBox UpdateBindingOnlyWhenFocused="True" DisplayWatermarkHint="True" Width="50" Watermark="{Binding IdsPack.LiquidType.Name}" Margin="2 0" ValueChanged="OnLiquidVolumeFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Volume}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Minimum="0" Maximum="200" JoggingFactor="0.5" StringFormat="0.0" /> + <touch:TouchNumericTextBox DisplayWatermarkHint="True" Width="50" Watermark="{Binding IdsPack.LiquidType.Name,IsAsync=True}" Margin="2 0" ValueChanged="OnLiquidVolumeFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Volume}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Minimum="0" Maximum="200" JoggingFactor="0.5" StringFormat="0.0" /> </Border> </DataTemplate> </ItemsControl.ItemTemplate> @@ -65,34 +65,33 @@ <DataTemplate x:Key="RGB_Template" DataType="{x:Type entities:BrushStop}"> <UniformGrid Rows="1" Columns="3"> - <touch:TouchNumericTextBox UpdateBindingOnlyWhenFocused="True" Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Red}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" Maximum="255" /> - <touch:TouchNumericTextBox UpdateBindingOnlyWhenFocused="True" Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Green}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" Maximum="255" /> - <touch:TouchNumericTextBox UpdateBindingOnlyWhenFocused="True" Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Blue}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" Maximum="255" /> + <touch:TouchNumericTextBox Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Red}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" Maximum="255" /> + <touch:TouchNumericTextBox Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Green}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" Maximum="255" /> + <touch:TouchNumericTextBox Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Blue}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" Maximum="255" /> </UniformGrid> </DataTemplate> <DataTemplate x:Key="CMYK_Template" DataType="{x:Type entities:BrushStop}"> <UniformGrid Rows="1" Columns="4"> - <touch:TouchNumericTextBox UpdateBindingOnlyWhenFocused="True" Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Cyan,Converter={StaticResource OneToPercentConverter}}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Maximum="100" StringFormat="0" /> - <touch:TouchNumericTextBox UpdateBindingOnlyWhenFocused="True" Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Magenta,Converter={StaticResource OneToPercentConverter}}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Maximum="100" StringFormat="0" /> - <touch:TouchNumericTextBox UpdateBindingOnlyWhenFocused="True" Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Yellow,Converter={StaticResource OneToPercentConverter}}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Maximum="100" StringFormat="0" /> - <touch:TouchNumericTextBox UpdateBindingOnlyWhenFocused="True" Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Black,Converter={StaticResource OneToPercentConverter}}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Maximum="100" StringFormat="0" /> + <touch:TouchNumericTextBox Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Cyan,Converter={StaticResource OneToPercentConverter}}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Maximum="100" StringFormat="0" /> + <touch:TouchNumericTextBox Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Magenta,Converter={StaticResource OneToPercentConverter}}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Maximum="100" StringFormat="0" /> + <touch:TouchNumericTextBox Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Yellow,Converter={StaticResource OneToPercentConverter}}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Maximum="100" StringFormat="0" /> + <touch:TouchNumericTextBox Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Black,Converter={StaticResource OneToPercentConverter}}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Maximum="100" StringFormat="0" /> </UniformGrid> </DataTemplate> <DataTemplate x:Key="LAB_Template" DataType="{x:Type entities:BrushStop}"> <UniformGrid Rows="1" Columns="3"> - <touch:TouchNumericTextBox UpdateBindingOnlyWhenFocused="True" Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding L}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Minimum="0" Maximum="100" StringFormat="0.00" /> - <touch:TouchNumericTextBox UpdateBindingOnlyWhenFocused="True" Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding A}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Minimum="-128" Maximum="128" StringFormat="0.00" /> - <touch:TouchNumericTextBox UpdateBindingOnlyWhenFocused="True" Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding B}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Minimum="-128" Maximum="128" StringFormat="0.00" /> + <touch:TouchNumericTextBox Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding L}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Minimum="0" Maximum="100" StringFormat="0.00" /> + <touch:TouchNumericTextBox Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding A}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Minimum="-128" Maximum="128" StringFormat="0.00" /> + <touch:TouchNumericTextBox Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding B}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Minimum="-128" Maximum="128" StringFormat="0.00" /> </UniformGrid> </DataTemplate> <DataTemplate x:Key="CATALOG_Template" DataType="{x:Type entities:BrushStop}"> - <DockPanel Margin="0 0 -90 0"> - <touch:TouchComboBox DockPanel.Dock="Left" ItemsSource="{Binding ElementName=view,Path=DataContext.AvailableCatalogs}" SelectedItem="{Binding ColorCatalog}" DisplayMemberPath="Name" Title="Select Catalog" Width="130" Margin="0 0 10 0" /> + <DockPanel> <touch:TouchIconButton Margin="0 0 -50 -10" CornerRadius="50" Width="50" Height="50" Padding="13" RippleBrush="{StaticResource TangoRippleDarkBrush}" DockPanel.Dock="Right" Icon="Palette" Foreground="{StaticResource TangoPrimaryAccentBrush}" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.OpenCatalogCommand}" CommandParameter="{Binding}"></touch:TouchIconButton> - <touch:TouchAutoComplete Margin="2 0" ItemsSource="{Binding ColorCatalog.AllItemsOrdered}" Watermark="Color Code" PopupHeight="250" DisplayMemberPath="Name" AutoCompleteProvider="{Binding ElementName=view,Path=DataContext.CatalogAutoCompleteProvider}" SelectedItem="{Binding ColorCatalogsItem,Mode=TwoWay,ValidatesOnDataErrors=True,ValidatesOnNotifyDataErrors=True}" keyboard:KeyboardView.Container="{Binding ElementName=Container}"> + <touch:TouchAutoComplete Margin="2 0" ItemsSource="{Binding ElementName=view,Path=DataContext.CatalogItems}" Watermark="Color Code" PopupHeight="250" DisplayMemberPath="Name" AutoCompleteProvider="{Binding ElementName=view,Path=DataContext.CatalogAutoCompleteProvider}" SelectedItem="{Binding ColorCatalogsItem,Mode=TwoWay,ValidatesOnDataErrors=True,ValidatesOnNotifyDataErrors=True}" keyboard:KeyboardView.Container="{Binding ElementName=Container}"> <touch:TouchAutoComplete.ItemTemplate> <DataTemplate> <DockPanel Margin="2"> @@ -118,11 +117,11 @@ <Style TargetType="Border"> <Setter Property="Background"> <Setter.Value> - <SolidColorBrush Color="{Binding Color}" /> + <SolidColorBrush Color="{Binding Color,IsAsync=True}" /> </Setter.Value> </Setter> <Style.Triggers> - <DataTrigger Binding="{Binding IsTransparent}" Value="True" > + <DataTrigger Binding="{Binding IsTransparent,IsAsync=True}" Value="True" > <Setter Property="Background"> <Setter.Value> <ImageBrush ImageSource="{StaticResource Image_TransparentSmall}" Stretch="None" /> @@ -150,33 +149,44 @@ </Setter.Value> </Setter> <Style.Triggers> - <DataTrigger Binding="{Binding ColorSpace.Name}" Value="RGB"> + <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="RGB"> <Setter Property="ContentTemplate" Value="{StaticResource RGB_Template}" /> </DataTrigger> - <DataTrigger Binding="{Binding ColorSpace.Name}" Value="CMYK"> + <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="CMYK"> <Setter Property="ContentTemplate" Value="{StaticResource CMYK_Template}" /> </DataTrigger> - <DataTrigger Binding="{Binding ColorSpace.Name}" Value="LAB"> + <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="LAB"> <Setter Property="ContentTemplate" Value="{StaticResource LAB_Template}" /> </DataTrigger> - <DataTrigger Binding="{Binding ColorSpace.Name}" Value="Catalog"> + <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="Catalog"> <Setter Property="ContentTemplate" Value="{StaticResource CATALOG_Template}" /> </DataTrigger> - <DataTrigger Binding="{Binding ColorSpace.Name}" Value="Volume"> + <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="Volume"> <Setter Property="ContentTemplate" Value="{StaticResource Volume_Template}" /> </DataTrigger> + <DataTrigger Binding="{Binding IsTransparent,IsAsync=True}" Value="True"> + <Setter Property="ContentTemplate"> + <Setter.Value> + <DataTemplate> + <Grid Height="40"> + <TextBlock VerticalAlignment="Bottom" Foreground="{StaticResource TangoGrayBrush}">Transparent</TextBlock> + </Grid> + </DataTemplate> + </Setter.Value> + </Setter> + </DataTrigger> </Style.Triggers> </Style> </ContentControl.Style> </ContentControl> </DockPanel> - <Canvas Visibility="{Binding IsOutOfGamut,Converter={StaticResource BooleanToVisibilityConverter}}"> + <Canvas Visibility="{Binding IsOutOfGamut,IsAsync=True,Converter={StaticResource BooleanToVisibilityConverter}}"> <TextBlock Canvas.Top="2" Foreground="{StaticResource TangoErrorBrush}" FontSize="{StaticResource TangoSmallFontSize}" Text="Color is out of gamut. Modify color or select an alternative."></TextBlock> </Canvas> <DockPanel LastChildFill="False" Margin="0 20 0 0" IsEnabled="{Binding IsMiddle}"> - <controls:FastTextBlock VerticalAlignment="Bottom" DockPanel.Dock="Left">Position (m):</controls:FastTextBlock> + <TextBlock VerticalAlignment="Bottom" DockPanel.Dock="Left">Position (m):</TextBlock> <Grid Margin="20 0 0 0" Width="300" DockPanel.Dock="Right"> <Grid.ColumnDefinitions> <ColumnDefinition Width="1*" /> @@ -190,271 +200,280 @@ </StackPanel> <StackPanel Orientation="Horizontal" Margin="0 0 -130 0" HorizontalAlignment="Right" VerticalAlignment="Top"> - <StackPanel Orientation="Horizontal" Visibility="{Binding ElementName=toggleEdit,Path=IsChecked,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> - <!--<touch:TouchToggleIconButton Padding="15" Width="60" Height="60" CornerRadius="30" Icon="EyeOutline" CheckedIcon="EyeOffOutline" Foreground="{StaticResource TangoGrayBrush}" CheckedForeground="{StaticResource TangoGrayBrush}" IsChecked="{Binding IsTransparent}"></touch:TouchToggleIconButton>--> - <touch:TouchImageButton Command="{Binding ElementName=view,Path=DataContext.ReplaceBrushStopCommand}" CommandParameter="{Binding}" Visibility="{Binding ColorSpace,Converter={StaticResource ColorSpaceToVisibilityConverter}}" Width="50" Height="50" Padding="10" Image="{StaticResource Image_Replace_Color}" CornerRadius="30"></touch:TouchImageButton> + <StackPanel Orientation="Horizontal" Visibility="{Binding ElementName=toggleEdit,Path=IsChecked,IsAsync=True,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> + <!--<touch:TouchToggleIconButton Padding="15" Width="60" Height="60" CornerRadius="30" Icon="EyeOutline" CheckedIcon="EyeOffOutline" Foreground="{StaticResource TangoGrayBrush}" CheckedForeground="{StaticResource TangoGrayBrush}" IsChecked="{Binding IsTransparent,IsAsync=True}"></touch:TouchToggleIconButton>--> + <touch:TouchImageButton Command="{Binding ElementName=view,Path=DataContext.ReplaceBrushStopCommand,IsAsync=True}" CommandParameter="{Binding}" Visibility="{Binding ColorSpace,Converter={StaticResource ColorSpaceToVisibilityConverter},IsAsync=True}" Width="50" Height="50" Padding="10" Image="{StaticResource Image_Replace_Color}" CornerRadius="30"></touch:TouchImageButton> </StackPanel> - <touch:TouchIconButton Margin="0 0 50 0" Visibility="{Binding ElementName=toggleEdit,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter}}" Command="{Binding ElementName=view,Path=DataContext.RemoveBrushStopCommand}" CommandParameter="{Binding}" EnableDropShadow="False" Icon="TrashAltRegular" Padding="12" Foreground="{StaticResource TangoPrimaryAccentBrush}" Width="50" Height="50" RippleBrush="{StaticResource TangoRippleDarkBrush}" CornerRadius="30" /> + <touch:TouchIconButton Margin="0 0 50 0" Visibility="{Binding ElementName=toggleEdit,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter}}" Command="{Binding ElementName=view,Path=DataContext.RemoveBrushStopCommand,IsAsync=True}" CommandParameter="{Binding}" EnableDropShadow="False" Icon="TrashAltRegular" Padding="12" Foreground="{StaticResource TangoPrimaryAccentBrush}" Width="50" Height="50" RippleBrush="{StaticResource TangoRippleDarkBrush}" CornerRadius="30" /> </StackPanel> </Grid> </DataTemplate> <DataTemplate x:Key="Segment_Template" DataType="{x:Type entities:Segment}"> - <touch:TouchVirtualizedContentReplaceControl Margin="0 0 0 15" MinHeight="165" Disconnect="False"> - <touch:TouchVirtualizedContentReplaceControl.Content> - <DataTemplate> - <Border RenderOptions.EdgeMode="Unspecified" CornerRadius="8" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="1" BorderBrush="{StaticResource TangoGrayBrush}"> - <Grid> - <Grid.RowDefinitions> - <RowDefinition Height="Auto" /> - <RowDefinition Height="Auto" /> - </Grid.RowDefinitions> - <Grid Background="Transparent" dragAndDrop:DragAndDropService.DropCommand="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.SegmentDroppedCommand}" dragAndDrop:DragAndDropService.Draggable="True" dragAndDrop:DragAndDropService.Droppable="True" dragAndDrop:DragAndDropService.DraggingSurface="{Binding ElementName=DraggingSurface}"> - <Grid.Style> - <Style TargetType="Grid"> - <Setter Property="Opacity" Value="1"></Setter> + <touch:TouchVirtualizedContentControl Margin="0 0 0 15"> + <Border RenderOptions.EdgeMode="Unspecified" CornerRadius="8" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="1" BorderBrush="{StaticResource TangoGrayBrush}"> + <Border.CacheMode> + <BitmapCache RenderAtScale="1" SnapsToDevicePixels="True" /> + </Border.CacheMode> + <!--<Border.Effect> + <DropShadowEffect Opacity="0.5" Color="{StaticResource TangoDropShadowColor}" BlurRadius="10" ShadowDepth="15" /> + </Border.Effect>--> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + <Grid Background="Transparent" dragAndDrop:DragAndDropService.DropCommand="{Binding ElementName=view,Path=DataContext.SegmentDroppedCommand}" dragAndDrop:DragAndDropService.Draggable="True" dragAndDrop:DragAndDropService.Droppable="True" dragAndDrop:DragAndDropService.DraggingSurface="{Binding ElementName=DraggingSurface}"> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="Opacity" Value="1"></Setter> + <Style.Triggers> + <Trigger Property="dragAndDrop:DragAndDropService.IsDraggableOver" Value="True"> + <Setter Property="Opacity" Value="0.5"></Setter> + </Trigger> + </Style.Triggers> + </Style> + </Grid.Style> + <DockPanel> + <DockPanel.Style> + <Style TargetType="DockPanel"> + <Setter Property="Height" Value="163"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding ElementName=toggle_small_list,Path=IsChecked,IsAsync=True}" Value="True"> + <Setter Property="Height" Value="74"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </DockPanel.Style> + + <Border DockPanel.Dock="Left" BorderThickness="0 0 1 0" BorderBrush="{StaticResource TangoLightBorderBrush}"> + <Border.Background> + <ImageBrush ImageSource="{StaticResource Image_Transparent}" Stretch="None" /> + </Border.Background> + <Border.Style> + <Style TargetType="Border"> + <Setter Property="CornerRadius" Value="8 0 0 8"></Setter> + <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight,IsAsync=True}"></Setter> <Style.Triggers> - <Trigger Property="dragAndDrop:DragAndDropService.IsDraggableOver" Value="True"> - <Setter Property="Opacity" Value="0.5"></Setter> - </Trigger> + <DataTrigger Binding="{Binding ElementName=toggle_small_list,Path=IsChecked,IsAsync=True}" Value="True"> + <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight,Converter={StaticResource MathOperatorConverter},ConverterParameter='*2',IsAsync=True}"></Setter> + </DataTrigger> + <MultiDataTrigger> + <MultiDataTrigger.Conditions> + <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="True"></Condition> + <Condition Binding="{Binding ElementName=toggle_large_list,Path=IsChecked,IsAsync=True}" Value="True"></Condition> + </MultiDataTrigger.Conditions> + <Setter Property="CornerRadius" Value="8 0 0 0"></Setter> + </MultiDataTrigger> </Style.Triggers> </Style> - </Grid.Style> - <DockPanel> - <DockPanel.Style> - <Style TargetType="DockPanel"> - <Setter Property="Height" Value="163"></Setter> + </Border.Style> + <Border Background="{Binding SegmentBrush}"> + <Border.Style> + <Style TargetType="Border"> + <Setter Property="CornerRadius" Value="8 0 0 8"></Setter> + <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight,IsAsync=True}"></Setter> <Style.Triggers> - <DataTrigger Binding="{Binding ElementName=toggle_small_list,Path=IsChecked}" Value="True"> - <Setter Property="Height" Value="74"></Setter> + <DataTrigger Binding="{Binding ElementName=toggle_small_list,Path=IsChecked,IsAsync=True}" Value="True"> + <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight,Converter={StaticResource MathOperatorConverter},ConverterParameter='*2',IsAsync=True}"></Setter> </DataTrigger> + <MultiDataTrigger> + <MultiDataTrigger.Conditions> + <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="True"></Condition> + <Condition Binding="{Binding ElementName=toggle_large_list,Path=IsChecked,IsAsync=True}" Value="True"></Condition> + </MultiDataTrigger.Conditions> + <Setter Property="CornerRadius" Value="8 0 0 0"></Setter> + </MultiDataTrigger> </Style.Triggers> </Style> - </DockPanel.Style> + </Border.Style> + </Border> + </Border> - <Border DockPanel.Dock="Left" BorderThickness="0 0 1 0" BorderBrush="{StaticResource TangoLightBorderBrush}"> - <!--<Border.Background> - <ImageBrush ImageSource="{StaticResource Image_Transparent}" Stretch="None" /> - </Border.Background>--> - <Border.Style> - <Style TargetType="Border"> - <Setter Property="CornerRadius" Value="8 0 0 8"></Setter> - <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight}"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding ElementName=toggle_small_list,Path=IsChecked}" Value="True"> - <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight,Converter={StaticResource MathOperatorConverter},ConverterParameter='*2'}"></Setter> - </DataTrigger> - <MultiDataTrigger> - <MultiDataTrigger.Conditions> - <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter}}" Value="True"></Condition> - <Condition Binding="{Binding ElementName=toggle_large_list,Path=IsChecked}" Value="True"></Condition> - </MultiDataTrigger.Conditions> - <Setter Property="CornerRadius" Value="8 0 0 0"></Setter> - </MultiDataTrigger> - </Style.Triggers> - </Style> - </Border.Style> - <Border Background="{Binding SegmentBrush}"> - <Border.Style> - <Style TargetType="Border"> - <Setter Property="CornerRadius" Value="8 0 0 8"></Setter> - <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight}"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding ElementName=toggle_small_list,Path=IsChecked}" Value="True"> - <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight,Converter={StaticResource MathOperatorConverter},ConverterParameter='*2'}"></Setter> - </DataTrigger> - <MultiDataTrigger> - <MultiDataTrigger.Conditions> - <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter}}" Value="True"></Condition> - <Condition Binding="{Binding ElementName=toggle_large_list,Path=IsChecked}" Value="True"></Condition> - </MultiDataTrigger.Conditions> - <Setter Property="CornerRadius" Value="8 0 0 0"></Setter> - </MultiDataTrigger> - </Style.Triggers> - </Style> - </Border.Style> - </Border> - </Border> + <Grid> + <DockPanel Margin="30 0" VerticalAlignment="Center"> + <StackPanel DockPanel.Dock="Top" Orientation="Horizontal"> + <Canvas Visibility="{Binding HasOutOfGamutBrushStop,Converter={StaticResource BooleanToVisibilityConverter},IsAsync=True}"> + <Image Canvas.Left="-25" Canvas.Top="1" Source="{StaticResource Image_Out_Of_Gamut}" Width="19" Height="19" /> + </Canvas> + <TextBlock FontSize="{StaticResource TangoTitleFontSize}"> + <Run>Segment #</Run> + <Run Text="{Binding SegmentIndex,Mode=OneWay,IsAsync=True}"></Run> + </TextBlock> + </StackPanel> <Grid> - <DockPanel Margin="30 0" VerticalAlignment="Center"> - <StackPanel DockPanel.Dock="Top" Orientation="Horizontal"> - <Canvas Visibility="{Binding HasOutOfGamutBrushStop,Converter={StaticResource BooleanToVisibilityConverter}}"> - <Image Canvas.Left="-25" Canvas.Top="1" Source="{StaticResource Image_Out_Of_Gamut}" Width="19" Height="19" /> - </Canvas> - <DockPanel> - <controls:FastTextBlock FontSize="{StaticResource TangoTitleFontSize}">Segment #</controls:FastTextBlock> - <controls:FastTextBlock FontSize="{StaticResource TangoTitleFontSize}" Text="{Binding SegmentIndex,Mode=OneWay}"></controls:FastTextBlock> - </DockPanel> - </StackPanel> + <StackPanel Margin="0 30 0 0" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="300" Visibility="{Binding ElementName=toggle_large_list,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter},IsAsync=True}"> + <DockPanel LastChildFill="False"> + <DockPanel.Style> + <Style TargetType="DockPanel"> + <Setter Property="Visibility" Value="Visible"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="True"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </DockPanel.Style> + <TextBlock VerticalAlignment="Bottom" DockPanel.Dock="Left" Text="Color code:"></TextBlock> - <Grid> - <StackPanel Margin="0 5 0 0" HorizontalAlignment="Left" Width="300" Visibility="{Binding ElementName=toggle_large_list,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter}}"> - <DockPanel LastChildFill="False" Margin="0 0 0 0"> - <controls:FastTextBlock Text="Color space:" VerticalAlignment="Bottom"></controls:FastTextBlock> - <touch:TouchComboBox DockPanel.Dock="Right" ItemsSource="{Binding ElementName=view,Path=DataContext.ColorSpaces}" SelectedItem="{Binding BrushStops[0].ColorSpace}" DisplayMemberPath="Name" Title="Select Color Space" Width="179" HorizontalAlignment="Right" /> - </DockPanel> - <DockPanel LastChildFill="False" Margin="0 5 0 0"> - <DockPanel.Style> - <Style TargetType="DockPanel"> - <Setter Property="Visibility" Value="Visible"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding Converter={StaticResource IsSegmentGradientConverter}}" Value="True"> - <Setter Property="Visibility" Value="Collapsed"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </DockPanel.Style> - <controls:FastTextBlock VerticalAlignment="Bottom" DockPanel.Dock="Left" Text="Color code:"></controls:FastTextBlock> + <Grid DockPanel.Dock="Right" DataContext="{Binding BrushStops[0],IsAsync=True}"> + <StackPanel> + <ContentControl Focusable="False" FocusVisualStyle="{x:Null}" d:DataContext="{d:DesignInstance Type=entities:BrushStop, IsDesignTimeCreatable=False}" Content="{Binding}" Width="180"> + <ContentControl.Style> + <Style TargetType="ContentControl"> + <Setter Property="ContentTemplate"> + <Setter.Value> + <DataTemplate> - <Grid DockPanel.Dock="Right" DataContext="{Binding BrushStops[0]}"> - <StackPanel> - <ContentControl Focusable="False" FocusVisualStyle="{x:Null}" d:DataContext="{d:DesignInstance Type=entities:BrushStop, IsDesignTimeCreatable=False}" Content="{Binding}" Width="180"> - <ContentControl.Style> - <Style TargetType="ContentControl"> + </DataTemplate> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="RGB"> + <Setter Property="ContentTemplate" Value="{StaticResource RGB_Template}" /> + </DataTrigger> + <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="CMYK"> + <Setter Property="ContentTemplate" Value="{StaticResource CMYK_Template}" /> + </DataTrigger> + <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="LAB"> + <Setter Property="ContentTemplate" Value="{StaticResource LAB_Template}" /> + </DataTrigger> + <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="Catalog"> + <Setter Property="ContentTemplate" Value="{StaticResource CATALOG_Template}" /> + </DataTrigger> + <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="Volume"> + <Setter Property="ContentTemplate" Value="{StaticResource Volume_Template}" /> + </DataTrigger> + <DataTrigger Binding="{Binding IsTransparent,IsAsync=True}" Value="True"> <Setter Property="ContentTemplate"> <Setter.Value> <DataTemplate> - + <Grid Height="40"> + <TextBlock VerticalAlignment="Bottom" Foreground="{StaticResource TangoGrayBrush}">Transparent</TextBlock> + </Grid> </DataTemplate> </Setter.Value> </Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding ColorSpace.Name}" Value="RGB"> - <Setter Property="ContentTemplate" Value="{StaticResource RGB_Template}" /> - </DataTrigger> - <DataTrigger Binding="{Binding ColorSpace.Name}" Value="CMYK"> - <Setter Property="ContentTemplate" Value="{StaticResource CMYK_Template}" /> - </DataTrigger> - <DataTrigger Binding="{Binding ColorSpace.Name}" Value="LAB"> - <Setter Property="ContentTemplate" Value="{StaticResource LAB_Template}" /> - </DataTrigger> - <DataTrigger Binding="{Binding ColorSpace.Name}" Value="Catalog"> - <Setter Property="ContentTemplate" Value="{StaticResource CATALOG_Template}" /> - </DataTrigger> - <DataTrigger Binding="{Binding ColorSpace.Name}" Value="Volume"> - <Setter Property="ContentTemplate" Value="{StaticResource Volume_Template}" /> - </DataTrigger> - </Style.Triggers> - </Style> - </ContentControl.Style> - </ContentControl> - </StackPanel> - </Grid> - </DockPanel> - <Canvas> - <Canvas.Style> - <Style TargetType="Canvas"> - <Setter Property="Visibility" Value="Collapsed"></Setter> - <Style.Triggers> - <MultiDataTrigger> - <MultiDataTrigger.Conditions> - <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter}}" Value="False" /> - <Condition Binding="{Binding BrushStops[0].IsOutOfGamut}" Value="True" /> - </MultiDataTrigger.Conditions> - <Setter Property="Visibility" Value="Visible"></Setter> - </MultiDataTrigger> - </Style.Triggers> - </Style> - </Canvas.Style> - <TextBlock Canvas.Top="2" Foreground="{StaticResource TangoErrorBrush}" FontSize="{StaticResource TangoSmallFontSize}" Text="Color is out of gamut. Modify color or select an alternative."></TextBlock> - </Canvas> - <DockPanel LastChildFill="False" Margin="0 0 0 0"> - <controls:FastTextBlock VerticalAlignment="Bottom" DockPanel.Dock="Left" Text="Length (m):"></controls:FastTextBlock> - <touch:TouchNumericTextBox Width="180" DockPanel.Dock="Right" Value="{Binding Length}" StringFormat="0.0" AutoCalculateJogStep="False" HasDecimalPoint="True" Minimum="1" Maximum="100000" KeyboardContainer="{Binding ElementName=Container}" /> - </DockPanel> - </StackPanel> - </Grid> - </DockPanel> - - <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0 10 10 0"> - <TextBlock Visibility="{Binding ElementName=toggle_small_list,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter}}" HorizontalAlignment="Right" VerticalAlignment="Center" Text="{Binding Length,StringFormat={}{0:N1} m}"> - <TextBlock.Style> - <Style TargetType="TextBlock"> - <Setter Property="Margin" Value="0 16 20 0"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding ElementName=toggleEdit,Path=IsChecked}" Value="True"> - <Setter Property="Margin" Value="0 5 20 0"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </TextBlock.Style> - </TextBlock> - - <StackPanel Orientation="Horizontal"> - <StackPanel.Style> - <Style TargetType="StackPanel"> + </DataTrigger> + </Style.Triggers> + </Style> + </ContentControl.Style> + </ContentControl> + </StackPanel> + </Grid> + </DockPanel> + <Canvas> + <Canvas.Style> + <Style TargetType="Canvas"> <Setter Property="Visibility" Value="Collapsed"></Setter> <Style.Triggers> <MultiDataTrigger> <MultiDataTrigger.Conditions> - <Condition Binding="{Binding ElementName=toggleEdit,Path=IsChecked}" Value="False" /> - <Condition Binding="{Binding ElementName=toggle_large_list,Path=IsChecked}" Value="True" /> - <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter}}" Value="False" /> + <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="False" /> + <Condition Binding="{Binding BrushStops[0].IsOutOfGamut,IsAsync=True}" Value="True" /> </MultiDataTrigger.Conditions> <Setter Property="Visibility" Value="Visible"></Setter> </MultiDataTrigger> </Style.Triggers> </Style> - </StackPanel.Style> + </Canvas.Style> + <TextBlock Canvas.Top="2" Foreground="{StaticResource TangoErrorBrush}" FontSize="{StaticResource TangoSmallFontSize}" Text="Color is out of gamut. Modify color or select an alternative."></TextBlock> + </Canvas> + <DockPanel LastChildFill="False" Margin="0 20 0 0"> + <TextBlock VerticalAlignment="Bottom" DockPanel.Dock="Left" Text="Length (m):"></TextBlock> + <touch:TouchNumericTextBox Width="180" DockPanel.Dock="Right" Value="{Binding Length}" StringFormat="0.0" AutoCalculateJogStep="False" HasDecimalPoint="True" Minimum="1" Maximum="100000" KeyboardContainer="{Binding ElementName=Container}" /> + </DockPanel> + </StackPanel> + </Grid> + </DockPanel> - <!--<touch:TouchToggleIconButton Padding="15" Width="60" Height="60" CornerRadius="30" Icon="EyeOutline" CheckedIcon="EyeOffOutline" Foreground="{StaticResource TangoGrayBrush}" CheckedForeground="{StaticResource TangoGrayBrush}" IsChecked="{Binding BrushStops[0].IsTransparent}"></touch:TouchToggleIconButton>--> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0 10 10 0"> + <TextBlock Visibility="{Binding ElementName=toggle_small_list,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter},IsAsync=True}" HorizontalAlignment="Right" VerticalAlignment="Center" Text="{Binding Length,StringFormat={}{0:N1} m}"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Margin" Value="0 16 20 0"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding ElementName=toggleEdit,Path=IsChecked}" Value="True"> + <Setter Property="Margin" Value="0 5 20 0"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> - <touch:TouchImageButton Visibility="{Binding BrushStops[0].ColorSpace,Converter={StaticResource ColorSpaceToVisibilityConverter}}" Command="{Binding ElementName=view,Path=DataContext.ReplaceBrushStopCommand}" CommandParameter="{Binding BrushStops[0]}" Width="50" Height="50" Padding="10" Image="{StaticResource Image_Replace_Color}" CornerRadius="30"></touch:TouchImageButton> - </StackPanel> + <StackPanel Orientation="Horizontal"> + <StackPanel.Style> + <Style TargetType="StackPanel"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <MultiDataTrigger> + <MultiDataTrigger.Conditions> + <Condition Binding="{Binding ElementName=toggleEdit,Path=IsChecked,IsAsync=True}" Value="False" /> + <Condition Binding="{Binding ElementName=toggle_large_list,Path=IsChecked,IsAsync=True}" Value="True" /> + <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="False" /> + </MultiDataTrigger.Conditions> + <Setter Property="Visibility" Value="Visible"></Setter> + </MultiDataTrigger> + </Style.Triggers> + </Style> + </StackPanel.Style> - <StackPanel Visibility="{Binding ElementName=toggleEdit,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter}}" Orientation="Horizontal"> + <!--<touch:TouchToggleIconButton Padding="15" Width="60" Height="60" CornerRadius="30" Icon="EyeOutline" CheckedIcon="EyeOffOutline" Foreground="{StaticResource TangoGrayBrush}" CheckedForeground="{StaticResource TangoGrayBrush}" IsChecked="{Binding BrushStops[0].IsTransparent,IsAsync=True}"></touch:TouchToggleIconButton>--> - <touch:TouchIconButton Command="{Binding ElementName=view,Path=DataContext.RemoveSegmentCommand}" CommandParameter="{Binding}" EnableDropShadow="False" Icon="TrashAltRegular" Padding="12" Foreground="{StaticResource TangoPrimaryAccentBrush}" Width="50" Height="50" RippleBrush="{StaticResource TangoRippleDarkBrush}" CornerRadius="30" /> + <touch:TouchImageButton Visibility="{Binding BrushStops[0].ColorSpace,Converter={StaticResource ColorSpaceToVisibilityConverter},IsAsync=True}" Command="{Binding ElementName=view,Path=DataContext.ReplaceBrushStopCommand}" CommandParameter="{Binding BrushStops[0]}" Width="50" Height="50" Padding="10" Image="{StaticResource Image_Replace_Color}" CornerRadius="30"></touch:TouchImageButton> + </StackPanel> - <dragAndDrop:DragThumb Background="Transparent" IsHitTestVisible="True"> - <touch:TouchIconButton IsHitTestVisible="False" EnableDropShadow="False" Icon="BarsSolid" Padding="15" Foreground="{StaticResource TangoPrimaryAccentBrush}" Width="50" Height="50" RippleBrush="{StaticResource TangoRippleDarkBrush}" CornerRadius="30" /> - </dragAndDrop:DragThumb> - </StackPanel> - </StackPanel> - </Grid> - </DockPanel> + <StackPanel Visibility="{Binding ElementName=toggleEdit,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter},IsAsync=True}" Orientation="Horizontal"> + + <touch:TouchIconButton Command="{Binding ElementName=view,Path=DataContext.RemoveSegmentCommand}" CommandParameter="{Binding}" EnableDropShadow="False" Icon="TrashAltRegular" Padding="12" Foreground="{StaticResource TangoPrimaryAccentBrush}" Width="50" Height="50" RippleBrush="{StaticResource TangoRippleDarkBrush}" CornerRadius="30" /> + + <dragAndDrop:DragThumb Background="Transparent" IsHitTestVisible="True"> + <touch:TouchIconButton IsHitTestVisible="False" EnableDropShadow="False" Icon="BarsSolid" Padding="15" Foreground="{StaticResource TangoPrimaryAccentBrush}" Width="50" Height="50" RippleBrush="{StaticResource TangoRippleDarkBrush}" CornerRadius="30" /> + </dragAndDrop:DragThumb> + </StackPanel> + </StackPanel> </Grid> + </DockPanel> + </Grid> - <Border Grid.Row="1" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0 1 0 0"> - <Border.Style> - <Style TargetType="Border"> - <Setter Property="Visibility" Value="Collapsed"></Setter> - <Style.Triggers> - <MultiDataTrigger> - <MultiDataTrigger.Conditions> - <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter}}" Value="True"></Condition> - <Condition Binding="{Binding ElementName=toggle_large_list,Path=IsChecked}" Value="True"></Condition> - </MultiDataTrigger.Conditions> + <Border Grid.Row="1" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0 1 0 0"> + <Border.Style> + <Style TargetType="Border"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <MultiDataTrigger> + <MultiDataTrigger.Conditions> + <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="True"></Condition> + <Condition Binding="{Binding ElementName=toggle_large_list,Path=IsChecked,IsAsync=True}" Value="True"></Condition> + </MultiDataTrigger.Conditions> - <Setter Property="Visibility" Value="Visible"></Setter> - </MultiDataTrigger> - </Style.Triggers> - </Style> - </Border.Style> + <Setter Property="Visibility" Value="Visible"></Setter> + </MultiDataTrigger> + </Style.Triggers> + </Style> + </Border.Style> - <StackPanel> - <ItemsControl ItemsSource="{Binding BrushStops}" ItemTemplate="{StaticResource BrushStop_Template}"> + <StackPanel> + <ItemsControl ItemsSource="{Binding BrushStops}" ItemTemplate="{StaticResource BrushStop_Template}"> - </ItemsControl> + </ItemsControl> - <touch:TouchButton Command="{Binding ElementName=view,Path=DataContext.AddBrushStopCommand}" CommandParameter="{Binding}" Background="Transparent" RippleBrush="{StaticResource TangoRippleDarkBrush}" FontWeight="Normal" Foreground="{StaticResource TangoPrimaryAccentBrush}" HorizontalAlignment="Left" EnableDropShadow="False" Margin="50 30 0 60"> - <StackPanel Orientation="Horizontal"> - <Grid Width="49" Height="49"> - <Rectangle Stroke="{StaticResource TangoPrimaryAccentBrush}" StrokeThickness="1" StrokeDashArray="5 5 5 5" RadiusX="5" RadiusY="5"></Rectangle> - <fa:ImageAwesome Icon="Plus" Width="16" Height="16" Foreground="{StaticResource TangoPrimaryAccentBrush}" /> - </Grid> + <touch:TouchButton Command="{Binding ElementName=view,Path=DataContext.AddBrushStopCommand}" CommandParameter="{Binding}" Background="Transparent" RippleBrush="{StaticResource TangoRippleDarkBrush}" FontWeight="Normal" Foreground="{StaticResource TangoPrimaryAccentBrush}" HorizontalAlignment="Left" EnableDropShadow="False" Margin="50 30 0 60"> + <StackPanel Orientation="Horizontal"> + <Grid Width="49" Height="49"> + <Rectangle Stroke="{StaticResource TangoPrimaryAccentBrush}" StrokeThickness="1" StrokeDashArray="5 5 5 5" RadiusX="5" RadiusY="5"></Rectangle> + <fa:ImageAwesome Icon="Plus" Width="16" Height="16" Foreground="{StaticResource TangoPrimaryAccentBrush}" /> + </Grid> - <TextBlock VerticalAlignment="Center" Margin="20 0 0 0">ADD COLOR</TextBlock> - </StackPanel> - </touch:TouchButton> + <TextBlock VerticalAlignment="Center" Margin="20 0 0 0">ADD COLOR</TextBlock> </StackPanel> - </Border> - </Grid> + </touch:TouchButton> + </StackPanel> </Border> - </DataTemplate> - </touch:TouchVirtualizedContentReplaceControl.Content> - </touch:TouchVirtualizedContentReplaceControl> + </Grid> + </Border> + </touch:TouchVirtualizedContentControl> </DataTemplate> </UserControl.Resources> @@ -466,6 +485,11 @@ <touch:TouchLoadingPanel Grid.Row="1" IsLoading="{Binding IsBusy}"> <Grid> + + <Grid.CacheMode> + <BitmapCache RenderAtScale="1" SnapsToDevicePixels="False" /> + </Grid.CacheMode> + <Grid.RowDefinitions> <RowDefinition Height="1*"/> <RowDefinition Height="Auto"/> @@ -483,42 +507,29 @@ <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Job Details</TextBlock> <TextBlock FontWeight="Medium" Margin="50 0 0 0" VerticalAlignment="Center"> - <Run Text="{Binding Job.Rml.Name}"></Run> + <Run Text="{Binding Job.Rml.Name}"></Run><Run>,</Run> + <Run Text="{Binding Job.ColorSpace.Name}"></Run> </TextBlock> </StackPanel> </touch:TouchExpander.Header> <StackPanel Margin="60 30 60 20" TextElement.FontWeight="Medium"> - <StackPanel> + <controls:TableGrid RowHeight="50"> - <DockPanel> - <TextBlock Width="100" Margin="0 0 0 5" VerticalAlignment="Bottom">Job name:</TextBlock> - <touch:TouchTextBox Margin="10 0 0 0" Text="{Binding Job.Name,UpdateSourceTrigger=PropertyChanged,ValidatesOnDataErrors=True,ValidatesOnNotifyDataErrors=True}" KeyboardMode="AlphaNumeric" FocusSelectionMode="SelectAll" KeyboardAction="Next" KeyboardContainer="{Binding ElementName=Container}" /> - </DockPanel> + <TextBlock>Job name:</TextBlock> + <touch:TouchTextBox Text="{Binding Job.Name,UpdateSourceTrigger=PropertyChanged,ValidatesOnDataErrors=True,ValidatesOnNotifyDataErrors=True}" KeyboardMode="AlphaNumeric" FocusSelectionMode="SelectAll" KeyboardAction="Next" KeyboardContainer="{Binding ElementName=Container}" /> - <DockPanel Margin="0 15 0 0"> - <TextBlock Width="100" Margin="0 0 0 5" VerticalAlignment="Bottom">Customer:</TextBlock> - <touch:TouchAutoComplete Margin="10 0 0 0" ForceItemSelection="False" Text="{Binding CustomersFilter}" ItemsSource="{Binding Customers}" SelectedItem="{Binding Job.Customer}" DisplayMemberPath="Name" AutoCompleteProvider="{Binding CustomersAutoCompleteProvider}" KeyboardMode="AlphaNumeric" KeyboardAction="Next" KeyboardContainer="{Binding ElementName=Container}" /> - </DockPanel> + <TextBlock>Customer:</TextBlock> + <touch:TouchAutoComplete ForceItemSelection="False" Text="{Binding CustomersFilter}" ItemsSource="{Binding Customers}" SelectedItem="{Binding Job.Customer}" DisplayMemberPath="Name" AutoCompleteProvider="{Binding CustomersAutoCompleteProvider}" KeyboardMode="AlphaNumeric" KeyboardAction="Next" KeyboardContainer="{Binding ElementName=Container}" /> - <DockPanel Margin="0 15 0 0"> - <TextBlock Width="100" VerticalAlignment="Bottom" Margin="0 0 0 3">Thread type:</TextBlock> - <touch:TouchComboBox Margin="10 0 0 0" ItemsSource="{Binding Rmls}" SelectedItem="{Binding Job.Rml}" DisplayMemberPath="Name" Title="Select Thread" /> - </DockPanel> + <TextBlock>Thread type:</TextBlock> + <touch:TouchComboBox ItemsSource="{Binding Rmls}" SelectedItem="{Binding Job.Rml}" DisplayMemberPath="Name" Title="Select Thread" /> - <DockPanel Margin="110 5 0 0" TextElement.Foreground="{StaticResource TangoGrayTextBrush}" Visibility="{Binding LubricationLevel,Converter={StaticResource IsNullToVisibilityConverter}}"> - <touch:TouchIcon Icon="AlertCircleOutline" Width="16" Foreground="{StaticResource TangoGrayTextBrush}" /> - <TextBlock Margin="5 0 0 0"> - <Run Text="{Binding LubricationLevel.LubricationLevel,Mode=OneWay,Converter={StaticResource EnumToDescriptionConverter}}"></Run> - <Run>Lubrication</Run> - </TextBlock> - </DockPanel> + <TextBlock>Comment:</TextBlock> + <touch:TouchMultiLineTextBox Margin="20 0 0 -42" Text="{Binding Job.Description}" Height="60" keyboard:KeyboardView.Container="{Binding ElementName=Container}"> - <StackPanel Margin="0 35 0 0"> - <TextBlock>Comment:</TextBlock> - <touch:TouchMultiLineTextBox Margin="0 5 0 0" Text="{Binding Job.Description}" Height="60" keyboard:KeyboardView.Container="{Binding ElementName=Container}"></touch:TouchMultiLineTextBox> - </StackPanel> - </StackPanel> + </touch:TouchMultiLineTextBox> + </controls:TableGrid> <Grid HorizontalAlignment="Center" Margin="0 20 0 0" TextElement.Foreground="{StaticResource TangoGrayTextBrush}"> <Grid.ColumnDefinitions> @@ -716,11 +727,7 @@ <StackPanel Style="{StaticResource Level2ContainerExtraMargin}"> <Grid> - <touch:TouchVirtualizedContentReplaceControl MinHeight="40"> - <DataTemplate> - <localControls:JobSummeryViewer Job="{Binding Job}" Height="40" DisplayMarkers="False" /> - </DataTemplate> - </touch:TouchVirtualizedContentReplaceControl> + <localControls:JobSummeryViewer DataContext="{Binding Job,IsAsync=True}" Height="40"/> </Grid> <DockPanel Margin="0 30 0 0" LastChildFill="False"> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs index f4bbf6da3..20cfd6bf4 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs @@ -18,7 +18,6 @@ using Tango.Core.ExtensionMethods; using Tango.PPC.Common; using Tango.PPC.Common.Connection; using Tango.PPC.Common.ExternalBridge; -using Tango.PPC.Common.Lubrication; using Tango.PPC.Common.Messages; using Tango.PPC.Common.OS; using Tango.PPC.Common.UWF; @@ -36,36 +35,6 @@ namespace Tango.PPC.MachineSettings.ViewModels private TimeZoneInfo _previousTimeZone; private bool _previousEnableUWF; - #region Classes - - public class RmlLubricationLevelSettings : RmlLubricationLevel - { - public String Name { get; set; } - - public RmlLubricationLevelSettings() - { - - } - - public RmlLubricationLevelSettings(RmlLubricationLevel rmlLevel, String name) - { - RmlGuid = rmlLevel.RmlGuid; - LubricationLevel = rmlLevel.LubricationLevel; - Name = name; - } - - public RmlLubricationLevel ToRmlLubricationLevel() - { - return new RmlLubricationLevel() - { - RmlGuid = RmlGuid, - LubricationLevel = LubricationLevel, - }; - } - } - - #endregion - #region Properties [TangoInject] @@ -220,12 +189,6 @@ namespace Tango.PPC.MachineSettings.ViewModels set { _enableUWF = value; RaisePropertyChangedAuto(); } } - private List<RmlLubricationLevelSettings> _lubricationLevels; - public List<RmlLubricationLevelSettings> LubricationLevels - { - get { return _lubricationLevels; } - set { _lubricationLevels = value; RaisePropertyChangedAuto(); } - } #endregion @@ -250,7 +213,6 @@ namespace Tango.PPC.MachineSettings.ViewModels public MainViewVM() { - LubricationLevels = new List<RmlLubricationLevelSettings>(); SaveCommand = new RelayCommand(Save); DiscardCommand = new RelayCommand(Discard); SynchronizeCommand = new RelayCommand(Synchronize, () => !MachineDataSynchronizer.IsSynchronizing && IsFree); @@ -281,7 +243,6 @@ namespace Tango.PPC.MachineSettings.ViewModels Settings.SynchronizeJobs = SynchronizeJobs; Settings.SynchronizeDiagnostics = SynchronizeDiagnostics; Settings.AutoCheckForUpdates = AutoCheckForUpdates; - Settings.LubricationLevels = LubricationLevels.Where(x => x.LubricationLevel != LubricationLevel.Standard).Select(x => x.ToRmlLubricationLevel()).ToList(); MachineDataSynchronizer.IsEnabled = SynchronizeJobs || SynchronizeDiagnostics; @@ -407,7 +368,7 @@ namespace Tango.PPC.MachineSettings.ViewModels SelectedJobTypes = new SelectedObjectCollection<JobTypes>(Enum.GetValues(typeof(JobTypes)).Cast<JobTypes>().ToObservableCollection(), Settings.SupportedJobTypes.ToObservableCollection()); SelectedColorSpaces = new SelectedObjectCollection<ColorSpaces>(Enum.GetValues(typeof(ColorSpaces)).Cast<ColorSpaces>().Where(x => x.IsUserSpace()).ToObservableCollection(), Settings.SupportedColorSpaces.ToObservableCollection()); - DefaultRML = Rmls.SingleOrDefault(x => x.Guid == Settings.DefaultRmlGuid); + DefaultRML = Adapter.Rmls.SingleOrDefault(x => x.Guid == Settings.DefaultRmlGuid); DefaultSpoolType = Adapter.SpoolTypes.SingleOrDefault(x => x.Guid == Settings.DefaultSpoolTypeGuid); SynchronizeJobs = Settings.SynchronizeJobs; @@ -427,29 +388,6 @@ namespace Tango.PPC.MachineSettings.ViewModels { LogManager.Log(ex, "Error getting UWF status."); } - - try - { - List<RmlLubricationLevelSettings> levels = new List<RmlLubricationLevelSettings>(); - - foreach (var rml in Rmls) - { - RmlLubricationLevel userLevel = Settings.LubricationLevels.FirstOrDefault(x => x.RmlGuid == rml.Guid); - - RmlLubricationLevelSettings rmlLevel = new RmlLubricationLevelSettings(); - rmlLevel.RmlGuid = rml.Guid; - rmlLevel.Name = rml.Name; - rmlLevel.LubricationLevel = userLevel != null ? userLevel.LubricationLevel : LubricationLevel.Standard; - - levels.Add(rmlLevel); - } - - LubricationLevels = levels; - } - catch (Exception ex) - { - LogManager.Log(ex, "Error loading lubrication levels."); - } } private async void OnEnableRemoteAssistanceChanged() 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 d105278e6..ba3516be4 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 @@ -6,28 +6,17 @@ xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL" xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" xmlns:keyboard="clr-namespace:Tango.Touch.Keyboard;assembly=Tango.Touch" - xmlns:sys="clr-namespace:System;assembly=mscorlib" + xmlns:sys="clr-namespace:System.Collections;assembly=mscorlib" xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:vm="clr-namespace:Tango.PPC.MachineSettings.ViewModels" xmlns:connectivity="clr-namespace:Tango.PPC.Common.Connectivity;assembly=Tango.PPC.Common" xmlns:adapters="clr-namespace:Tango.Transport.Adapters;assembly=Tango.Transport" xmlns:global="clr-namespace:Tango.PPC.MachineSettings" xmlns:integrationPMR="clr-namespace:Tango.PMR.Integration;assembly=Tango.PMR" - xmlns:lubrication="clr-namespace:Tango.PPC.Common.Lubrication;assembly=Tango.PPC.Common" xmlns:local="clr-namespace:Tango.PPC.MachineSettings.Views" mc:Ignorable="d" d:DesignHeight="4500" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> - <UserControl.Resources> - <ObjectDataProvider x:Key="lubricationLevels" MethodName="GetValues" - ObjectType="{x:Type sys:Enum}"> - <ObjectDataProvider.MethodParameters> - <x:Type TypeName="lubrication:LubricationLevel"/> - </ObjectDataProvider.MethodParameters> - </ObjectDataProvider> - </UserControl.Resources> - - <Grid Background="{StaticResource TangoMidBackgroundBrush}" IsEnabled="{Binding IsFree}"> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> @@ -171,41 +160,6 @@ </StackPanel> </touch:TouchExpander> - <!--LUBRICATION--> - <touch:TouchExpander Margin="0 20 0 0" Header="Lubrication Levels" IsExpanded="True" FontSize="{StaticResource TangoExpanderHeaderFontSize}"> - <StackPanel Margin="20 0 20 40"> - <StackPanel Margin="0 40 0 0"> - <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Foreground="{StaticResource TangoGrayTextBrush}">Thread Type</TextBlock> - <touch:TouchComboBox x:Name="lubricationCombo" Margin="0 5 0 0" ItemsSource="{Binding LubricationLevels}" DisplayMemberPath="Name"></touch:TouchComboBox> - </StackPanel> - - <StackPanel Margin="0 20 0 0"> - <TextBlock Foreground="{StaticResource TangoGrayTextBrush}" FontSize="{StaticResource TangoSmallFontSize}" HorizontalAlignment="Center">Level</TextBlock> - <ListBox Margin="0 10 0 0" FontSize="{StaticResource TangoSmallFontSize}" ItemsSource="{Binding Source={StaticResource lubricationLevels}}" SelectedItem="{Binding ElementName=lubricationCombo,Path=SelectedItem.LubricationLevel}" Style="{StaticResource BlankListBox}"> - <ListBox.ItemsPanel> - <ItemsPanelTemplate> - <UniformGrid Columns="5" /> - </ItemsPanelTemplate> - </ListBox.ItemsPanel> - <ListBox.ItemContainerStyle> - <Style TargetType="ListBoxItem" BasedOn="{StaticResource BlankListBoxItem}"> - <Setter Property="ContentTemplate"> - <Setter.Value> - <DataTemplate> - <StackPanel Background="Transparent"> - <touch:TouchRadioButton HorizontalAlignment="Center" Margin="0 0 -8 0" IsChecked="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected}"></touch:TouchRadioButton> - <TextBlock Text="{Binding Converter={StaticResource EnumToDescriptionConverter}}" Margin="0 5 0 0" HorizontalAlignment="Center"></TextBlock> - </StackPanel> - </DataTemplate> - </Setter.Value> - </Setter> - </Style> - </ListBox.ItemContainerStyle> - </ListBox> - </StackPanel> - </StackPanel> - </touch:TouchExpander> - <!--REMOTE ASSISTANCE--> <touch:TouchExpander Margin="0 20 0 0" Header="Remote Assistance" IsExpanded="True" FontSize="{StaticResource TangoExpanderHeaderFontSize}"> <StackPanel> |
