aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-07-09 16:56:19 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-07-09 16:56:19 +0300
commitfe5c32241d8a976f0770dacb998380ab1cf70ce4 (patch)
tree9ed208adde59f6744c750c61f75f5e22f1078878 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs
parentbe9aefbafc441064c5b7f49b31ab1bb23fb6e8c3 (diff)
downloadTango-fe5c32241d8a976f0770dacb998380ab1cf70ce4.tar.gz
Tango-fe5c32241d8a976f0770dacb998380ab1cf70ce4.zip
Implemented MS color catalogs.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Tango.MachineStudio.Catalogs.csproj1
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/ViewModels/CatalogVM.cs24
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/ViewModels/MainViewVM.cs290
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Views/CatalogView.xaml208
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Views/CatalogView.xaml.cs8
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Views/CatalogsView.xaml20
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Views/CatalogsView.xaml.cs4
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Views/MainView.xaml2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Views/MainView.xaml.cs2
9 files changed, 513 insertions, 46 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Tango.MachineStudio.Catalogs.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Tango.MachineStudio.Catalogs.csproj
index 1d29166be..e90e00b41 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Tango.MachineStudio.Catalogs.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Tango.MachineStudio.Catalogs.csproj
@@ -69,7 +69,6 @@
<ItemGroup>
<Compile Include="Contracts\IMainView.cs" />
<Compile Include="ViewModelLocator.cs" />
- <Compile Include="ViewModels\CatalogVM.cs" />
<Compile Include="ViewModels\MainViewVM.cs" />
<Compile Include="Views\CatalogView.xaml.cs">
<DependentUpon>CatalogView.xaml</DependentUpon>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/ViewModels/CatalogVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/ViewModels/CatalogVM.cs
deleted file mode 100644
index 7d9c79ada..000000000
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/ViewModels/CatalogVM.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Tango.BL.Entities;
-using Tango.Core;
-
-namespace Tango.MachineStudio.Catalogs.ViewModels
-{
- public class CatalogVM : ExtendedObject
- {
- public ColorSpace ColorSpace { get; set; }
-
- public List<Rml> SupportedMedia { get; set; }
-
- public int Colors { get; set; }
-
- public CatalogVM()
- {
- SupportedMedia = new List<Rml>();
- }
- }
-}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/ViewModels/MainViewVM.cs
index 6b1c82e0f..a10e944f9 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/ViewModels/MainViewVM.cs
@@ -1,17 +1,301 @@
using System;
using System.Collections.Generic;
+using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using Tango.BL;
+using Tango.BL.Entities;
using Tango.MachineStudio.Common;
+using System.Data.Entity;
+using Tango.MachineStudio.Catalogs.Contracts;
+using Tango.MachineStudio.Common.Notifications;
+using Tango.Core.Commands;
+using Tango.BL.Builders;
namespace Tango.MachineStudio.Catalogs.ViewModels
{
- public class MainViewVM : StudioViewModel
+ public class MainViewVM : StudioViewModel<IMainView>
{
- public override void OnApplicationReady()
+ private ObservablesContext _catalogsContext;
+ private ObservablesContext _activeCatalogContext;
+ private INotificationProvider _notification;
+
+ #region Properties
+
+ 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(); InvalidateRelayCommands(); }
+ }
+
+ private ColorCatalog _activeCatalog;
+ /// <summary>
+ /// Gets or sets the active catalog.
+ /// </summary>
+ public ColorCatalog ActiveCatalog
+ {
+ get { return _activeCatalog; }
+ set { _activeCatalog = value; RaisePropertyChangedAuto(); }
+ }
+
+ private ColorCatalogsGroup _selectedGroup;
+ /// <summary>
+ /// Gets or sets the selected group.
+ /// </summary>
+ public ColorCatalogsGroup SelectedGroup
+ {
+ get { return _selectedGroup; }
+ set { _selectedGroup = value; RaisePropertyChangedAuto(); }
+ }
+
+ private ColorCatalogsItem _selectedItem;
+ /// <summary>
+ /// Gets or sets the selected item.
+ /// </summary>
+ public ColorCatalogsItem SelectedItem
+ {
+ get { return _selectedItem; }
+ set { _selectedItem = value; RaisePropertyChangedAuto(); }
+ }
+
+ private List<Rml> _rmls;
+ /// <summary>
+ /// Gets or sets the RMLS.
+ /// </summary>
+ public List<Rml> RMLS
+ {
+ get { return _rmls; }
+ set { _rmls = value; RaisePropertyChangedAuto(); }
+ }
+
+ #endregion
+
+ #region Commands
+
+ /// <summary>
+ /// Gets or sets the new catalog command.
+ /// </summary>
+ public RelayCommand NewCatalogCommand { get; set; }
+
+ /// <summary>
+ /// Gets or sets the delete catalog command.
+ /// </summary>
+ public RelayCommand DeleteCatalogCommand { get; set; }
+
+ /// <summary>
+ /// Gets or sets the edit catalog command.
+ /// </summary>
+ public RelayCommand EditCatalogCommand { get; set; }
+
+ /// <summary>
+ /// Gets or sets the back to catalogs command.
+ /// </summary>
+ public RelayCommand BackToCatalogsCommand { get; set; }
+
+ /// <summary>
+ /// Gets or sets the save active catalog command.
+ /// </summary>
+ public RelayCommand SaveActiveCatalogCommand { get; set; }
+
+ #endregion
+
+ #region Constructors
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="MainViewVM"/> class.
+ /// </summary>
+ public MainViewVM()
+ {
+ Catalogs = new ObservableCollection<ColorCatalog>();
+ _catalogsContext = ObservablesContext.CreateDefault();
+
+ EditCatalogCommand = new RelayCommand(EditSelectedCatalog, () => SelectedCatalog != null);
+ NewCatalogCommand = new RelayCommand(CreateNewCatalog);
+ DeleteCatalogCommand = new RelayCommand(DeleteSelectedCatalog, () => SelectedCatalog != null);
+ BackToCatalogsCommand = new RelayCommand(BackToCatalogs);
+ SaveActiveCatalogCommand = new RelayCommand(SaveActiveCatalog);
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="MainViewVM"/> class.
+ /// </summary>
+ /// <param name="notificationProvider">The notification provider.</param>
+ public MainViewVM(INotificationProvider notificationProvider) : this()
+ {
+ _notification = notificationProvider;
+ }
+
+ #endregion
+
+ #region Edit / Delete / Create Catalog
+
+ public async Task LoadCatalogs()
+ {
+ using (_notification.PushTaskItem("Loading color catalogs..."))
+ {
+ IsFree = false;
+ Catalogs = (await _catalogsContext.ColorCatalogs.Include(x => x.ColorCatalogsGroups.Select(g => g.ColorCatalogsItems)).ToListAsync()).ToSynchronizedObservableCollection();
+ SelectedCatalog = null;
+ IsFree = true;
+ }
+ }
+
+ public async void EditSelectedCatalog()
+ {
+ if (SelectedCatalog != null)
+ {
+ using (_notification.PushTaskItem("Loading selected catalog..."))
+ {
+ try
+ {
+ IsFree = false;
+
+ if (_activeCatalogContext != null)
+ {
+ _activeCatalogContext.Dispose();
+ }
+
+ _activeCatalogContext = ObservablesContext.CreateDefault();
+
+ ActiveCatalog = await new ColorCatalogBuilder(_activeCatalogContext).Set(SelectedCatalog.Guid).WithGroups().WithItems().WithRecipes().BuildAsync();
+ SelectedGroup = ActiveCatalog.ColorCatalogsGroups.FirstOrDefault();
+ RMLS = await _activeCatalogContext.Rmls.ToListAsync();
+
+ if (SelectedGroup != null)
+ {
+ SelectedItem = SelectedGroup.ColorCatalogsItems.FirstOrDefault();
+ }
+
+ View.NavigateTo(CatalogsNavigationView.CatalogView);
+ }
+ catch (Exception ex)
+ {
+ _notification.ShowError($"An error occurred while trying to load the selected catalog.\n{ex.Message}");
+ LogManager.Log(ex, $"Error loading selected catalog '{SelectedCatalog.Name}'.");
+ }
+ finally
+ {
+ IsFree = true;
+ }
+ }
+ }
+ }
+
+ private async void DeleteSelectedCatalog()
+ {
+ if (SelectedCatalog != null)
+ {
+ if (_notification.ShowQuestion("Are you sure you want to delete the selected catalog ?"))
+ {
+ using (_notification.PushTaskItem("Deleting selected catalog..."))
+ {
+ try
+ {
+ IsFree = false;
+ await SelectedCatalog.DeleteCascadeAsync(_catalogsContext);
+ SelectedCatalog = null;
+ }
+ catch (Exception ex)
+ {
+ _notification.ShowError($"An error occurred while trying to delete the selected catalog.\n{ex.Message}");
+ LogManager.Log(ex, $"Error deleting catalog {SelectedCatalog.Name}.");
+ }
+ finally
+ {
+ IsFree = true;
+ }
+ }
+ }
+ }
+ }
+
+ private async void CreateNewCatalog()
+ {
+ String name = _notification.ShowTextInput("Please enter a catalog name", "Catalog name");
+ if (!String.IsNullOrWhiteSpace(name))
+ {
+ using (_notification.PushTaskItem("Generating catalog..."))
+ {
+ try
+ {
+ IsFree = false;
+ ColorCatalog newCatalog = new ColorCatalog();
+ newCatalog.Name = name;
+ newCatalog.Description = name;
+ newCatalog.Company = "Twine";
+ _catalogsContext.ColorCatalogs.Add(newCatalog);
+ await _catalogsContext.SaveChangesAsync();
+ SelectedCatalog = newCatalog;
+ EditSelectedCatalog();
+ }
+ catch (Exception ex)
+ {
+ _notification.ShowError($"An error occurred while trying to create the catalog.\n{ex.Message}");
+ LogManager.Log(ex, $"Error creating new catalog.");
+ }
+ finally
+ {
+ IsFree = true;
+ }
+ }
+ }
+ }
+
+ private async void SaveActiveCatalog()
+ {
+ if (ActiveCatalog != null)
+ {
+ using (_notification.PushTaskItem("Updating catalog..."))
+ {
+ try
+ {
+ IsFree = false;
+ await _activeCatalogContext.SaveChangesAsync();
+ await LoadCatalogs();
+ _notification.ShowInfo("Catalog updated successfully.");
+ }
+ catch (Exception ex)
+ {
+ _notification.ShowError($"An error occurred while trying to update the catalog.\n{ex.Message}");
+ LogManager.Log(ex, $"Error updating catalog {ActiveCatalog.Name}.");
+ }
+ finally
+ {
+ IsFree = true;
+ }
+ }
+ }
+ }
+
+ private void BackToCatalogs()
+ {
+ View.NavigateTo(CatalogsNavigationView.CatalogsView);
+ }
+
+ #endregion
+
+ #region Application Ready
+
+ public async override void OnApplicationReady()
{
-
+ await LoadCatalogs();
}
+
+ #endregion
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Views/CatalogView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Views/CatalogView.xaml
index 17198b866..8dc6b5d02 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Views/CatalogView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Views/CatalogView.xaml
@@ -1,14 +1,214 @@
-<UserControl x:Class="Tango.MachineStudio.Catalogs.Views.CatalogsView"
+<UserControl x:Class="Tango.MachineStudio.Catalogs.Views.CatalogView"
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:vm="clr-namespace:Tango.MachineStudio.Catalogs.ViewModels"
+ xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
+ xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls"
+ xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL"
+ xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
+ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:global="clr-namespace:Tango.MachineStudio.Catalogs"
xmlns:local="clr-namespace:Tango.MachineStudio.Catalogs.Views"
mc:Ignorable="d"
- d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" Foreground="#BBBBBB" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}">
- <Grid>
-
+ d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" Foreground="#232323" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}">
+
+ <UserControl.Resources>
+ <converters:EnumToItemsSourceConverter x:Key="EnumToItemsSourceConverter" />
+
+ <Style x:Key="EditableGrid" TargetType="DataGrid" BasedOn="{StaticResource {x:Type DataGrid}}">
+ <Setter Property="AutoGenerateColumns" Value="False"></Setter>
+ </Style>
+
+ <Style x:Key="EditableCell" TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}">
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="{x:Type DataGridCell}">
+ <Grid Background="{TemplateBinding Background}">
+ <ContentPresenter VerticalAlignment="Center" Margin="8" />
+ </Grid>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ <Setter Property="BorderThickness" Value="0"/>
+ <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
+ <Setter Property="VerticalContentAlignment" Value="Center"></Setter>
+ <Style.Triggers>
+ <Trigger Property="IsSelected" Value="True">
+ <Setter Property="BorderThickness" Value="0"/>
+ <Setter Property="BorderBrush" Value="Cyan"/>
+ </Trigger>
+ </Style.Triggers>
+ </Style>
+
+ </UserControl.Resources>
+
+ <Grid Margin="20">
+ <DockPanel>
+ <Grid DockPanel.Dock="Top">
+ <StackPanel Orientation="Horizontal">
+ <Button Style="{StaticResource MaterialDesignFlatButton}" Height="Auto" Command="{Binding BackToCatalogsCommand}">
+ <materialDesign:PackIcon Kind="ArrowLeft" Width="50" Height="50" Foreground="#202020" ToolTip="Back to RML list" />
+ </Button>
+ <TextBlock Text="{Binding ActiveCatalog.Name}" VerticalAlignment="Center" Margin="10 0 0 0" FontSize="34"></TextBlock>
+ </StackPanel>
+
+ <Button HorizontalAlignment="Right" Width="170" Height="45" VerticalAlignment="Center" Command="{Binding SaveActiveCatalogCommand}">
+ <StackPanel Orientation="Horizontal">
+ <materialDesign:PackIcon Kind="ContentSaveAll" Width="24" Height="24" />
+ <TextBlock VerticalAlignment="Center" Margin="10 0 0 0">SAVE</TextBlock>
+ </StackPanel>
+ </Button>
+ </Grid>
+
+ <Grid Margin="0 20">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="113*"/>
+ <RowDefinition Height="358*"/>
+ </Grid.RowDefinitions>
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="302*"/>
+ <ColumnDefinition Width="399*"/>
+ <ColumnDefinition Width="1179*"/>
+ </Grid.ColumnDefinitions>
+
+ <Grid Margin="10">
+ <materialDesign:Card Background="{DynamicResource MaterialDesignBackground}" VerticalAlignment="Stretch">
+ <Border Padding="20">
+ <DockPanel>
+ <TextBlock DockPanel.Dock="Top" FontSize="16">PROPERTIES</TextBlock>
+ <controls:TableGrid RowHeight="35">
+ <TextBlock Text="Company:" ></TextBlock>
+ <TextBox Text="{Binding ActiveCatalog.Company}"></TextBox>
+
+ <TextBlock Text="Name:" ></TextBlock>
+ <TextBox Text="{Binding ActiveCatalog.Name,UpdateSourceTrigger=PropertyChanged}"></TextBox>
+
+ <TextBlock Text="Description:" ></TextBlock>
+ <TextBox Text="{Binding ActiveCatalog.Description}"></TextBox>
+
+ <TextBlock Text="Design:" ></TextBlock>
+ <ComboBox ItemsSource="{Binding Source={x:Type enumerations:CatalogDesignType},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding ActiveCatalog.Design}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"></ComboBox>
+
+ </controls:TableGrid>
+ </DockPanel>
+ </Border>
+ </materialDesign:Card>
+ </Grid>
+
+ <Grid Grid.Column="1" Margin="10">
+ <materialDesign:Card Background="{DynamicResource MaterialDesignBackground}" VerticalAlignment="Stretch">
+ <Border Padding="20">
+ <DockPanel>
+ <TextBlock DockPanel.Dock="Top" FontSize="16">DESIGN CONTENT</TextBlock>
+
+ </DockPanel>
+ </Border>
+ </materialDesign:Card>
+ </Grid>
+
+ <Grid Grid.ColumnSpan="3">
+
+ </Grid>
+ </Grid>
+
+ <Grid Grid.Row="1" Margin="0 20 0 0">
+ <Grid>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="300"/>
+ <ColumnDefinition Width="930"/>
+ <ColumnDefinition Width="1*"/>
+ </Grid.ColumnDefinitions>
+
+
+ <DockPanel Margin="10">
+ <TextBlock DockPanel.Dock="Top" FontSize="16">CATALOG GROUPS</TextBlock>
+
+ <materialDesign:Card Margin="0 5 0 0" Background="{DynamicResource MaterialDesignBackground}" VerticalAlignment="Stretch">
+ <DataGrid Style="{StaticResource EditableGrid}" CellStyle="{StaticResource EditableCell}" ItemsSource="{Binding ActiveCatalog.ColorCatalogsGroups}" SelectedItem="{Binding SelectedGroup}">
+ <DataGrid.Columns>
+ <DataGridTemplateColumn Header="" Width="Auto">
+ <DataGridTemplateColumn.CellTemplate>
+ <DataTemplate>
+ <Ellipse Width="30" Height="30">
+ <Ellipse.Fill>
+ <SolidColorBrush Color="{Binding Color}" />
+ </Ellipse.Fill>
+ </Ellipse>
+ </DataTemplate>
+ </DataGridTemplateColumn.CellTemplate>
+ </DataGridTemplateColumn>
+ <DataGridTextColumn Header="NAME" Binding="{Binding Name}" Width="1*" />
+ </DataGrid.Columns>
+ </DataGrid>
+ </materialDesign:Card>
+ </DockPanel>
+
+
+ <DockPanel Margin="10" Grid.Column="1">
+ <TextBlock DockPanel.Dock="Top" FontSize="16">
+ <Run>GROUP COLORS</Run>
+ <Run>(</Run><Run Text="{Binding SelectedGroup.ColorCatalogsItems.Count,Mode=OneWay}"></Run><Run>)</Run>
+ </TextBlock>
+ <materialDesign:Card Margin="0 5 0 0" Background="{DynamicResource MaterialDesignBackground}" VerticalAlignment="Stretch">
+ <DataGrid Style="{StaticResource EditableGrid}" CellStyle="{StaticResource EditableCell}" ItemsSource="{Binding SelectedGroup.ColorCatalogsItems}" SelectedItem="{Binding SelectedItem}">
+ <DataGrid.Columns>
+ <DataGridTemplateColumn Header="" Width="Auto">
+ <DataGridTemplateColumn.CellTemplate>
+ <DataTemplate>
+ <Ellipse Width="25" Height="25">
+ <Ellipse.Fill>
+ <SolidColorBrush Color="{Binding Color}" />
+ </Ellipse.Fill>
+ </Ellipse>
+ </DataTemplate>
+ </DataGridTemplateColumn.CellTemplate>
+ </DataGridTemplateColumn>
+ <DataGridTextColumn Header="CODE" Binding="{Binding Code}" Width="Auto" />
+ <DataGridTextColumn Header="NAME" Binding="{Binding Name}" Width="Auto" />
+
+ <DataGridTextColumn Header="R" Binding="{Binding Red,UpdateSourceTrigger=PropertyChanged}" Width="Auto" />
+ <DataGridTextColumn Header="G" Binding="{Binding Green,UpdateSourceTrigger=PropertyChanged}" Width="Auto" />
+ <DataGridTextColumn Header="B" Binding="{Binding Blue,UpdateSourceTrigger=PropertyChanged}" Width="Auto" />
+
+ <DataGridTextColumn Header="L" Binding="{Binding L}" Width="65" />
+ <DataGridTextColumn Header="A" Binding="{Binding A}" Width="65" />
+ <DataGridTextColumn Header="B" Binding="{Binding B}" Width="65" />
+
+ <DataGridTextColumn Header="CYAN" Binding="{Binding Cyan}" Width="65" />
+ <DataGridTextColumn Header="MAGENTA" Binding="{Binding Magenta}" Width="80" />
+ <DataGridTextColumn Header="YELLOW" Binding="{Binding Yellow}" Width="70" />
+ <DataGridTextColumn Header="BLACK" Binding="{Binding Black}" Width="65" />
+
+ <DataGridTextColumn Header="REGION" Binding="{Binding ProcessParametersTableIndex}" Width="Auto" />
+ </DataGrid.Columns>
+ </DataGrid>
+ </materialDesign:Card>
+ </DockPanel>
+
+ <DockPanel Margin="10" Grid.Column="2">
+ <TextBlock DockPanel.Dock="Top" FontSize="16">
+ <Run>COLOR MEDIA RECIPES</Run>
+ <Run>(</Run><Run Text="{Binding SelectedItem.ColorCatalogsItemsRecipes.Count,Mode=OneWay}"></Run><Run>)</Run>
+ </TextBlock>
+ <materialDesign:Card Margin="0 5 0 0" Background="{DynamicResource MaterialDesignBackground}" VerticalAlignment="Stretch">
+ <DataGrid Style="{StaticResource EditableGrid}" CellStyle="{StaticResource EditableCell}" ItemsSource="{Binding SelectedItem.ColorCatalogsItemsRecipes}">
+ <DataGrid.Columns>
+ <materialDesign:MaterialDataGridComboBoxColumn Header="MEDIA" Width="180" SortMemberPath="Name" ItemsSourceBinding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.RMLS}" SelectedItemBinding="{Binding Rml}" DisplayMemberPath="Name" />
+ <DataGridTextColumn Header="CYAN" Binding="{Binding Cyan}" Width="80" />
+ <DataGridTextColumn Header="MAGENTA" Binding="{Binding Magenta}" Width="80" />
+ <DataGridTextColumn Header="YELLOW" Binding="{Binding Yellow}" Width="80" />
+ <DataGridTextColumn Header="BLACK" Binding="{Binding Black}" Width="80" />
+ <DataGridTextColumn Header="REGION" Binding="{Binding ProcessParametersTableIndex}" Width="Auto" />
+ </DataGrid.Columns>
+ </DataGrid>
+ </materialDesign:Card>
+ </DockPanel>
+ </Grid>
+ </Grid>
+ </Grid>
+ </DockPanel>
</Grid>
</UserControl>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Views/CatalogView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Views/CatalogView.xaml.cs
index 02418b677..ad44d4c18 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Views/CatalogView.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Views/CatalogView.xaml.cs
@@ -12,17 +12,21 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
+using Tango.MachineStudio.Catalogs.ViewModels;
namespace Tango.MachineStudio.Catalogs.Views
{
/// <summary>
/// Interaction logic for CatalogsView.xaml
/// </summary>
- public partial class CatalogsView : UserControl
+ public partial class CatalogView : UserControl
{
- public CatalogsView()
+ private MainViewVM _vm;
+
+ public CatalogView()
{
InitializeComponent();
+ Loaded += (_, __) => _vm = DataContext as MainViewVM;
}
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Views/CatalogsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Views/CatalogsView.xaml
index e324fb8d7..dca9c0e96 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Views/CatalogsView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Views/CatalogsView.xaml
@@ -1,4 +1,4 @@
-<UserControl x:Class="Tango.MachineStudio.Catalogs.Views.CatalogView"
+<UserControl x:Class="Tango.MachineStudio.Catalogs.Views.CatalogsView"
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"
@@ -20,17 +20,17 @@
<Grid>
<DockPanel Margin="100" MaxWidth="1200">
<Grid DockPanel.Dock="Top">
- <Image Source="../Images/catalogs.png" Width="300" Margin="10" />
+ <Image Source="../Images/catalogs.png" Width="200" Margin="10" />
</Grid>
<Grid DockPanel.Dock="Bottom">
<StackPanel VerticalAlignment="Center" Orientation="Horizontal" HorizontalAlignment="Left" Margin="0 0 0 0">
- <Button Margin="0 0 10 0" MinWidth="160" Height="50" Background="#FF7575" BorderBrush="#FF7575" Command="{Binding RemoveRmlCommand}">
+ <Button Margin="0 0 10 0" MinWidth="160" Height="50" Background="#FF7575" BorderBrush="#FF7575" Command="{Binding DeleteCatalogCommand}">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Delete" Width="20" Height="20" />
<TextBlock Margin="5 0 0 0" FontSize="16">DELETE</TextBlock>
</StackPanel>
</Button>
- <Button Margin="0 0 10 0" MinWidth="160" Height="50" Background="#65C682" BorderBrush="#65C682" Command="{Binding AddRmlCommand}">
+ <Button Margin="0 0 10 0" MinWidth="160" Height="50" Background="#65C682" BorderBrush="#65C682" Command="{Binding NewCatalogCommand}">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Plus" Width="20" Height="20" />
<TextBlock Margin="5 0 0 0" FontSize="16">NEW CATALOG</TextBlock>
@@ -38,7 +38,7 @@
</Button>
</StackPanel>
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
- <Button Margin="50 0 0 0" MinWidth="200" Height="60" Command="{Binding ManageRmlCommand}">
+ <Button Margin="50 0 0 0" MinWidth="200" Height="60" Command="{Binding EditCatalogCommand}">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Pencil" Width="24" Height="24" />
<TextBlock Margin="10 0 0 0" FontSize="18">EDIT</TextBlock>
@@ -47,7 +47,7 @@
</StackPanel>
</Grid>
<Grid>
- <DataGrid Margin="0 0 0 10" BorderBrush="Silver" IsReadOnly="True" BorderThickness="1" Background="#93FFFFFF" AlternatingRowBackground="#C9F6F6F6" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding Rmls}" SelectedItem="{Binding SelectedRML}">
+ <DataGrid Margin="0 0 0 10" BorderBrush="Silver" IsReadOnly="True" BorderThickness="1" Background="#93FFFFFF" AlternatingRowBackground="#C9F6F6F6" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding Catalogs}" SelectedItem="{Binding SelectedCatalog}">
<DataGrid.CellStyle>
<Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}">
<Setter Property="BorderThickness" Value="0"/>
@@ -63,10 +63,12 @@
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>-->
+ <DataGridTextColumn Header="COMPANY" Binding="{Binding Name}" Width="Auto" />
<DataGridTextColumn Header="NAME" Binding="{Binding Name}" Width="Auto" />
- <DataGridTextColumn Header="DESCRIPTION" Binding="{Binding Description}" Width="Auto" />
- <DataGridTextColumn Header="COLORS" Binding="{Binding Description}" Width="Auto" />
- <DataGridTextColumn Header="SUPPORTED MEDIA" Binding="{Binding Description}" Width="Auto" />
+ <DataGridTextColumn Header="DESCRIPTION" Binding="{Binding Name}" Width="Auto" />
+ <DataGridTextColumn Header="DESIGN" Binding="{Binding Design}" Width="Auto" />
+ <DataGridTextColumn Header="GROUPS" Binding="{Binding ColorCatalogsGroups.Count}" Width="Auto" />
+ <DataGridTextColumn Header="COLORS" Binding="{Binding TotalColors}" Width="Auto" />
<DataGridTextColumn Header="LAST UPDATED" Binding="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" Width="1*" />
</DataGrid.Columns>
</DataGrid>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Views/CatalogsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Views/CatalogsView.xaml.cs
index 302ff59f7..02418b677 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Views/CatalogsView.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Views/CatalogsView.xaml.cs
@@ -18,9 +18,9 @@ namespace Tango.MachineStudio.Catalogs.Views
/// <summary>
/// Interaction logic for CatalogsView.xaml
/// </summary>
- public partial class CatalogView : UserControl
+ public partial class CatalogsView : UserControl
{
- public CatalogView()
+ public CatalogsView()
{
InitializeComponent();
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Views/MainView.xaml
index 3a1d04e3d..140a616e1 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Views/MainView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Views/MainView.xaml
@@ -9,7 +9,7 @@
xmlns:global="clr-namespace:Tango.MachineStudio.Catalogs"
mc:Ignorable="d"
d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" Foreground="#BBBBBB" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}">
- <Grid>
+ <Grid IsEnabled="{Binding IsFree}">
<controls:NavigationControl x:Name="navigationControl" TransitionType="Slide">
<local:CatalogsView />
<local:CatalogView/>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Views/MainView.xaml.cs
index c94282ca1..fdfd23c2b 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Views/MainView.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/Views/MainView.xaml.cs
@@ -12,6 +12,7 @@ using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
+using Tango.Core.DI;
using Tango.MachineStudio.Catalogs.Contracts;
namespace Tango.MachineStudio.Catalogs.Views
@@ -24,6 +25,7 @@ namespace Tango.MachineStudio.Catalogs.Views
public MainView()
{
InitializeComponent();
+ TangoIOC.Default.Register<IMainView>(this);
}
public void NavigateTo(CatalogsNavigationView view)