aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Modules
diff options
context:
space:
mode:
authorAvi Levkovich <avi@twine-s.com>2019-08-01 17:23:44 +0300
committerAvi Levkovich <avi@twine-s.com>2019-08-01 17:23:44 +0300
commit06c6cfec8af9c3b3f930da7fe4394ee885d24352 (patch)
tree2667eb76e8fb204db99608e91b49bf73d8b0ecd3 /Software/Visual_Studio/PPC/Modules
parent42471da0b2a19c964fc2c3df39cc2e8a6aaf5e2e (diff)
parent18c4c73f8b654dca09e1333d1f6a35e4cbdc9b17 (diff)
downloadTango-06c6cfec8af9c3b3f930da7fe4394ee885d24352.tar.gz
Tango-06c6cfec8af9c3b3f930da7fe4394ee885d24352.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/CatalogSelectionView.xaml69
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/CatalogSelectionView.xaml.cs34
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/CatalogSelectionViewVM.cs51
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/JobsModuleSettings.cs5
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj10
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobSummeryViewVM.cs10
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs16
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs42
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/TwineCatalogView.xaml5
9 files changed, 236 insertions, 6 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/CatalogSelectionView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/CatalogSelectionView.xaml
new file mode 100644
index 000000000..e1edb66f2
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/CatalogSelectionView.xaml
@@ -0,0 +1,69 @@
+<UserControl x:Class="Tango.PPC.Jobs.Dialogs.CatalogSelectionView"
+ 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:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL"
+ xmlns:converters="clr-namespace:Tango.PPC.Jobs.Converters"
+ xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
+ 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:CatalogSelectionViewVM, IsDesignTimeCreatable=False}">
+
+ <UserControl.Resources>
+ <converters:JobTypeToImageConverter x:Key="JobTypeToImageConverter" />
+ <converters:ColorSpaceToImageConverter x:Key="ColorSpaceToImageConverter" />
+
+ </UserControl.Resources>
+
+ <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">CREATE</touch:TouchButton>
+ </Grid>
+
+ <StackPanel DockPanel.Dock="Top">
+ <TextBlock HorizontalAlignment="Left" Margin="0 10 0 0" FontSize="{StaticResource TangoHeaderFontSize}">Select Catalog</TextBlock>
+ <TextBlock Margin="0 30 100 0" HorizontalAlignment="Left" TextWrapping="Wrap" FontSize="{StaticResource TangoTitleFontSize}">Please select the desired color catalog and press 'create'.</TextBlock>
+ </StackPanel>
+
+ <touch:TouchStaticListBox Margin="20" VerticalAlignment="Center" HorizontalAlignment="Center" Width="480" ItemsSource="{Binding Catalogs}" SelectedItem="{Binding SelectedCatalog,Mode=TwoWay}">
+ <touch:TouchStaticListBox.ItemsPanel>
+ <ItemsPanelTemplate>
+ <UniformGrid Columns="{Binding Catalogs.Count}" />
+ </ItemsPanelTemplate>
+ </touch:TouchStaticListBox.ItemsPanel>
+ <touch:TouchStaticListBox.ItemContainerStyle>
+ <Style TargetType="touch:TouchStaticListBoxItem">
+ <Setter Property="BorderBrush" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter>
+ <Setter Property="BorderThickness" Value="0"></Setter>
+ <Setter Property="CornerRadius" Value="5"></Setter>
+ <Setter Property="Padding" Value="0 10"></Setter>
+ <Setter Property="Margin" Value="25"></Setter>
+ <Setter Property="Background" Value="Transparent"></Setter>
+ <Setter Property="Width" Value="110"></Setter>
+ <Style.Triggers>
+ <Trigger Property="IsSelected" Value="True">
+ <Setter Property="BorderThickness" Value="2"></Setter>
+ </Trigger>
+ </Style.Triggers>
+ </Style>
+ </touch:TouchStaticListBox.ItemContainerStyle>
+ <touch:TouchStaticListBox.ItemTemplate>
+ <DataTemplate>
+ <StackPanel Orientation="Vertical" HorizontalAlignment="Center">
+ <Image Stretch="Fill" Width="32" Height="32" RenderOptions.BitmapScalingMode="Fant" Source="../Images/NewJob/twine.png"></Image>
+ <TextBlock HorizontalAlignment="Center" Margin="0 10 0 0" Text="{Binding Name}"></TextBlock>
+ </StackPanel>
+ </DataTemplate>
+ </touch:TouchStaticListBox.ItemTemplate>
+ </touch:TouchStaticListBox>
+ </DockPanel>
+ </Grid>
+</UserControl>
+
+
+ \ No newline at end of file
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/CatalogSelectionView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/CatalogSelectionView.xaml.cs
new file mode 100644
index 000000000..65d03e531
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/CatalogSelectionView.xaml.cs
@@ -0,0 +1,34 @@
+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;
+using Tango.BL.Enumerations;
+
+namespace Tango.PPC.Jobs.Dialogs
+{
+ /// <summary>
+ /// Represents the new job creation dialog.
+ /// </summary>
+ /// <seealso cref="System.Windows.Controls.UserControl" />
+ /// <seealso cref="System.Windows.Markup.IComponentConnector" />
+ public partial class CatalogSelectionView : UserControl
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CatalogSelectionView"/> class.
+ /// </summary>
+ public CatalogSelectionView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/CatalogSelectionViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/CatalogSelectionViewVM.cs
new file mode 100644
index 000000000..0c4cd72f6
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/CatalogSelectionViewVM.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.BL.Entities;
+using Tango.BL.Enumerations;
+using Tango.SharedUI;
+
+namespace Tango.PPC.Jobs.Dialogs
+{
+ /// <summary>
+ /// Represents a catalog picker.
+ /// </summary>
+ /// <seealso cref="Tango.SharedUI.DialogViewVM" />
+ public class CatalogSelectionViewVM : DialogViewVM
+ {
+
+ private ObservableCollection<ColorCatalog> _catalogs;
+ /// <summary>
+ /// Gets or sets the catalogs.
+ /// </summary>
+ public ObservableCollection<ColorCatalog> Catalogs
+ {
+ get { return _catalogs; }
+ set { _catalogs = value; RaisePropertyChangedAuto(); }
+ }
+
+ private ColorCatalog _selectedCatalog;
+ /// <summary>
+ /// Gets or sets the selected catalog.
+ /// </summary>
+ public ColorCatalog SelectedCatalog
+ {
+ get { return _selectedCatalog; }
+ set { _selectedCatalog = value; RaisePropertyChangedAuto(); }
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="CatalogSelectionViewVM"/> class.
+ /// </summary>
+ /// <param name="catalogs">The catalogs.</param>
+ /// <param name="selectedCatalog">The selected catalog.</param>
+ public CatalogSelectionViewVM(List<ColorCatalog> catalogs, ColorCatalog selectedCatalog) : base()
+ {
+ Catalogs = catalogs.ToObservableCollection();
+ SelectedCatalog = selectedCatalog;
+ }
+ }
+}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/JobsModuleSettings.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/JobsModuleSettings.cs
index 15b859168..3d72509e0 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/JobsModuleSettings.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/JobsModuleSettings.cs
@@ -35,6 +35,11 @@ namespace Tango.PPC.Jobs
public JobTypes? LastJobType { get; set; }
/// <summary>
+ /// Gets or sets the last selected catalog unique identifier.
+ /// </summary>
+ public String LastSelectedCatalogGuid { get; set; }
+
+ /// <summary>
/// Initializes a new instance of the <see cref="JobsModuleSettings"/> class.
/// </summary>
public JobsModuleSettings()
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 5531c1c4c..8ed2ff80e 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
@@ -112,6 +112,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="Dialogs\CatalogSelectionView.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
<Page Include="Dialogs\JobCreationView.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -204,9 +208,13 @@
</Compile>
<Compile Include="Dialogs\ColorProfileReceivedViewVM.cs" />
<Compile Include="Dialogs\ImportJobViewVM.cs" />
+ <Compile Include="Dialogs\CatalogSelectionView.xaml.cs">
+ <DependentUpon>CatalogSelectionView.xaml</DependentUpon>
+ </Compile>
<Compile Include="Dialogs\JobCreationView.xaml.cs">
<DependentUpon>JobCreationView.xaml</DependentUpon>
</Compile>
+ <Compile Include="Dialogs\CatalogSelectionViewVM.cs" />
<Compile Include="Dialogs\JobCreationViewVM.cs" />
<Compile Include="Dialogs\SpoolChangeView.xaml.cs">
<DependentUpon>SpoolChangeView.xaml</DependentUpon>
@@ -464,7 +472,7 @@
<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 847edb52f..69d8b090f 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
@@ -107,6 +107,16 @@ namespace Tango.PPC.Jobs.ViewModels
_context = obj.Context;
Job = obj.Job;
+ 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;
+ }
+ }
+
Job = await new JobBuilder(_context).Set(Job.Guid)
.WithConfiguration()
.WithRML()
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 7ecfb7d27..2ae9df7fb 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
@@ -474,8 +474,20 @@ namespace Tango.PPC.Jobs.ViewModels
if (Job.ColorSpace.Space == BL.Enumerations.ColorSpaces.Catalog)
{
- SelectedCatalog = await new ColorCatalogBuilder(_db).SetFirst().WithGroups().WithItems().BuildAsync();
- CatalogItems = SelectedCatalog.ColorCatalogsGroups.SelectMany(x => x.ColorCatalogsItems).OrderBy(x => x.ItemIndex).ToList();
+ SelectedCatalog = await new ColorCatalogBuilder(_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)
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 b7a6ad94a..3ea7ae6f4 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
@@ -46,6 +46,7 @@ namespace Tango.PPC.Jobs.ViewModels
public class JobsViewVM : PPCViewModel<IJobsView>
{
private ObservablesContext _db; //Holds the db context for the job list.
+ private ObservableCollection<ColorCatalog> _catalogs; //Holds the available color catalogs.
public enum JobsCategory
{
@@ -401,6 +402,8 @@ namespace Tango.PPC.Jobs.ViewModels
{
LogManager.Log("Adding new job...");
+ var settings = SettingsManager.Default.GetOrCreate<JobsModuleSettings>();
+
var machine = MachineProvider.Machine;
JobCreationViewVM vm = new JobCreationViewVM(
@@ -408,7 +411,7 @@ namespace Tango.PPC.Jobs.ViewModels
machine.SupportedColorSpaces.Count > 0 ? machine.SupportedColorSpaces : Enum.GetValues(typeof(ColorSpaces)).Cast<ColorSpaces>().Where(x => x.IsUserSpace() || (ApplicationManager.IsInTechnicianMode && x == ColorSpaces.Volume)).ToList()
);
- var settings = SettingsManager.Default.GetOrCreate<JobsModuleSettings>();
+ CatalogSelectionViewVM catalogVM = new CatalogSelectionViewVM(_catalogs.ToList(), _catalogs.ToList().SingleOrDefault(x => x.Guid == settings.LastSelectedCatalogGuid));
if (settings.LastJobType != null)
{
@@ -447,6 +450,24 @@ namespace Tango.PPC.Jobs.ViewModels
{
vm = await NotificationProvider.ShowDialog<JobCreationViewVM>(vm);
if (!vm.DialogResult) return;
+
+ if (vm.SelectedColorSpace == ColorSpaces.Catalog)
+ {
+ if (catalogVM.SelectedCatalog == null)
+ {
+ catalogVM.SelectedCatalog = _catalogs.FirstOrDefault();
+ }
+
+ if (_catalogs.Count == 0)
+ {
+ await NotificationProvider.ShowError("No color catalogs found. Please selected another color space.");
+ return;
+ }
+ else if (_catalogs.Count > 1)
+ {
+ catalogVM = await NotificationProvider.ShowDialog<CatalogSelectionViewVM>(catalogVM);
+ }
+ }
}
else
{
@@ -457,6 +478,12 @@ namespace Tango.PPC.Jobs.ViewModels
settings.LastJobType = vm.SelectedJobType;
settings.LastJobColorSpace = vm.SelectedColorSpace;
+
+ if (vm.SelectedColorSpace == ColorSpaces.Catalog)
+ {
+ settings.LastSelectedCatalogGuid = catalogVM.SelectedCatalog.Guid;
+ }
+
settings.Save();
Job job = new Job();
@@ -475,6 +502,11 @@ namespace Tango.PPC.Jobs.ViewModels
job.WindingMethodGuid = Adapter.WindingMethods.FirstOrDefault().Guid;
job.SpoolTypeGuid = machine.DefaultSpoolType != null ? machine.DefaultSpoolTypeGuid : Adapter.SpoolTypes.FirstOrDefault().Guid;
+ if (vm.SelectedColorSpace == ColorSpaces.Catalog)
+ {
+ job.ColorCatalogGuid = catalogVM.SelectedCatalog.Guid;
+ }
+
if (Jobs.Count > 0)
{
job.JobIndex = Jobs.Max(x => x.JobIndex) + 1;
@@ -679,12 +711,18 @@ namespace Tango.PPC.Jobs.ViewModels
ExternalBridgeService.ColorProfileRequest += ExternalBridgeService_ColorProfileRequest;
}
- public override void OnApplicationReady()
+ public async override void OnApplicationReady()
{
base.OnApplicationReady();
StorageProvider.RegisterFileHandler(ExplorerFileDefinition.Job.Extension, HandleJobFileLoaded);
StorageProvider.RegisterFileHandler(ExplorerFileDefinition.ColorProfile.Extension, HandleColorProfileFileLoaded);
StorageProvider.RegisterFileHandler(ExplorerFileDefinition.Pulse.Extension, HandlePulseFileLoaded);
+
+ //Load catalogs.
+ using (ObservablesContext c = ObservablesContext.CreateDefault())
+ {
+ _catalogs = (await c.ColorCatalogs.ToListAsync()).ToObservableCollection();
+ }
}
public override void OnNavigatedTo()
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/TwineCatalogView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/TwineCatalogView.xaml
index d4522d288..19e1f722f 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/TwineCatalogView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/TwineCatalogView.xaml
@@ -18,7 +18,10 @@
</Grid.RowDefinitions>
<Border Padding="20" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="0 0 0 1" BorderBrush="{StaticResource TangoDividerBrush}">
- <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoHeaderFontSize}" FontWeight="SemiBold">Twine Catalog</TextBlock>
+ <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoHeaderFontSize}" FontWeight="SemiBold">
+ <Run Text="{Binding Catalog.Name}"></Run>
+ <Run>Catalog</Run>
+ </TextBlock>
</Border>
<Grid Grid.Row="1">