diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-07-24 16:59:20 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-07-24 16:59:20 +0300 |
| commit | 3d1002b25ebc05c88336dc56ec03f627fd49d200 (patch) | |
| tree | 0a97f20cfd0acf25f354554fd1790f072b3aac8d /Software/Visual_Studio/PPC | |
| parent | 615311366218b9db2cdf5067b207743f41e95b8d (diff) | |
| download | Tango-3d1002b25ebc05c88336dc56ec03f627fd49d200.tar.gz Tango-3d1002b25ebc05c88336dc56ec03f627fd49d200.zip | |
Fixed issue with light touch scroll viewer.
Implemented PPC color fine tuning.
Diffstat (limited to 'Software/Visual_Studio/PPC')
14 files changed, 834 insertions, 72 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/FineTuningPaletteView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/FineTuningPaletteView.xaml new file mode 100644 index 000000000..cbec4afd8 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/FineTuningPaletteView.xaml @@ -0,0 +1,115 @@ +<UserControl x:Class="Tango.PPC.Jobs.Dialogs.FineTuningPaletteView" + 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:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:hive="clr-namespace:Tango.Hive;assembly=Tango.Hive" + xmlns:local="clr-namespace:Tango.PPC.Jobs.Dialogs" + mc:Ignorable="d" + d:DesignHeight="800" d:DesignWidth="600" Background="{StaticResource TangoPrimaryBackgroundBrush}" d:DataContext="{d:DesignInstance Type=local:FineTuningPaletteViewVM, IsDesignTimeCreatable=False}"> + <Grid> + <DockPanel Margin="20"> + <StackPanel DockPanel.Dock="Top"> + <TextBlock FontSize="{StaticResource TangoMessageBoxTitleFontSize}">Fine Tuning Palette</TextBlock> + <TextBlock Margin="0 30 0 0">Choose fine tuning palette:</TextBlock> + + <touch:TouchFlatListBox Margin="50 40 50 0" ItemsSource="{Binding Suggestions}" SelectedItem="{Binding SelectedSuggestion}" IsEnabled="False"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <UniformGrid Columns="{Binding Suggestions.Count}"></UniformGrid> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + + <ItemsControl.ItemTemplate> + <DataTemplate> + <ContentControl Width="70" Height="70" Margin="50 0"> + <ContentControl.Style> + <Style TargetType="ContentControl"> + <Setter Property="Content"> + <Setter.Value> + <Ellipse Width="70" Height="70" Fill="{Binding Brush}" HorizontalAlignment="Center"> + <Ellipse.Effect> + <DropShadowEffect Color="{StaticResource TangoDropShadowColor}" ShadowDepth="10" Direction="10" BlurRadius="15" Opacity="1" /> + </Ellipse.Effect> + </Ellipse> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected}" Value="True"> + <Setter Property="Content"> + <Setter.Value> + <Grid> + <Ellipse Fill="{Binding Brush}" Width="60" Height="60"></Ellipse> + <Ellipse Stroke="{StaticResource TangoDarkForegroundBrush}" Margin="-1" StrokeThickness="3" StrokeDashArray="2" Visibility="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected,Converter={StaticResource BooleanToVisibilityConverter}}"></Ellipse> + </Grid> + </Setter.Value> + </Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </ContentControl.Style> + </ContentControl> + </DataTemplate> + </ItemsControl.ItemTemplate> + </touch:TouchFlatListBox> + + <ItemsControl Margin="0 40 0 0" ItemsSource="{Binding Suggestions}" Height="20"> + <ItemsControl.Clip> + <RectangleGeometry RadiusX="10" RadiusY="10"> + <RectangleGeometry.Rect> + <MultiBinding Converter="{StaticResource WidthHeightToRectConverter}"> + <Binding RelativeSource="{RelativeSource AncestorType=ItemsControl}" Path="ActualWidth"></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=ItemsControl}" Path="ActualHeight"></Binding> + </MultiBinding> + </RectangleGeometry.Rect> + </RectangleGeometry> + </ItemsControl.Clip> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <UniformGrid Columns="{Binding Suggestions.Count}"></UniformGrid> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <Rectangle Fill="{Binding Brush}"></Rectangle> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + + </StackPanel> + + <DockPanel DockPanel.Dock="Bottom" LastChildFill="False"> + <touch:TouchButton DockPanel.Dock="Left" Command="{Binding CloseCommand}" CornerRadius="25" Style="{StaticResource TangoHollowButton}" Width="170" Height="50"> + CANCEL + </touch:TouchButton> + <touch:TouchButton DockPanel.Dock="Right" Command="{Binding OKCommand}" CornerRadius="25" Style="{StaticResource TangoHollowButton}" Width="170" Height="50"> + OK + </touch:TouchButton> + </DockPanel> + + <hive:HexList Width="340" Height="460" Margin="0 40 0 0" RowCount="6" ColumnCount="5" ItemsSource="{Binding HiveSuggestions}" SelectedItem="{Binding SelectedHiveSuggestion,Mode=TwoWay}"> + <hive:HexList.ItemContainerStyle> + <Style TargetType="ListBoxItem"> + <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter> + <Setter Property="VerticalContentAlignment" Value="Stretch"></Setter> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="Grid.Column" Value="{Binding Path=Column}"></Setter> + <Setter Property="Grid.Row" Value="{Binding Path=Row}"></Setter> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="ListBoxItem"> + <Grid Margin="10"> + <Ellipse Fill="{Binding Brush}"></Ellipse> + <Ellipse Stroke="{StaticResource TangoDarkForegroundBrush}" Margin="-4" StrokeThickness="3" StrokeDashArray="2" Visibility="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected,Converter={StaticResource BooleanToVisibilityConverter}}"></Ellipse> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + </hive:HexList.ItemContainerStyle> + </hive:HexList> + + </DockPanel> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/FineTuningPaletteView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/FineTuningPaletteView.xaml.cs new file mode 100644 index 000000000..258bb31fa --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/FineTuningPaletteView.xaml.cs @@ -0,0 +1,28 @@ +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 FineTuningPaletteView.xaml + /// </summary> + public partial class FineTuningPaletteView : UserControl + { + public FineTuningPaletteView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/FineTuningPaletteViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/FineTuningPaletteViewVM.cs new file mode 100644 index 000000000..d9554575e --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/FineTuningPaletteViewVM.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.ColorConversion; +using Tango.BL.Entities; +using Tango.PPC.Jobs.Models; +using Tango.SharedUI; + +namespace Tango.PPC.Jobs.Dialogs +{ + public class FineTuningPaletteViewVM : DialogViewVM + { + private Job _job; + private bool _prevent_change; + + private List<ColorConversionSuggestion> _suggestions; + public List<ColorConversionSuggestion> Suggestions + { + get { return _suggestions; } + set { _suggestions = value; RaisePropertyChangedAuto(); } + } + + private List<ColorConversionSuggestion> _hiveSuggestions; + public List<ColorConversionSuggestion> HiveSuggestions + { + get { return _hiveSuggestions; } + set { _hiveSuggestions = value; RaisePropertyChangedAuto(); } + } + + private ColorConversionSuggestion _selectedHiveSuggestion; + public ColorConversionSuggestion SelectedHiveSuggestion + { + get { return _selectedHiveSuggestion; } + set { _selectedHiveSuggestion = value; RaisePropertyChangedAuto(); OnSelectedHiveSuggestionChanged(); } + } + + private ColorConversionSuggestion _selectedSuggestion; + public ColorConversionSuggestion SelectedSuggestion + { + get { return _selectedSuggestion; } + set { _selectedSuggestion = value; RaisePropertyChangedAuto(); } + } + + public FineTuningPaletteViewVM() + { + Suggestions = new List<ColorConversionSuggestion>(); + HiveSuggestions = new List<ColorConversionSuggestion>(); + } + + private void OnSelectedHiveSuggestionChanged() + { + if (!_prevent_change) + { + Suggestions = TangoColorConverter.CreateTrippletSuggestions(TangoColorConverter.GetSuggestions(_job, SelectedHiveSuggestion.Color)); + SelectedSuggestion = Suggestions[Suggestions.Count / 2]; + } + } + + public FineTuningPaletteViewVM(FineTuneItem fineTuneItem, Job job) : this() + { + _prevent_change = true; + _job = job; + Suggestions = fineTuneItem.Suggestions; + HiveSuggestions = fineTuneItem.HiveSuggestions; + SelectedHiveSuggestion = HiveSuggestions.GetCenterSuggestion(); + SelectedSuggestion = Suggestions[Suggestions.Count / 2]; + _prevent_change = false; + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/JobView/color-fine-tuning.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/JobView/color-fine-tuning.png Binary files differnew file mode 100644 index 000000000..5b8201eef --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/JobView/color-fine-tuning.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/JobView/color-picker.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/JobView/color-picker.png Binary files differnew file mode 100644 index 000000000..e09d23190 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/JobView/color-picker.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Models/FineTuneItem.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Models/FineTuneItem.cs new file mode 100644 index 000000000..195410d2c --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Models/FineTuneItem.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.ColorConversion; +using Tango.BL.Entities; +using Tango.Core; +using Tango.PMR.ColorLab; + +namespace Tango.PPC.Jobs.Models +{ + public class FineTuneItem : ExtendedObject + { + public event Action SelectedChanged; + + public List<BrushStop> BrushStops { get; set; } + + private List<ColorConversionSuggestion> _suggestions; + public List<ColorConversionSuggestion> Suggestions + { + get { return _suggestions; } + set { _suggestions = value; RaisePropertyChangedAuto(); } + } + + private List<ColorConversionSuggestion> _hiveSuggestions; + public List<ColorConversionSuggestion> HiveSuggestions + { + get { return _hiveSuggestions; } + set { _hiveSuggestions = value; RaisePropertyChangedAuto(); } + } + + private bool _isSelected; + public bool IsSelected + { + get { return _isSelected; } + set { _isSelected = value; RaisePropertyChangedAuto(); SelectedChanged?.Invoke(); } + } + + private ColorConversionSuggestion _selectedSuggestion; + public ColorConversionSuggestion SelectedSuggestion + { + get { return _selectedSuggestion; } + set { _selectedSuggestion = value; RaisePropertyChangedAuto(); } + } + + private ColorConversionSuggestion _selectedHiveSuggestion; + public ColorConversionSuggestion SelectedHiveSuggestion + { + get { return _selectedHiveSuggestion; } + set { _selectedHiveSuggestion = value; RaisePropertyChangedAuto(); } + } + + public FineTuneItem() + { + Suggestions = new List<ColorConversionSuggestion>(); + BrushStops = new List<BrushStop>(); + } + + public FineTuneItem(ConversionOutput conversionOutput) : this() + { + Suggestions = TangoColorConverter.CreateTrippletSuggestions(conversionOutput); + HiveSuggestions = TangoColorConverter.CreateHiveSuggestions(conversionOutput); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NavigationObjects/JobNavigationObject.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NavigationObjects/JobNavigationObject.cs index 1807f8294..30edee34a 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NavigationObjects/JobNavigationObject.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/NavigationObjects/JobNavigationObject.cs @@ -17,5 +17,6 @@ namespace Tango.PPC.Jobs.NavigationObjects { Default, SampleDye, + FineTuning, } } 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 3a7ac381d..3c63513f1 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,6 +92,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Dialogs\FineTuningPaletteView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Dialogs\JobTypePickerView.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -157,6 +161,10 @@ <DependentUpon>BasicColorCorrectionView.xaml</DependentUpon> </Compile> <Compile Include="Dialogs\BasicColorCorrectionViewVM.cs" /> + <Compile Include="Dialogs\FineTuningPaletteView.xaml.cs"> + <DependentUpon>FineTuningPaletteView.xaml</DependentUpon> + </Compile> + <Compile Include="Dialogs\FineTuningPaletteViewVM.cs" /> <Compile Include="Dialogs\JobTypePickerView.xaml.cs"> <DependentUpon>JobTypePickerView.xaml</DependentUpon> </Compile> @@ -166,6 +174,7 @@ <Compile Include="Messages\JobRemovedMessage.cs" /> <Compile Include="Messages\JobSavedMessage.cs" /> <Compile Include="Messages\JobSelectedMessage.cs" /> + <Compile Include="Models\FineTuneItem.cs" /> <Compile Include="NavigationObjects\JobNavigationObject.cs" /> <Compile Include="Properties\AssemblyInfo.cs"> <SubType>Code</SubType> @@ -334,6 +343,12 @@ <ItemGroup> <Folder Include="Images\NotificationItems\" /> </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\color-fine-tuning.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\color-picker.png" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewContracts/IJobView.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewContracts/IJobView.cs index 345dced81..36630bffa 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewContracts/IJobView.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewContracts/IJobView.cs @@ -10,5 +10,6 @@ namespace Tango.PPC.Jobs.ViewContracts public interface IJobView : IPPCView { void DisplaySampleDye(); + void DisplayFineTuning(); } } 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 f3e7711f9..023d91531 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 @@ -25,6 +25,8 @@ using Tango.SharedUI.Helpers; using Tango.PPC.Common.Navigation; using Tango.PPC.Jobs.NavigationObjects; using Tango.PPC.Jobs.ViewContracts; +using System.Collections.ObjectModel; +using Tango.PPC.Jobs.Models; namespace Tango.PPC.Jobs.ViewModels { @@ -39,19 +41,10 @@ namespace Tango.PPC.Jobs.ViewModels private Thread _check_gamut_thread; private Job _job_to_load; private JobNavigationIntent _job_to_load_intent; + private static Dictionary<String, List<FineTuneItem>> _jobs_fine_tune_items; #region Properties - private BL.Enumerations.JobStatuses _jobStatus; - /// <summary> - /// Gets or sets the temporary job status. - /// </summary> - public BL.Enumerations.JobStatuses JobStatus - { - get { return _jobStatus; } - set { _jobStatus = value; RaisePropertyChangedAuto(); } - } - private Job _job; /// <summary> /// Gets or sets the selected job. @@ -131,6 +124,46 @@ namespace Tango.PPC.Jobs.ViewModels /// </summary> public AutoCompleteProvider<Customer> CustomersAutoCompleteProvider { get; set; } + private ObservableCollection<FineTuneItem> _fineTuneItems; + /// <summary> + /// Gets or sets the fine tune items. + /// </summary> + public ObservableCollection<FineTuneItem> FineTuneItems + { + get { return _fineTuneItems; } + set { _fineTuneItems = value; RaisePropertyChangedAuto(); } + } + + private ObservableCollection<FineTuneItem> _approvalFineTuneItems; + /// <summary> + /// Gets or sets the fine tune items. + /// </summary> + public ObservableCollection<FineTuneItem> ApprovalFineTuneItems + { + get { return _approvalFineTuneItems; } + set { _approvalFineTuneItems = value; RaisePropertyChangedAuto(); } + } + + private bool _isFineTuneExpanded; + /// <summary> + /// Gets or sets a value indicating whether the fine tuning region is expanded. + /// </summary> + public bool IsFineTuneExpanded + { + get { return _isFineTuneExpanded; } + set + { + _isFineTuneExpanded = value; + RaisePropertyChangedAuto(); + + if (_isFineTuneExpanded) + { + SyncFineTuneItemsToBrushStops(); + } + } + } + + #endregion #region Commands @@ -214,17 +247,54 @@ namespace Tango.PPC.Jobs.ViewModels /// Gets or sets another sample command. /// </summary> public RelayCommand AnotherSampleCommand { get; set; } + + /// <summary> + /// Gets or sets the invoke fine tuning palette command. + /// </summary> + public RelayCommand<FineTuneItem> InvokeFineTuningPaletteCommand { get; set; } + + /// <summary> + /// Gets or sets the reset fine tuning command. + /// </summary> + public RelayCommand ResetFineTuningCommand { get; set; } + + /// <summary> + /// Gets or sets the start fine tuning command. + /// </summary> + public RelayCommand StartFineTuningCommand { get; set; } + + /// <summary> + /// Gets or sets the approve fine tuning command. + /// </summary> + public RelayCommand ApproveFineTuningCommand { get; set; } + + /// <summary> + /// Gets or sets the repeat fine tuning command. + /// </summary> + public RelayCommand RepeatFineTuningCommand { get; set; } + #endregion #region Constructors /// <summary> + /// Initializes the <see cref="JobViewVM"/> class. + /// </summary> + static JobViewVM() + { + _jobs_fine_tune_items = new Dictionary<string, List<FineTuneItem>>(); + } + + /// <summary> /// Initializes a new instance of the <see cref="JobViewVM"/> class. /// </summary> public JobViewVM() { RegisterForMessage<JobSelectedMessage>(HandleJobSelectedMessage); + FineTuneItems = new ObservableCollection<FineTuneItem>(); + ApprovalFineTuneItems = new ObservableCollection<FineTuneItem>(); + CustomersAutoCompleteProvider = new AutoCompleteProvider<Customer>((customer, filter) => { return customer.Name.ToLower().StartsWith(filter != null ? filter.ToLower() : String.Empty); @@ -268,6 +338,11 @@ namespace Tango.PPC.Jobs.ViewModels ApproveSampleCommand = new RelayCommand(ApproveSampleDye); RepeatSampleDyeCommand = new RelayCommand(RepeatSampleDye); AnotherSampleCommand = new RelayCommand(DyeAnotherSample); + InvokeFineTuningPaletteCommand = new RelayCommand<FineTuneItem>(InvokeFineTuningPalette); + ResetFineTuningCommand = new RelayCommand(ResetFineTuning); + StartFineTuningCommand = new RelayCommand(StartFineTuning, () => FineTuneItems.Any(x => x.IsSelected)); + RepeatFineTuningCommand = new RelayCommand(RepeatFineTuning); + ApproveFineTuningCommand = new RelayCommand(ApproveFineTuning); } #endregion @@ -275,15 +350,62 @@ namespace Tango.PPC.Jobs.ViewModels #region Job Management /// <summary> - /// Saves the job. + /// Loads the job. /// </summary> - private async void SaveJob(bool displayNotification = true) + private async void LoadJob() { - if (JobStatus != BL.Enumerations.JobStatuses.Draft) + if (!(_job_to_load == null || (_job_to_load != null && Job != null && _job_to_load.Guid == Job.Guid))) + { + NotificationProvider.SetGlobalBusyMessage("Loading job details..."); + + _can_navigate_back = false; + base.OnNavigatedTo(); + + _db = ObservablesContext.CreateDefault(); + var a = _db.Jobs.ToList(); + Job = await _db.Jobs.SingleOrDefaultAsync(x => x.Guid == _job_to_load.Guid); + Job.ValidateOnPropertyChanged = true; + Rmls = await _db.Rmls.ToListAsync(); + ColorSpaces = await _db.ColorSpaces.ToListAsync(); + SpoolTypes = await _db.SpoolTypes.ToListAsync(); + Customers = await _db.Customers.Where(x => x.OrganizationGuid == MachineProvider.Machine.OrganizationGuid).ToListAsync(); + + if (!_check_gamut_thread.IsAlive) + { + _check_gamut_thread.Start(); + } + + SegmentsCollectionView = CollectionViewSource.GetDefaultView(Job.Segments); + SegmentsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Segment.SegmentIndex), ListSortDirection.Ascending)); + + InvokeUIOnIdle(() => + { + NotificationProvider.ReleaseGlobalBusyMessage(); + }); + + _job_to_load = null; + } + + if (!_jobs_fine_tune_items.ContainsKey(Job.Guid) && Job.JobFineTuningStatus == BL.Enumerations.FineTuningStatuses.PendingApproval) { - Job.JobStatus = JobStatus; + Job.JobFineTuningStatus = BL.Enumerations.FineTuningStatuses.Unspecified; } + if (Job.JobEditingState == BL.Enumerations.EditingStates.SampleDye && Job.JobSampleDyeStatus == BL.Enumerations.SampleDyeStatuses.PendingApproval) + { + View.DisplaySampleDye(); + } + else if (Job.JobEditingState == BL.Enumerations.EditingStates.FineTuning && Job.JobFineTuningStatus == BL.Enumerations.FineTuningStatuses.PendingApproval) + { + View.DisplayFineTuning(); + } + } + + /// <summary> + /// Saves the job. + /// </summary> + private async void SaveJob(bool displayNotification = true) + { if (Job.Validate(_db)) { await _db.SaveChangesAsync(); @@ -310,12 +432,18 @@ namespace Tango.PPC.Jobs.ViewModels } } + /// <summary> + /// Starts the job. + /// </summary> private void StartJob() { MachineProvider.MachineOperator.Print(Job); NavigationManager.NavigateTo<JobsModule>(nameof(JobProgressView)); } + /// <summary> + /// Determines whether this instance [can start job]. + /// </summary> private bool CanStartJob() { return @@ -488,7 +616,7 @@ namespace Tango.PPC.Jobs.ViewModels { Job sampleDyeJob = Job.Clone(); sampleDyeJob.Guid = Job.Guid; - sampleDyeJob.IsSample = true; + sampleDyeJob.Designation = BL.Enumerations.JobDesignations.SampleDye; sampleDyeJob.Name = Job.Name + " (sample)"; if (Job.JobType == BL.Enumerations.JobTypes.Embroidery) @@ -508,14 +636,17 @@ namespace Tango.PPC.Jobs.ViewModels SaveJob(false); var thisJob = Job; + var thisContext = _db; - MachineProvider.MachineOperator.Print(sampleDyeJob).Completed += (x, e) => + MachineProvider.MachineOperator.Print(sampleDyeJob).Completed += async (x, e) => { thisJob.JobStatus = BL.Enumerations.JobStatuses.PendingApproval; if (Job != null && Job.Guid == thisJob.Guid) { - JobStatus = BL.Enumerations.JobStatuses.PendingApproval; + thisJob.JobEditingState = BL.Enumerations.EditingStates.SampleDye; + thisJob.JobSampleDyeStatus = BL.Enumerations.SampleDyeStatuses.PendingApproval; + await thisContext.SaveChangesAsync(); } }; @@ -527,7 +658,8 @@ namespace Tango.PPC.Jobs.ViewModels /// </summary> private void RepeatSampleDye() { - JobStatus = BL.Enumerations.JobStatuses.Draft; + Job.JobEditingState = BL.Enumerations.EditingStates.Default; + Job.JobSampleDyeStatus = BL.Enumerations.SampleDyeStatuses.Unspecified; } /// <summary> @@ -535,7 +667,10 @@ namespace Tango.PPC.Jobs.ViewModels /// </summary> private void ApproveSampleDye() { - JobStatus = BL.Enumerations.JobStatuses.Approved; + Job.JobEditingState = BL.Enumerations.EditingStates.Default; + Job.JobSampleDyeStatus = BL.Enumerations.SampleDyeStatuses.Approved; + + Job.SampleDyeApproveDate = DateTime.UtcNow; SaveJob(false); } @@ -544,7 +679,130 @@ namespace Tango.PPC.Jobs.ViewModels /// </summary> private void DyeAnotherSample() { - JobStatus = BL.Enumerations.JobStatuses.Draft; + Job.JobEditingState = BL.Enumerations.EditingStates.Default; + Job.JobSampleDyeStatus = BL.Enumerations.SampleDyeStatuses.Unspecified; + } + + #endregion + + #region Fine Tuning + + /// <summary> + /// Synchronizes the fine tune items to brush stops. + /// </summary> + private void SyncFineTuneItemsToBrushStops() + { + if (Job != null) + { + if (_jobs_fine_tune_items.ContainsKey(Job.Guid)) + { + FineTuneItems = _jobs_fine_tune_items[Job.Guid].ToObservableCollection(); + } + else + { + FineTuneItems.Clear(); + + foreach (var stop in Job.Segments.SelectMany(x => x.BrushStops).DistinctBy(x => x.Color)) + { + FineTuneItem item = new FineTuneItem(TangoColorConverter.GetSuggestions(stop)); + item.BrushStops = Job.Segments.SelectMany(x => x.BrushStops).Where(x => x.Color == stop.Color).ToList(); + item.SelectedSuggestion = item.Suggestions[item.Suggestions.Count / 2]; + item.SelectedChanged += () => StartFineTuningCommand.RaiseCanExecuteChanged(); + FineTuneItems.Add(item); + } + + _jobs_fine_tune_items[Job.Guid] = FineTuneItems.ToList(); + } + + ApprovalFineTuneItems = FineTuneItems.Where(x => x.IsSelected).ToObservableCollection(); + + StartFineTuningCommand.RaiseCanExecuteChanged(); + } + } + + private async void InvokeFineTuningPalette(FineTuneItem fineTuneItem) + { + FineTuningPaletteViewVM vm = new FineTuningPaletteViewVM(fineTuneItem, Job); + await NotificationProvider.ShowDialog(vm); + + if (vm.DialogResult) + { + fineTuneItem.Suggestions = vm.Suggestions; + fineTuneItem.SelectedSuggestion = vm.SelectedSuggestion; + } + } + + private void ResetFineTuning() + { + SyncFineTuneItemsToBrushStops(); + } + + private void StartFineTuning() + { + try + { + Job fineTuneJob = Job.Clone(); + fineTuneJob.NumberOfUnits = 1; + fineTuneJob.Designation = BL.Enumerations.JobDesignations.FineTuning; + fineTuneJob.Guid = Job.Guid; + fineTuneJob.Name = Job.Name + " (fine tuning)"; + fineTuneJob.Segments.Clear(); + + foreach (var suggestion in FineTuneItems.Where(x => x.IsSelected).SelectMany(x => x.Suggestions)) + { + var segment = fineTuneJob.AddSolidSegment(suggestion.Color); + } + + _jobs_fine_tune_items[Job.Guid] = FineTuneItems.ToList(); + + var thisJob = Job; + var thisContext = _db; + + MachineProvider.MachineOperator.Print(fineTuneJob).Completed += async (x, e) => + { + thisJob.JobEditingState = BL.Enumerations.EditingStates.FineTuning; + thisJob.JobFineTuningStatus = BL.Enumerations.FineTuningStatuses.PendingApproval; + await thisContext.SaveChangesAsync(); + }; + + NavigationManager.NavigateTo<JobsModule>(nameof(JobProgressView)); + } + catch (Exception ex) + { + LogManager.Log(ex); + NotificationProvider.ShowError(ex.Message); + } + } + + private void ApproveFineTuning() + { + Job.JobEditingState = BL.Enumerations.EditingStates.Default; + Job.JobFineTuningStatus = BL.Enumerations.FineTuningStatuses.Approved; + + foreach (var item in ApprovalFineTuneItems) + { + foreach (var stop in item.BrushStops) + { + stop.Color = item.SelectedSuggestion.Color; + } + } + + + Job.FineTuningApproveDate = DateTime.UtcNow; + SaveJob(false); + + if (_jobs_fine_tune_items.ContainsKey(Job.Guid)) + { + _jobs_fine_tune_items.Remove(Job.Guid); + } + + SyncFineTuneItemsToBrushStops(); + } + + private void RepeatFineTuning() + { + Job.JobEditingState = BL.Enumerations.EditingStates.Default; + Job.JobFineTuningStatus = BL.Enumerations.FineTuningStatuses.Unspecified; } #endregion @@ -593,50 +851,9 @@ namespace Tango.PPC.Jobs.ViewModels /// <summary> /// Called when the navigation system has navigated to this VM view. /// </summary> - public async override void OnNavigatedTo() + public override void OnNavigatedTo() { - if (!(_job_to_load == null || (_job_to_load != null && Job != null && _job_to_load.Guid == Job.Guid))) - { - NotificationProvider.SetGlobalBusyMessage("Loading job details..."); - - _can_navigate_back = false; - base.OnNavigatedTo(); - - if (_db != null) - { - _db.Dispose(); - } - - _db = ObservablesContext.CreateDefault(); - var a = _db.Jobs.ToList(); - Job = await _db.Jobs.SingleOrDefaultAsync(x => x.Guid == _job_to_load.Guid); - Job.ValidateOnPropertyChanged = true; - Rmls = await _db.Rmls.ToListAsync(); - ColorSpaces = await _db.ColorSpaces.ToListAsync(); - SpoolTypes = await _db.SpoolTypes.ToListAsync(); - Customers = await _db.Customers.Where(x => x.OrganizationGuid == MachineProvider.Machine.OrganizationGuid).ToListAsync(); - - if (!_check_gamut_thread.IsAlive) - { - _check_gamut_thread.Start(); - } - - SegmentsCollectionView = CollectionViewSource.GetDefaultView(Job.Segments); - SegmentsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Segment.SegmentIndex), ListSortDirection.Ascending)); - - InvokeUIOnIdle(() => - { - NotificationProvider.ReleaseGlobalBusyMessage(); - }); - - _job_to_load = null; - } - - if (_job_to_load_intent == JobNavigationIntent.SampleDye) - { - JobStatus = Job.JobStatus; - View.DisplaySampleDye(); - } + LoadJob(); } /// <summary> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs index 5c66f045b..28ff1793b 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs @@ -30,7 +30,7 @@ namespace Tango.PPC.Jobs.ViewModels private void MachineOperator_PrintingCompleted(object sender, Integration.Operation.PrintingEventArgs e) { - if (e.Job.IsSample) + if (e.Job.Designation == BL.Enumerations.JobDesignations.SampleDye) { NotificationProvider.PushNotification(new MessageNotificationItem("Sample completed successfully.", MessageNotificationItem.MessageNotificationItemTypes.Success, () => { @@ -38,6 +38,14 @@ namespace Tango.PPC.Jobs.ViewModels NavigationManager.ClearHistoryExcept<JobsView>(); })); } + else if (e.Job.Designation == BL.Enumerations.JobDesignations.FineTuning) + { + NotificationProvider.PushNotification(new MessageNotificationItem("Fine tuning completed successfully.", MessageNotificationItem.MessageNotificationItemTypes.Success, () => + { + NavigationManager.NavigateWithObject<JobsModule, JobView, JobNavigationObject>(new JobNavigationObject() { Job = e.Job, Intent = JobNavigationIntent.FineTuning }); + NavigationManager.ClearHistoryExcept<JobsView>(); + })); + } else { NotificationProvider.PushNotification(new MessageNotificationItem("Job completed successfully.", MessageNotificationItem.MessageNotificationItemTypes.Success, () => 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 bfd571db0..8933940b2 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 @@ -564,7 +564,7 @@ </StackPanel> </Border>--> - <touch:TouchExpander x:Name="expander_sample_dye" Margin="0 0 0 120" Padding="20 15"> + <touch:TouchExpander x:Name="expander_sample_dye" Margin="0 0 0 0" Padding="20 15"> <touch:TouchExpander.Header> <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0 0 20 0"> <Image Source="../Images/JobView/sample-dye.png" Width="39" /> @@ -645,7 +645,7 @@ </Setter> <Style.Triggers> - <DataTrigger Binding="{Binding JobStatus}" Value="{x:Static enumerations:JobStatuses.PendingApproval}"> + <DataTrigger Binding="{Binding Job.JobSampleDyeStatus}" Value="{x:Static enumerations:SampleDyeStatuses.PendingApproval}"> <Setter Property="Content"> <Setter.Value> <StackPanel> @@ -680,14 +680,14 @@ </Setter> </DataTrigger> - <DataTrigger Binding="{Binding JobStatus}" Value="{x:Static enumerations:JobStatuses.Approved}"> + <DataTrigger Binding="{Binding Job.JobSampleDyeStatus}" Value="{x:Static enumerations:SampleDyeStatuses.Approved}"> <Setter Property="Content"> <Setter.Value> <StackPanel Margin="0 40 80 40"> <DockPanel LastChildFill="False"> <TextBlock DockPanel.Dock="Left" VerticalAlignment="Center"> <Run>Sample Approved:</Run> - <Run Text="{Binding Job.LastUpdated,Converter={StaticResource DateTimeUTCToShortDateConverter}}"></Run> + <Run Text="{Binding Job.SampleDyeApproveDate,Converter={StaticResource DateTimeUTCToShortDateConverter},TargetNullValue=''}"></Run> </TextBlock> <touch:TouchButton DockPanel.Dock="Right" HorizontalAlignment="Right" Style="{StaticResource TangoHollowButton}" Width="220" Height="50" Command="{Binding AnotherSampleCommand}"> <StackPanel Orientation="Horizontal"> @@ -706,6 +706,238 @@ </ContentControl> </StackPanel> </touch:TouchExpander> + + <touch:TouchExpander x:Name="expander_fine_tuning" Margin="0 20 0 120" Padding="20 15" IsExpanded="{Binding IsFineTuneExpanded,Mode=TwoWay}"> + <touch:TouchExpander.Header> + <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0 0 20 0"> + <Image Source="../Images/JobView/color-fine-tuning.png" Width="39" /> + <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Color Fine Tuning</TextBlock> + </StackPanel> + </touch:TouchExpander.Header> + + <StackPanel Margin="60 20 0 0"> + + <ContentControl> + <ContentControl.Style> + <Style TargetType="ContentControl"> + <Setter Property="Content"> + <Setter.Value> + <StackPanel> + <TextBlock>Select the colors you want to fine tune.</TextBlock> + + <StackPanel HorizontalAlignment="Center" Margin="0 40 0 0"> + <TextBlock Foreground="{StaticResource TangoGrayTextBrush}" HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">Defined Colors</TextBlock> + + <ItemsControl Margin="0 40 0 0" ItemsSource="{Binding FineTuneItems}"> + <ItemsControl.ItemTemplate> + <DataTemplate> + <DockPanel> + <touch:TouchCheckBox DockPanel.Dock="Left" IsChecked="{Binding IsSelected}" Margin="0 0 20 0" /> + <touch:TouchImageButton DockPanel.Dock="Right" Image="../Images/JobView/color-picker.png" Width="80" Height="80" Padding="15" CornerRadius="100" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.InvokeFineTuningPaletteCommand}" CommandParameter="{Binding}"></touch:TouchImageButton> + <touch:TouchFlatListBox ItemsSource="{Binding Suggestions}" SelectedItem="{Binding SelectedSuggestion}" IsEnabled="False"> + <touch:TouchFlatListBox.ItemsPanel> + <ItemsPanelTemplate> + <UniformGrid Columns="{Binding Suggestions.Count}" Margin="0 20"></UniformGrid> + </ItemsPanelTemplate> + </touch:TouchFlatListBox.ItemsPanel> + <touch:TouchFlatListBox.ItemTemplate> + <DataTemplate> + <Ellipse Width="70" Height="70" Fill="{Binding Brush}" Margin="30 0"> + <Ellipse.Style> + <Style TargetType="Ellipse"> + <Setter Property="RenderTransformOrigin" Value="0.5,0.5"></Setter> + <Setter Property="RenderTransform"> + <Setter.Value> + <ScaleTransform ScaleX="1" ScaleY="1" /> + </Setter.Value> + </Setter> + <Setter Property="Effect"> + <Setter.Value> + <DropShadowEffect Color="{StaticResource TangoDropShadowColor}" ShadowDepth="10" Direction="10" BlurRadius="15" Opacity="0" /> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected}" Value="True"> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="1.2" Duration="00:00:0.2" /> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="1.2" Duration="00:00:0.2" /> + <DoubleAnimation Storyboard.TargetProperty="Effect.Opacity" To="1" Duration="00:00:0.2" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="1" Duration="00:00:0.2" /> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="1" Duration="00:00:0.2" /> + <DoubleAnimation Storyboard.TargetProperty="Effect.Opacity" To="0" Duration="00:00:0.2" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </Ellipse.Style> + </Ellipse> + </DataTemplate> + </touch:TouchFlatListBox.ItemTemplate> + </touch:TouchFlatListBox> + </DockPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </StackPanel> + + <DockPanel LastChildFill="False" Margin="0 80 0 0"> + <touch:TouchButton Command="{Binding ResetFineTuningCommand}" DockPanel.Dock="Left" Padding="40 10" Margin="-30 0 0 0" Style="{StaticResource TangoFlatButton}" Foreground="{StaticResource TangoPrimaryAccentBrush}">Reset</touch:TouchButton> + + <touch:TouchButton Margin="0 0 0 15" DockPanel.Dock="Right" Height="54" Padding="0" Width="184" CornerRadius="30" BlurRadius="20" HorizontalAlignment="Right" Command="{Binding StartFineTuningCommand}"> + START + </touch:TouchButton> + </DockPanel> + </StackPanel> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding Job.JobFineTuningStatus}" Value="{x:Static enumerations:FineTuningStatuses.PendingApproval}"> + <Setter Property="Content"> + <Setter.Value> + <StackPanel Margin="0 20 0 0"> + <StackPanel Orientation="Horizontal"> + <Grid> + <Ellipse Stroke="{StaticResource TangoDarkForegroundBrush}" StrokeThickness="2" Width="42" Height="42"></Ellipse> + <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="20" FontWeight="Bold">1</TextBlock> + </Grid> + <TextBlock Margin="20 0 0 0" VerticalAlignment="Center">Select the best variation for each color:</TextBlock> + </StackPanel> + + <ItemsControl Margin="65 40 120 0" ItemsSource="{Binding ApprovalFineTuneItems}" AlternationCount="1000"> + <ItemsControl.ItemTemplate> + <DataTemplate> + <DockPanel> + <TextBlock Margin="0 0 20 0" VerticalAlignment="Center"> + <Run>Color</Run> + <Run>#</Run><Run Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(ItemsControl.AlternationIndex),Mode=OneWay,Converter={StaticResource MathOperatorConverter},ConverterParameter='+1'}"></Run> + </TextBlock> + <touch:TouchFlatListBox ItemsSource="{Binding Suggestions}" SelectedItem="{Binding SelectedSuggestion}"> + <touch:TouchFlatListBox.ItemsPanel> + <ItemsPanelTemplate> + <UniformGrid Columns="{Binding Suggestions.Count}" Margin="0 20"></UniformGrid> + </ItemsPanelTemplate> + </touch:TouchFlatListBox.ItemsPanel> + <touch:TouchFlatListBox.ItemTemplate> + <DataTemplate> + <Ellipse Width="70" Height="70" Fill="{Binding Brush}" Margin="30 0"> + <Ellipse.Style> + <Style TargetType="Ellipse"> + <Setter Property="RenderTransformOrigin" Value="0.5,0.5"></Setter> + <Setter Property="RenderTransform"> + <Setter.Value> + <ScaleTransform ScaleX="1" ScaleY="1" /> + </Setter.Value> + </Setter> + <Setter Property="Effect"> + <Setter.Value> + <DropShadowEffect Color="{StaticResource TangoDropShadowColor}" ShadowDepth="10" Direction="10" BlurRadius="15" Opacity="0" /> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected}" Value="True"> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="1.2" Duration="00:00:0.2" /> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="1.2" Duration="00:00:0.2" /> + <DoubleAnimation Storyboard.TargetProperty="Effect.Opacity" To="1" Duration="00:00:0.2" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="1" Duration="00:00:0.2" /> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="1" Duration="00:00:0.2" /> + <DoubleAnimation Storyboard.TargetProperty="Effect.Opacity" To="0" Duration="00:00:0.2" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </Ellipse.Style> + </Ellipse> + </DataTemplate> + </touch:TouchFlatListBox.ItemTemplate> + </touch:TouchFlatListBox> + </DockPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + + <StackPanel Orientation="Horizontal" Margin="0 40 0 0"> + <Grid> + <Ellipse Stroke="{StaticResource TangoDarkForegroundBrush}" StrokeThickness="2" Width="42" Height="42"></Ellipse> + <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="20" FontWeight="Bold">2</TextBlock> + </Grid> + <TextBlock Margin="20 0 0 0" VerticalAlignment="Center">How to continue</TextBlock> + </StackPanel> + + <UniformGrid Columns="2" Width="530" HorizontalAlignment="Left" Margin="0 40 0 20"> + <StackPanel HorizontalAlignment="Left"> + <touch:TouchButton Style="{StaticResource TangoHollowButton}" Width="180" Height="50" Command="{Binding ApproveFineTuningCommand}"> + <StackPanel Orientation="Horizontal"> + <touch:TouchIcon Icon="Check"></touch:TouchIcon> + <TextBlock Margin="10 0 0 0">DONE</TextBlock> + </StackPanel> + </touch:TouchButton> + + <TextBlock Margin="0 15 0 0" TextAlignment="Center">All colors are approved</TextBlock> + </StackPanel> + + <StackPanel HorizontalAlignment="Right"> + <touch:TouchButton Style="{StaticResource TangoHollowButton}" Width="180" Height="50" Command="{Binding RepeatFineTuningCommand}"> + <StackPanel Orientation="Horizontal"> + <touch:TouchIcon Icon="Repeat"></touch:TouchIcon> + <TextBlock Margin="10 0 0 0">REPEAT</TextBlock> + </StackPanel> + </touch:TouchButton> + + <TextBlock Margin="0 15 0 0" TextAlignment="Left" TextWrapping="Wrap" Width="170">Some color need more fine tuning</TextBlock> + </StackPanel> + </UniformGrid> + </StackPanel> + </Setter.Value> + </Setter> + </DataTrigger> + + <DataTrigger Binding="{Binding Job.JobFineTuningStatus}" Value="{x:Static enumerations:FineTuningStatuses.Approved}"> + <Setter Property="Content"> + <Setter.Value> + <StackPanel Margin="0 40 80 40"> + <DockPanel LastChildFill="False"> + <TextBlock DockPanel.Dock="Left" VerticalAlignment="Center"> + <Run>Colors Approved:</Run> + <Run Text="{Binding Job.FineTuningApproveDate,Converter={StaticResource DateTimeUTCToShortDateConverter},TargetNullValue=''}"></Run> + </TextBlock> + <touch:TouchButton DockPanel.Dock="Right" HorizontalAlignment="Right" Style="{StaticResource TangoHollowButton}" Width="220" Height="50" Command="{Binding RepeatFineTuningCommand}"> + <StackPanel Orientation="Horizontal"> + <touch:TouchIcon Icon="Plus"></touch:TouchIcon> + <TextBlock Margin="10 0 0 0">REPEAT FINE TUNING</TextBlock> + </StackPanel> + </touch:TouchButton> + </DockPanel> + </StackPanel> + </Setter.Value> + </Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </ContentControl.Style> + </ContentControl> + </StackPanel> + </touch:TouchExpander> </StackPanel> </StackPanel> </touch:LightTouchScrollViewer> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml.cs index 77253e286..42c765a27 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml.cs @@ -55,5 +55,12 @@ namespace Tango.PPC.Jobs.Views await Task.Delay(500); scrollViewer.ScrollToElement(expander_sample_dye); } + + public async void DisplayFineTuning() + { + expander_fine_tuning.IsExpanded = true; + await Task.Delay(500); + scrollViewer.ScrollToElement(expander_fine_tuning); + } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs index ba869957d..fc5ab2ba2 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Notifications/DefaultNotificationProvider.cs @@ -111,7 +111,7 @@ namespace Tango.PPC.UI.Notifications return ShowMessageBox(new MessageBoxVM() { Message = message, - Icon = ResourceHelper.GetImageFromResources("Images/MessageBox Icons/information.png"), + Icon = TouchIconKind.AlertOctagon, Title = "Error", Brush = Application.Current.Resources["TangoMessageBoxErrorBrush"] as Brush, }); @@ -127,7 +127,7 @@ namespace Tango.PPC.UI.Notifications return ShowMessageBox(new MessageBoxVM() { Message = message, - Icon = ResourceHelper.GetImageFromResources("Images/MessageBox Icons/information.png"), + Icon = TouchIconKind.InfoCircleSolid, Title = "Information", Brush = Application.Current.Resources["TangoMessageBoxInfoBrush"] as Brush, }); @@ -143,7 +143,7 @@ namespace Tango.PPC.UI.Notifications return ShowMessageBox(new MessageBoxVM() { Message = message, - Icon = ResourceHelper.GetImageFromResources("Images/MessageBox Icons/information.png"), + Icon = TouchIconKind.Alert, Title = "Warning", Brush = Application.Current.Resources["TangoMessageBoxWarningBrush"] as Brush, }); @@ -159,7 +159,7 @@ namespace Tango.PPC.UI.Notifications return ShowMessageBox(new MessageBoxVM() { Message = message, - Icon = ResourceHelper.GetImageFromResources("Images/MessageBox Icons/information.png"), + Icon = TouchIconKind.QuestionCircleSolid, Title = "Confirm", HasCancel = true, Brush = Application.Current.Resources["TangoMessageBoxQuestionBrush"] as Brush, |
