aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB
diff options
context:
space:
mode:
authorRoy <roy.mail.net@gmail.com>2017-12-26 23:55:41 +0200
committerRoy <roy.mail.net@gmail.com>2017-12-26 23:55:41 +0200
commit9d12fd0ba222619dd5b42816ed004c7b762809dd (patch)
treebf8c2dd95f70484f9f8474ab44d4918ef2b30f44 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB
parent03caa4c6a2807e461edd98fc377498674e83c15c (diff)
downloadTango-9d12fd0ba222619dd5b42816ed004c7b762809dd.tar.gz
Tango-9d12fd0ba222619dd5b42816ed004c7b762809dd.zip
Added CCT & CAT to DB Module !
Implemented "deep filtering" on db module search.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/ByteArrayToFileSizeConverter.cs34
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj31
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModelLocator.cs19
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/CatsViewVM.cs41
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/CctsViewVM.cs75
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DbTableViewModel.cs50
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CatView.xaml62
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CatView.xaml.cs28
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CatsView.xaml43
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CatsView.xaml.cs32
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CctView.xaml58
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CctView.xaml.cs28
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CctsView.xaml36
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CctsView.xaml.cs32
14 files changed, 557 insertions, 12 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/ByteArrayToFileSizeConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/ByteArrayToFileSizeConverter.cs
new file mode 100644
index 000000000..8a690450c
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Converters/ByteArrayToFileSizeConverter.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Data;
+
+namespace Tango.MachineStudio.DB.Converters
+{
+ public class ByteArrayToFileSizeConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ return BytesToString((int)value);
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+
+ static String BytesToString(long byteCount)
+ {
+ string[] suf = { "B", "KB", "MB", "GB", "TB", "PB", "EB" }; //Longs run out around EB
+ if (byteCount == 0)
+ return "0" + suf[0];
+ long bytes = Math.Abs(byteCount);
+ int place = System.Convert.ToInt32(Math.Floor(Math.Log(bytes, 1024)));
+ double num = Math.Round(bytes / Math.Pow(1024, place), 1);
+ return (Math.Sign(byteCount) * num).ToString() + suf[place];
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj
index 12af196bc..01cd9d1a9 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj
@@ -87,6 +87,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
+ <Compile Include="Converters\ByteArrayToFileSizeConverter.cs" />
<Compile Include="Converters\EventTypeActionsToStringConverter.cs" />
<Compile Include="Converters\LiquidTypeRmlsToStringConverter.cs" />
<Compile Include="Converters\RolesPermissionsToStringConverter.cs" />
@@ -101,6 +102,8 @@
<Compile Include="ViewModels\ApplicationVersionsViewVM.cs" />
<Compile Include="ViewModels\CartridgesViewVM.cs" />
<Compile Include="ViewModels\CartridgeTypesViewVM.cs" />
+ <Compile Include="ViewModels\CatsViewVM.cs" />
+ <Compile Include="ViewModels\CctsViewVM.cs" />
<Compile Include="ViewModels\ConfigurationsViewVM.cs" />
<Compile Include="ViewModels\ContactsViewVM.cs" />
<Compile Include="ViewModels\DbTableViewModel.cs" />
@@ -137,6 +140,18 @@
<Compile Include="Views\DBViews\ActionTypeView.xaml.cs">
<DependentUpon>ActionTypeView.xaml</DependentUpon>
</Compile>
+ <Compile Include="Views\DBViews\CatsView.xaml.cs">
+ <DependentUpon>CatsView.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="Views\DBViews\CctsView.xaml.cs">
+ <DependentUpon>CctsView.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="Views\DBViews\CatView.xaml.cs">
+ <DependentUpon>CatView.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="Views\DBViews\CctView.xaml.cs">
+ <DependentUpon>CctView.xaml</DependentUpon>
+ </Compile>
<Compile Include="Views\DBViews\RmlView.xaml.cs">
<DependentUpon>RmlView.xaml</DependentUpon>
</Compile>
@@ -352,6 +367,22 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
+ <Page Include="Views\DBViews\CatsView.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
+ <Page Include="Views\DBViews\CctsView.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
+ <Page Include="Views\DBViews\CatView.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
+ <Page Include="Views\DBViews\CctView.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
<Page Include="Views\DBViews\RmlView.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModelLocator.cs
index fa4139389..857f0d3cf 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModelLocator.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModelLocator.cs
@@ -55,6 +55,9 @@ namespace Tango.MachineStudio.DB
SimpleIoc.Default.Register<FiberShapesViewVM>();
SimpleIoc.Default.Register<FiberSynthsViewVM>();
SimpleIoc.Default.Register<RmlsViewVM>();
+
+ SimpleIoc.Default.Register<CctsViewVM>();
+ SimpleIoc.Default.Register<CatsViewVM>();
}
public static MainViewVM MainViewVM
@@ -320,5 +323,21 @@ namespace Tango.MachineStudio.DB
return ServiceLocator.Current.GetInstance<RmlsViewVM>();
}
}
+
+ public static CctsViewVM CctsViewVM
+ {
+ get
+ {
+ return ServiceLocator.Current.GetInstance<CctsViewVM>();
+ }
+ }
+
+ public static CatsViewVM CatsViewVM
+ {
+ get
+ {
+ return ServiceLocator.Current.GetInstance<CatsViewVM>();
+ }
+ }
}
} \ No newline at end of file
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/CatsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/CatsViewVM.cs
new file mode 100644
index 000000000..74a7e29eb
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/CatsViewVM.cs
@@ -0,0 +1,41 @@
+using Microsoft.Win32;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Core.Commands;
+using Tango.DAL.Observables;
+using Tango.MachineStudio.Common.Notifications;
+
+namespace Tango.MachineStudio.DB.ViewModels
+{
+ public class CatsViewVM : DbTableViewModel<Cat>
+ {
+ public CatsViewVM(INotificationProvider notification) : base(notification)
+ {
+ SelectDataFileCommand = new RelayCommand(SelectDataFile);
+ }
+
+ public RelayCommand SelectDataFileCommand { get; set; }
+
+ private void SelectDataFile()
+ {
+ OpenFileDialog dlg = new OpenFileDialog();
+ dlg.Filter = "Color Adjustment Files|*.CAT";
+ dlg.Title = "Select Color Adjustment File";
+ if (dlg.ShowDialog().Value)
+ {
+ try
+ {
+ EditEntity.Data = File.ReadAllBytes(dlg.FileName);
+ }
+ catch (Exception ex)
+ {
+ _notification.ShowError(ex.Message);
+ }
+ }
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/CctsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/CctsViewVM.cs
new file mode 100644
index 000000000..02d7c351d
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/CctsViewVM.cs
@@ -0,0 +1,75 @@
+using Microsoft.Win32;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.Core.Commands;
+using Tango.DAL.Observables;
+using Tango.MachineStudio.Common.Notifications;
+
+namespace Tango.MachineStudio.DB.ViewModels
+{
+ public class CctsViewVM : DbTableViewModel<Cct>
+ {
+ public CctsViewVM(INotificationProvider notification) : base(notification)
+ {
+ SelectForwardFileCommand = new RelayCommand(SelectForwardFile);
+ SelectInverseFileCommand = new RelayCommand(SelectInverseFile);
+ }
+
+ public RelayCommand SelectForwardFileCommand { get; set; }
+
+ public RelayCommand SelectInverseFileCommand { get; set; }
+
+ private void SelectInverseFile()
+ {
+ String file = SelectFile();
+ if (file != null)
+ {
+ try
+ {
+ EditEntity.InverseData = File.ReadAllBytes(file);
+ EditEntity.InverseFileName = Path.GetFileName(file);
+ }
+ catch (Exception ex)
+ {
+ _notification.ShowError(ex.Message);
+ }
+ }
+ }
+
+ private void SelectForwardFile()
+ {
+ String file = SelectFile();
+ if (file != null)
+ {
+ try
+ {
+ EditEntity.ForwardData = File.ReadAllBytes(file);
+ EditEntity.ForwardFileName = Path.GetFileName(file);
+ }
+ catch (Exception ex)
+ {
+ _notification.ShowError(ex.Message);
+ }
+ }
+ }
+
+ private String SelectFile()
+ {
+ OpenFileDialog dlg = new OpenFileDialog();
+ dlg.Filter = "Color Conversion Files|*.CCT";
+ dlg.Title = "Select Color Conversion File";
+ if (dlg.ShowDialog().Value)
+ {
+ return dlg.FileName;
+ }
+ else
+ {
+ return null;
+ }
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DbTableViewModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DbTableViewModel.cs
index e472e312a..bc8d54ce9 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DbTableViewModel.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DbTableViewModel.cs
@@ -20,7 +20,7 @@ namespace Tango.MachineStudio.DB.ViewModels
{
public abstract class DbTableViewModel<T> : ViewModel, IShutdownRequestBlocker where T : class, IObservableEntity
{
- private INotificationProvider _notification;
+ protected INotificationProvider _notification;
/// <summary>
/// Initializes a new instance of the <see cref="DbTableViewModel"/> class.
@@ -156,11 +156,11 @@ namespace Tango.MachineStudio.DB.ViewModels
{
using (_notification.PushTaskItem("Saving changes to database..."))
{
- var dependenctEntities = SelectedEntity.GetDependentEntitiesNameAndGuid();
+ var dependenctEntities = SelectedEntity.GetDependentEntitiesNameAndGuid();
if (dependenctEntities.Count > 0)
{
- _notification.ShowError("The selected entity is being used by " + dependenctEntities.Count + " other entities." + Environment.NewLine + "Please delete any dependencies and try again." + Environment.NewLine + Environment.NewLine + String.Join(Environment.NewLine,dependenctEntities.Select(x => x.Key + ", ID: " + x.Value)));
+ _notification.ShowError("The selected entity is being used by " + dependenctEntities.Count + " other entities." + Environment.NewLine + "Please delete any dependencies and try again." + Environment.NewLine + Environment.NewLine + String.Join(Environment.NewLine, dependenctEntities.Select(x => x.Key + ", ID: " + x.Value)));
return;
}
@@ -293,18 +293,44 @@ namespace Tango.MachineStudio.DB.ViewModels
collectionView.Filter = (entity) =>
{
- return
- entity.
- GetType().
- GetProperties(BindingFlags.Public | BindingFlags.Instance).
- Where(x => x.Name != "Deleted" && x.Name != "ID" && x.Name != "LastUpdated").
- Where(x => !x.PropertyType.IsGenericType && (x.PropertyType.IsClass || x.PropertyType == typeof(String))).
- Select(prop => prop.GetValue(entity).ToString()).
- ToList().
- Any(x => x.ToLower().Contains(filter.ToLower()));
+ return FilterEntity((T)entity, filter);
};
}
+ private bool FilterEntity(T entity, String filter)
+ {
+ foreach (var prop in entity.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => x.PropertyType.IsClass && x.PropertyType != typeof(String) && x.PropertyType != typeof(byte[]) && !x.PropertyType.IsGenericType))
+ {
+ object obj = prop.GetValue(entity);
+
+ if (obj != null)
+ {
+ foreach (var innerProp in obj.GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance).Where(x => x.Name != "Deleted" && x.Name != "ID" && x.Name != "LastUpdated").Where(x => !x.PropertyType.IsGenericType && (x.PropertyType.IsClass || x.PropertyType == typeof(String))))
+ {
+ object value = innerProp.GetValue(obj);
+
+ if (value != null)
+ {
+ if (value.ToString().ToLower().Contains(filter.ToLower()))
+ {
+ return true;
+ }
+ }
+ }
+ }
+ }
+
+ return
+ entity.
+ GetType().
+ GetProperties(BindingFlags.Public | BindingFlags.Instance).
+ Where(x => x.Name != "Deleted" && x.Name != "ID" && x.Name != "LastUpdated").
+ Where(x => !x.PropertyType.IsGenericType && (x.PropertyType.IsClass || x.PropertyType == typeof(String))).
+ Select(prop => prop.GetValue(entity).ToString()).
+ ToList().
+ Any(x => x.ToLower().Contains(filter.ToLower()));
+ }
+
protected virtual void InitializeEntity(T entity)
{
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CatView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CatView.xaml
new file mode 100644
index 000000000..442f77ae3
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CatView.xaml
@@ -0,0 +1,62 @@
+<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.CatView"
+ 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:mahapps="http://metro.mahapps.com/winfx/xaml/controls"
+ xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls"
+ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
+ xmlns:colorPicker="clr-namespace:Tango;assembly=Tango.ColorPicker"
+ xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
+ xmlns:localConverters="clr-namespace:Tango.MachineStudio.DB.Converters"
+ xmlns:vm="clr-namespace:Tango.MachineStudio.DB.ViewModels"
+ xmlns:local="clr-namespace:Tango.MachineStudio.DB.Views.DBViews"
+ mc:Ignorable="d"
+ d:DesignHeight="400" d:DesignWidth="300" d:DataContext="{d:DesignInstance Type=vm:CatsViewVM, IsDesignTimeCreatable=False}">
+
+ <UserControl.Resources>
+ <converters:ColorToIntegerConverter x:Key="ColorToIntegerConverter"></converters:ColorToIntegerConverter>
+ <localConverters:ByteArrayToFileSizeConverter x:Key="ByteArrayToFileSizeConverter"></localConverters:ByteArrayToFileSizeConverter>
+ </UserControl.Resources>
+
+ <Grid>
+ <controls:TableGrid>
+ <TextBlock Text="ID:" FontWeight="Bold"></TextBlock>
+ <TextBox Text="{Binding EditEntity.ID}" IsReadOnly="True"></TextBox>
+ <TextBlock Text="GUID:" FontWeight="Bold"></TextBlock>
+ <TextBox Text="{Binding EditEntity.Guid}" IsReadOnly="True"></TextBox>
+ <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock>
+ <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True"></TextBox>
+
+ <TextBlock Text="Liquid Type:" FontWeight="Bold"></TextBlock>
+ <ComboBox ItemsSource="{Binding Adapter.LiquidTypes}" SelectedItem="{Binding EditEntity.LiquidTypes,Mode=TwoWay}">
+ <ComboBox.ItemTemplate>
+ <DataTemplate>
+ <StackPanel Orientation="Horizontal">
+ <Rectangle Width="16" Height="16" VerticalAlignment="Center">
+ <Rectangle.Fill>
+ <SolidColorBrush Color="{Binding Color,Converter={StaticResource ColorToIntegerConverter}}"></SolidColorBrush>
+ </Rectangle.Fill>
+ </Rectangle>
+ <TextBlock Margin="5 0 0 0" Text="{Binding Name}" VerticalAlignment="Center"></TextBlock>
+ </StackPanel>
+ </DataTemplate>
+ </ComboBox.ItemTemplate>
+ </ComboBox>
+
+ <TextBlock Text="Machine:" FontWeight="Bold"></TextBlock>
+ <ComboBox ItemsSource="{Binding Adapter.Machines}" SelectedItem="{Binding EditEntity.Machine,Mode=TwoWay}" DisplayMemberPath="SerialNumber"></ComboBox>
+
+ <TextBlock Text="Calibration Data:" FontWeight="Bold"></TextBlock>
+ <DockPanel LastChildFill="False">
+ <TextBlock DockPanel.Dock="Left" Margin="0 0 0 -15" VerticalAlignment="Center" Text="{Binding EditEntity.Data.Length,Converter={StaticResource ByteArrayToFileSizeConverter},TargetNullValue=NONE,FallbackValue=NONE}"></TextBlock>
+ <Button DockPanel.Dock="Right" Margin="0 0 0 -2" Style="{StaticResource MaterialDesignFlatButton}" ToolTip="Select File" Padding="5 0 5 0" Command="{Binding SelectDataFileCommand}">
+ <StackPanel Orientation="Horizontal">
+ <TextBlock VerticalAlignment="Center">BROWSE</TextBlock>
+ <materialDesign:PackIcon Margin="5 0 0 0" Kind="FolderOutline" Width="24" Height="24"></materialDesign:PackIcon>
+ </StackPanel>
+ </Button>
+ </DockPanel>
+ </controls:TableGrid>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CatView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CatView.xaml.cs
new file mode 100644
index 000000000..9e389feb3
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CatView.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.MachineStudio.DB.Views.DBViews
+{
+ /// <summary>
+ /// Interaction logic for MachineView.xaml
+ /// </summary>
+ public partial class CatView : UserControl
+ {
+ public CatView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CatsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CatsView.xaml
new file mode 100644
index 000000000..d88a2a142
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CatsView.xaml
@@ -0,0 +1,43 @@
+<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.CatsView"
+ 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:global="clr-namespace:Tango.MachineStudio.DB"
+ xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls"
+ xmlns:converters="clr-namespace:Tango.MachineStudio.DB.Converters"
+ xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
+ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
+ mc:Ignorable="d"
+ d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.CatsViewVM}">
+
+ <UserControl.Resources>
+ <converters:ByteArrayToFileSizeConverter x:Key="ByteArrayToFileSizeConverter"></converters:ByteArrayToFileSizeConverter>
+ <sharedConverters:ColorToIntegerConverter x:Key="ColorToIntegerConverter"></sharedConverters:ColorToIntegerConverter>
+ </UserControl.Resources>
+
+ <Grid>
+ <controls:DbTableView>
+ <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.CatsViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsReadOnly="True">
+ <DataGrid.Columns>
+ <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn>
+ <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn>
+ <DataGridTextColumn Header="Liquid Type" Binding="{Binding LiquidTypes.Name}"></DataGridTextColumn>
+ <DataGridTemplateColumn Header="Liquid Type Color">
+ <DataGridTemplateColumn.CellTemplate>
+ <DataTemplate>
+ <Rectangle Width="50">
+ <Rectangle.Fill>
+ <SolidColorBrush Color="{Binding LiquidTypes.Color,Converter={StaticResource ColorToIntegerConverter},Mode=TwoWay}"></SolidColorBrush>
+ </Rectangle.Fill>
+ </Rectangle>
+ </DataTemplate>
+ </DataGridTemplateColumn.CellTemplate>
+ </DataGridTemplateColumn>
+ <DataGridTextColumn Header="Machine" Binding="{Binding Machine.SerialNumber}"></DataGridTextColumn>
+ <DataGridTextColumn Header="Calibration Data Size" Binding="{Binding Data.Length,Converter={StaticResource ByteArrayToFileSizeConverter}}"></DataGridTextColumn>
+ </DataGrid.Columns>
+ </DataGrid>
+ </controls:DbTableView>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CatsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CatsView.xaml.cs
new file mode 100644
index 000000000..ec9dae44f
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CatsView.xaml.cs
@@ -0,0 +1,32 @@
+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.MachineStudio.DB.CustomAttributes;
+using Tango.MachineStudio.DB.Managers;
+using Tango.SharedUI.Controls;
+
+namespace Tango.MachineStudio.DB.Views.DBViews
+{
+ /// <summary>
+ /// Interaction logic for MachinesView.xaml
+ /// </summary>
+ [DBView]
+ public partial class CatsView : UserControl
+ {
+ public CatsView() : base()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CctView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CctView.xaml
new file mode 100644
index 000000000..a5bfc2f14
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CctView.xaml
@@ -0,0 +1,58 @@
+<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.CctView"
+ 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:mahapps="http://metro.mahapps.com/winfx/xaml/controls"
+ xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls"
+ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
+ xmlns:colorPicker="clr-namespace:Tango;assembly=Tango.ColorPicker"
+ xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
+ xmlns:vm="clr-namespace:Tango.MachineStudio.DB.ViewModels"
+ xmlns:local="clr-namespace:Tango.MachineStudio.DB.Views.DBViews"
+ mc:Ignorable="d"
+ d:DesignHeight="400" d:DesignWidth="300" d:DataContext="{d:DesignInstance Type=vm:CctsViewVM, IsDesignTimeCreatable=False}">
+
+ <Grid>
+ <controls:TableGrid>
+ <TextBlock Text="ID:" FontWeight="Bold"></TextBlock>
+ <TextBox Text="{Binding EditEntity.ID}" IsReadOnly="True"></TextBox>
+ <TextBlock Text="GUID:" FontWeight="Bold"></TextBlock>
+ <TextBox Text="{Binding EditEntity.Guid}" IsReadOnly="True"></TextBox>
+ <TextBlock Text="Last Updated:" FontWeight="Bold"></TextBlock>
+ <TextBox Text="{Binding EditEntity.LastUpdated}" IsReadOnly="True"></TextBox>
+ <TextBlock Text="Name:" FontWeight="Bold"></TextBlock>
+ <TextBox Text="{Binding EditEntity.Name}"></TextBox>
+ <TextBlock Text="Description:" FontWeight="Bold"></TextBlock>
+ <TextBox Text="{Binding EditEntity.Description}"></TextBox>
+
+ <TextBlock Text="Forward File:" FontWeight="Bold"></TextBlock>
+ <DockPanel LastChildFill="False">
+ <TextBlock DockPanel.Dock="Left" VerticalAlignment="Center" Text="{Binding EditEntity.ForwardFileName,TargetNullValue=NONE}"></TextBlock>
+ <Button DockPanel.Dock="Right" Style="{StaticResource MaterialDesignFlatButton}" ToolTip="Select File" Padding="5 0 5 0" Command="{Binding SelectForwardFileCommand}">
+ <StackPanel Orientation="Horizontal">
+ <TextBlock VerticalAlignment="Center">BROWSE</TextBlock>
+ <materialDesign:PackIcon Margin="5 0 0 0" Kind="FolderOutline" Width="24" Height="24"></materialDesign:PackIcon>
+ </StackPanel>
+ </Button>
+ </DockPanel>
+
+ <TextBlock Text="Inverse File:" FontWeight="Bold"></TextBlock>
+ <DockPanel LastChildFill="False">
+ <TextBlock DockPanel.Dock="Left" VerticalAlignment="Center" Text="{Binding EditEntity.InverseFileName,TargetNullValue=NONE}"></TextBlock>
+ <Button DockPanel.Dock="Right" Style="{StaticResource MaterialDesignFlatButton}" ToolTip="Select File" Padding="5 0 5 0" Command="{Binding SelectInverseFileCommand}">
+ <StackPanel Orientation="Horizontal">
+ <TextBlock VerticalAlignment="Center">BROWSE</TextBlock>
+ <materialDesign:PackIcon Margin="5 0 0 0" Kind="FolderOutline" Width="24" Height="24"></materialDesign:PackIcon>
+ </StackPanel>
+ </Button>
+ </DockPanel>
+
+ <TextBlock Text="Version:" FontWeight="Bold"></TextBlock>
+ <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding EditEntity.Version,Mode=TwoWay}"></mahapps:NumericUpDown>
+
+ <TextBlock Text="Recommended Media:" FontWeight="Bold"></TextBlock>
+ <ComboBox ItemsSource="{Binding Adapter.Rmls}" SelectedItem="{Binding EditEntity.Rml,Mode=TwoWay}" DisplayMemberPath="Name"></ComboBox>
+ </controls:TableGrid>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CctView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CctView.xaml.cs
new file mode 100644
index 000000000..1a6ee6da7
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CctView.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.MachineStudio.DB.Views.DBViews
+{
+ /// <summary>
+ /// Interaction logic for MachineView.xaml
+ /// </summary>
+ public partial class CctView : UserControl
+ {
+ public CctView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CctsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CctsView.xaml
new file mode 100644
index 000000000..09962447c
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CctsView.xaml
@@ -0,0 +1,36 @@
+<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.CctsView"
+ 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:global="clr-namespace:Tango.MachineStudio.DB"
+ xmlns:controls="clr-namespace:Tango.MachineStudio.DB.Controls"
+ xmlns:converters="clr-namespace:Tango.MachineStudio.DB.Converters"
+ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
+ mc:Ignorable="d"
+ d:DesignHeight="720" d:DesignWidth="1280" Background="White" DataContext="{x:Static global:ViewModelLocator.CctsViewVM}">
+
+ <UserControl.Resources>
+ <converters:ByteArrayToFileSizeConverter x:Key="ByteArrayToFileSizeConverter"></converters:ByteArrayToFileSizeConverter>
+ </UserControl.Resources>
+
+
+ <Grid>
+ <controls:DbTableView>
+ <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.CctsViewSource}" SelectedItem="{Binding SelectedEntity}" AutoGenerateColumns="False" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" IsReadOnly="True">
+ <DataGrid.Columns>
+ <DataGridTextColumn Header="ID" Binding="{Binding ID}"></DataGridTextColumn>
+ <DataGridTextColumn Header="GUID" Binding="{Binding Guid}"></DataGridTextColumn>
+ <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn>
+ <DataGridTextColumn Header="Description" Binding="{Binding Description}"></DataGridTextColumn>
+ <DataGridTextColumn Header="Forward File" Binding="{Binding ForwardFileName}"></DataGridTextColumn>
+ <DataGridTextColumn Header="Forward File Size" Binding="{Binding ForwardData.Length,Converter={StaticResource ByteArrayToFileSizeConverter}}"></DataGridTextColumn>
+ <DataGridTextColumn Header="Inverse File" Binding="{Binding InverseFileName}"></DataGridTextColumn>
+ <DataGridTextColumn Header="Inverse File Size" Binding="{Binding InverseData.Length,Converter={StaticResource ByteArrayToFileSizeConverter}}"></DataGridTextColumn>
+ <DataGridTextColumn Header="Version" Binding="{Binding Version}"></DataGridTextColumn>
+ <DataGridTextColumn Header="RML" Binding="{Binding Rml.Name}"></DataGridTextColumn>
+ </DataGrid.Columns>
+ </DataGrid>
+ </controls:DbTableView>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CctsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CctsView.xaml.cs
new file mode 100644
index 000000000..fa4d80bd2
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/CctsView.xaml.cs
@@ -0,0 +1,32 @@
+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.MachineStudio.DB.CustomAttributes;
+using Tango.MachineStudio.DB.Managers;
+using Tango.SharedUI.Controls;
+
+namespace Tango.MachineStudio.DB.Views.DBViews
+{
+ /// <summary>
+ /// Interaction logic for MachinesView.xaml
+ /// </summary>
+ [DBView]
+ public partial class CctsView : UserControl
+ {
+ public CctsView() : base()
+ {
+ InitializeComponent();
+ }
+ }
+}