aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio
diff options
context:
space:
mode:
authorRoy <roy.mail.net@gmail.com>2018-01-27 22:57:48 +0200
committerRoy <roy.mail.net@gmail.com>2018-01-27 22:57:48 +0200
commitbfc6aeabda4b320f9365f5eef4c8f1bcab9b24af (patch)
tree9dc44c02e8f4128232f0c4c4ae87115221131605 /Software/Visual_Studio/MachineStudio
parent20482140c124fd1d5caaffcc9b0dfe853b30dd6f (diff)
downloadTango-bfc6aeabda4b320f9365f5eef4c8f1bcab9b24af.tar.gz
Tango-bfc6aeabda4b320f9365f5eef4c8f1bcab9b24af.zip
Added IDS_PACK_FORMULA.
Added necessary login to machine designer & db module. Started working on job segments.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Tango.MachineStudio.DB.csproj15
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModelLocator.cs9
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/DbTableViewModel.cs17
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/IdsPackFormulasViewVM.cs17
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackFormulaView.xaml33
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackFormulaView.xaml.cs28
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackFormulasView.xaml31
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackFormulasView.xaml.cs32
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackView.xaml13
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPacksView.xaml3
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/ruler.pngbin0 -> 1110 bytes
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/segment-single.pngbin0 -> 535 bytes
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/segment.pngbin0 -> 1610 bytes
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj9
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs104
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml86
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Images/formula.pngbin0 -> 853 bytes
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj3
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs12
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml36
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml.cs8
21 files changed, 444 insertions, 12 deletions
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 54c29f7f3..c17c43aa0 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
@@ -114,6 +114,7 @@
<Compile Include="ViewModels\FiberShapesViewVM.cs" />
<Compile Include="ViewModels\FiberSynthsViewVM.cs" />
<Compile Include="ViewModels\HardwareVersionsViewVM.cs" />
+ <Compile Include="ViewModels\IdsPackFormulasViewVM.cs" />
<Compile Include="ViewModels\IdsPacksViewVM.cs" />
<Compile Include="ViewModels\LinearMassDensityUnitsViewVM.cs" />
<Compile Include="ViewModels\LiquidTypesRmlsViewVM.cs" />
@@ -142,6 +143,12 @@
<Compile Include="Views\DBViews\ActionTypeView.xaml.cs">
<DependentUpon>ActionTypeView.xaml</DependentUpon>
</Compile>
+ <Compile Include="Views\DBViews\IdsPackFormulasView.xaml.cs">
+ <DependentUpon>IdsPackFormulasView.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="Views\DBViews\IdsPackFormulaView.xaml.cs">
+ <DependentUpon>IdsPackFormulaView.xaml</DependentUpon>
+ </Compile>
<Compile Include="Views\DBViews\ProcessParametersTablesGroupsView.xaml.cs">
<DependentUpon>ProcessParametersTablesGroupsView.xaml</DependentUpon>
</Compile>
@@ -378,6 +385,14 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
+ <Page Include="Views\DBViews\IdsPackFormulasView.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
+ <Page Include="Views\DBViews\IdsPackFormulaView.xaml">
+ <Generator>MSBuild:Compile</Generator>
+ <SubType>Designer</SubType>
+ </Page>
<Page Include="Views\DBViews\ProcessParametersTablesGroupsView.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 8a7afc067..46223d9f4 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModelLocator.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModelLocator.cs
@@ -36,6 +36,7 @@ namespace Tango.MachineStudio.DB
SimpleIoc.Default.Register<HardwareVersionsViewVM>();
SimpleIoc.Default.Register<IdsPacksViewVM>();
+ SimpleIoc.Default.Register<IdsPackFormulasViewVM>();
SimpleIoc.Default.Register<DispenserTypesViewVM>();
SimpleIoc.Default.Register<LiquidTypesViewVM>();
SimpleIoc.Default.Register<CartridgeTypesViewVM>();
@@ -358,5 +359,13 @@ namespace Tango.MachineStudio.DB
return ServiceLocator.Current.GetInstance<ProcessParametersTablesGroupsViewVM>();
}
}
+
+ public static IdsPackFormulasViewVM IdsPackFormulasViewVM
+ {
+ get
+ {
+ return ServiceLocator.Current.GetInstance<IdsPackFormulasViewVM>();
+ }
+ }
}
} \ No newline at end of file
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 ae4fa8a07..e1be2aa9b 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
@@ -156,14 +156,6 @@ namespace Tango.MachineStudio.DB.ViewModels
{
using (_notification.PushTaskItem("Saving changes to database..."))
{
- //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)));
- // return;
- //}
-
try
{
await SelectedEntity.DeleteAsync();
@@ -226,12 +218,21 @@ namespace Tango.MachineStudio.DB.ViewModels
using (_notification.PushTaskItem("Saving changes to database..."))
{
+ if (mode == DialogOpenMode.Adding)
+ {
+ entity.Attach();
+ }
+
try
{
await entity.SaveAsync();
}
catch (DbUpdateException ex)
{
+ if (mode == DialogOpenMode.Adding)
+ {
+ entity.Detach();
+ }
Adapter.Invalidate();
_notification.ShowError("Could not save entity." + Environment.NewLine + ex.InnerException.InnerException != null ? ex.InnerException.InnerException.Message : ex.InnerException.Message);
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/IdsPackFormulasViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/IdsPackFormulasViewVM.cs
new file mode 100644
index 000000000..a2763a257
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/ViewModels/IdsPackFormulasViewVM.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.DAL.Observables;
+using Tango.MachineStudio.Common.Notifications;
+
+namespace Tango.MachineStudio.DB.ViewModels
+{
+ public class IdsPackFormulasViewVM : DbTableViewModel<IdsPackFormula>
+ {
+ public IdsPackFormulasViewVM(INotificationProvider notification) : base(notification)
+ {
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackFormulaView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackFormulaView.xaml
new file mode 100644
index 000000000..83b2cc3d7
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackFormulaView.xaml
@@ -0,0 +1,33 @@
+<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.IdsPackFormulaView"
+ 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: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:IdsPackFormulasViewVM, 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="Code:" FontWeight="Bold"></TextBlock>
+ <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding EditEntity.Code,Mode=TwoWay}"></mahapps:NumericUpDown>
+ <TextBlock Text="Name:" FontWeight="Bold"></TextBlock>
+ <TextBox Text="{Binding EditEntity.Name,Mode=TwoWay}"></TextBox>
+ <TextBlock Text="Description:" FontWeight="Bold"></TextBlock>
+ <TextBox Text="{Binding EditEntity.Description,Mode=TwoWay}"></TextBox>
+ <TextBlock Text="Auto Calculated:" FontWeight="Bold"></TextBlock>
+ <ToggleButton HorizontalAlignment="Right" IsChecked="{Binding EditEntity.AutoCalculated}"></ToggleButton>
+ </controls:TableGrid>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackFormulaView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackFormulaView.xaml.cs
new file mode 100644
index 000000000..4c289ddd2
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackFormulaView.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 IdsPackFormulaView : UserControl
+ {
+ public IdsPackFormulaView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackFormulasView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackFormulasView.xaml
new file mode 100644
index 000000000..81c9124f3
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackFormulasView.xaml
@@ -0,0 +1,31 @@
+<UserControl x:Class="Tango.MachineStudio.DB.Views.DBViews.IdsPackFormulasView"
+ 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.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.IdsPackFormulasViewVM}">
+
+ <UserControl.Resources>
+ <converters:BooleanToYesNoConverter x:Key="BooleanToYesNoConverter" />
+ </UserControl.Resources>
+
+ <Grid>
+ <controls:DbTableView>
+ <DataGrid Background="Transparent" ItemsSource="{Binding Adapter.IdsPackFormulasViewSource}" 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="Code" Binding="{Binding Code}"></DataGridTextColumn>
+ <DataGridTextColumn Header="Name" Binding="{Binding Name}"></DataGridTextColumn>
+ <DataGridTextColumn Header="Description" Binding="{Binding Description}"></DataGridTextColumn>
+ <DataGridTextColumn Header="Auto Calculated" Binding="{Binding AutoCalculated,Converter={StaticResource BooleanToYesNoConverter}}"></DataGridTextColumn>
+ </DataGrid.Columns>
+ </DataGrid>
+ </controls:DbTableView>
+ </Grid>
+</UserControl>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackFormulasView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackFormulasView.xaml.cs
new file mode 100644
index 000000000..079c48746
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackFormulasView.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 IdsPackFormulasView : UserControl
+ {
+ public IdsPackFormulasView() : base()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackView.xaml
index 537bdb9f7..75093aa77 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPackView.xaml
@@ -10,7 +10,7 @@
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:IdsPacksViewVM, IsDesignTimeCreatable=False}">
+ d:DesignHeight="500" d:DesignWidth="300" d:DataContext="{d:DesignInstance Type=vm:IdsPacksViewVM, IsDesignTimeCreatable=False}">
<UserControl.Resources>
<converters:ColorToIntegerConverter x:Key="ColorToIntegerConverter"></converters:ColorToIntegerConverter>
@@ -68,6 +68,17 @@
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
+ <TextBlock Text="Index:" FontWeight="Bold"></TextBlock>
+ <mahapps:NumericUpDown Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" InterceptMouseWheel="True" HasDecimals="False" HorizontalContentAlignment="Left" Value="{Binding EditEntity.PackIndex,Mode=TwoWay}"></mahapps:NumericUpDown>
+
+ <TextBlock Text="Calculation Formula:" FontWeight="Bold"></TextBlock>
+ <ComboBox ItemsSource="{Binding Adapter.IdsPackFormulas}" SelectedItem="{Binding EditEntity.IdsPackFormula,Mode=TwoWay}">
+ <ComboBox.ItemTemplate>
+ <DataTemplate>
+ <TextBlock><Run Text="{Binding Name}"></Run></TextBlock>
+ </DataTemplate>
+ </ComboBox.ItemTemplate>
+ </ComboBox>
</controls:TableGrid>
</Grid>
</UserControl>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPacksView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPacksView.xaml
index 0837bbf9f..03ab1d7d4 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPacksView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/Views/DBViews/IdsPacksView.xaml
@@ -12,6 +12,7 @@
<UserControl.Resources>
<converters:ColorToIntegerConverter x:Key="ColorToIntegerConverter"></converters:ColorToIntegerConverter>
+ <converters:BooleanToYesNoConverter x:Key="BooleanToYesNoConverter" />
</UserControl.Resources>
<Grid>
@@ -57,6 +58,8 @@
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
+ <DataGridTextColumn Header="Index" Binding="{Binding PackIndex}"></DataGridTextColumn>
+ <DataGridTextColumn Header="Formula" Binding="{Binding IdsPackFormula.Name}"></DataGridTextColumn>
</DataGrid.Columns>
</DataGrid>
</controls:DbTableView>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/ruler.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/ruler.png
new file mode 100644
index 000000000..173e4c204
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/ruler.png
Binary files differ
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/segment-single.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/segment-single.png
new file mode 100644
index 000000000..016666122
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/segment-single.png
Binary files differ
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/segment.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/segment.png
new file mode 100644
index 000000000..d0f85b83f
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Images/segment.png
Binary files differ
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj
index 970556986..71527d1dc 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj
@@ -188,5 +188,14 @@
<ItemGroup>
<Resource Include="Images\video-frame.png" />
</ItemGroup>
+ <ItemGroup>
+ <Resource Include="Images\segment.png" />
+ </ItemGroup>
+ <ItemGroup>
+ <Resource Include="Images\segment-single.png" />
+ </ItemGroup>
+ <ItemGroup>
+ <Resource Include="Images\ruler.png" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs
index 8f3d2a7e3..e77093eee 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs
@@ -106,7 +106,22 @@ namespace Tango.MachineStudio.Developer.ViewModels
public Job SelectedJob
{
get { return _selectedJob; }
- set { _selectedJob = value; RaisePropertyChangedAuto(); }
+ set
+ {
+ _selectedJob = value;
+ RaisePropertyChangedAuto();
+ OnSelectedJobChanged();
+ }
+ }
+
+ private Segment _selectedSegment;
+ /// <summary>
+ /// Gets or sets the job selected segment.
+ /// </summary>
+ public Segment SelectedSegment
+ {
+ get { return _selectedSegment; }
+ set { _selectedSegment = value; RaisePropertyChangedAuto(); }
}
private Rml _selectedRML;
@@ -184,6 +199,26 @@ namespace Tango.MachineStudio.Developer.ViewModels
/// </summary>
public RelayCommand SaveLiquidFactorsCommand { get; set; }
+ /// <summary>
+ /// Gets or sets the add segment command.
+ /// </summary>
+ public RelayCommand AddSegmentCommand { get; set; }
+
+ /// <summary>
+ /// Gets or sets the remove segment command.
+ /// </summary>
+ public RelayCommand RemoveSegmentCommand { get; set; }
+
+ /// <summary>
+ /// Gets or sets the add job command.
+ /// </summary>
+ public RelayCommand AddJobCommand { get; set; }
+
+ /// <summary>
+ /// Gets or sets the remove job command.
+ /// </summary>
+ public RelayCommand RemoveJobCommand { get; set; }
+
#endregion
#region Constructors
@@ -219,6 +254,10 @@ namespace Tango.MachineStudio.Developer.ViewModels
ToggleSideBarCommand = new RelayCommand(() => IsSideBarOpened = !IsSideBarOpened);
SaveProcessParametersCommand = new RelayCommand(SaveProcessParameters);
SaveLiquidFactorsCommand = new RelayCommand(SaveLiquidFactors);
+ AddSegmentCommand = new RelayCommand(AddSegment);
+ RemoveSegmentCommand = new RelayCommand(RemoveSegment);
+ AddJobCommand = new RelayCommand(AddJob);
+ RemoveJobCommand = new RelayCommand(RemoveJob);
}
#endregion
@@ -240,6 +279,17 @@ namespace Tango.MachineStudio.Developer.ViewModels
#region Virtual Methods
/// <summary>
+ /// Called when the selected job has been changed.
+ /// </summary>
+ private void OnSelectedJobChanged()
+ {
+ if (SelectedJob != null)
+ {
+ SelectedSegment = SelectedJob.Segments.FirstOrDefault();
+ }
+ }
+
+ /// <summary>
/// Called when the selected group history has been changed
/// </summary>
protected virtual void OnSelectedGroupHistoryChanged()
@@ -358,6 +408,58 @@ namespace Tango.MachineStudio.Developer.ViewModels
}
}
+ /// <summary>
+ /// Removes the selected segment.
+ /// </summary>
+ private void RemoveSegment()
+ {
+ if (SelectedJob != null && SelectedSegment != null)
+ {
+ SelectedSegment.DefferedDelete();
+ SelectedJob.Segments.Remove(SelectedSegment);
+ }
+ }
+
+ /// <summary>
+ /// Adds a new segment.
+ /// </summary>
+ private void AddSegment()
+ {
+ if (SelectedJob != null)
+ {
+ Segment seg = new Segment();
+ seg.Name = "New Seg";
+ SelectedJob.Segments.Add(seg);
+ }
+ }
+
+ /// <summary>
+ /// Removes the selected job.
+ /// </summary>
+ private void RemoveJob()
+ {
+ if (SelectedMachine != null && SelectedJob != null)
+ {
+ SelectedJob.Delete();
+ SelectedMachine.Jobs.Remove(SelectedJob);
+ }
+ }
+
+ /// <summary>
+ /// Adds a new job to the selected machine.
+ /// </summary>
+ private void AddJob()
+ {
+ if (SelectedMachine != null)
+ {
+ SelectedMachine.Jobs.Add(new Job()
+ {
+ Name = "New Job",
+ CreationDate = DateTime.UtcNow,
+ });
+ }
+ }
+
#endregion
#region Public Events
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml
index 243165cd5..b971d9124 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml
@@ -398,6 +398,14 @@
<Rectangle VerticalAlignment="Bottom" StrokeDashArray="7" StrokeThickness="1" Stroke="Silver" Margin="0 8 0 0"></Rectangle>
</StackPanel>
+ <StackPanel Orientation="Horizontal" DockPanel.Dock="Bottom" HorizontalAlignment="Right">
+ <Button Command="{Binding RemoveJobCommand}" Margin="5" Style="{StaticResource MaterialDesignFlatButton}" Padding="0" ToolTip="Remove Segment">
+ <materialDesign:PackIcon Kind="Minus" Width="24" Height="24"></materialDesign:PackIcon>
+ </Button>
+ <Button Command="{Binding AddJobCommand}" Margin="5" Style="{StaticResource MaterialDesignFlatButton}" Padding="0" ToolTip="Add Segment">
+ <materialDesign:PackIcon Kind="Plus" Width="24" Height="24"></materialDesign:PackIcon>
+ </Button>
+ </StackPanel>
<ListBox ItemsSource="{Binding SelectedMachine.Jobs}" SelectedItem="{Binding SelectedJob}" Margin="0 10 0 0">
<ListBox.ItemTemplate>
<DataTemplate>
@@ -425,6 +433,10 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto"/>
+ <RowDefinition Height="1*"/>
+ </Grid.RowDefinitions>
<StackPanel>
<Grid>
<StackPanel Orientation="Horizontal" Margin="0 5 0 0">
@@ -494,7 +506,81 @@
<Border BorderThickness="1" BorderBrush="Silver" CornerRadius="5" Margin="0 0 5 5">
<TextBox Style="{x:Null}" BorderThickness="0" Margin="5" Height="80" Text="{Binding SelectedJob.Description}" VerticalAlignment="Stretch" materialDesign:HintAssist.Hint="Enter description" AcceptsReturn="True" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto"></TextBox>
</Border>
+
+
</StackPanel>
+
+ <Grid Grid.Row="1" Margin="0 10 0 0">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="200"/>
+ <ColumnDefinition Width="1*"/>
+ </Grid.ColumnDefinitions>
+
+ <DockPanel>
+ <StackPanel DockPanel.Dock="Top" Orientation="Horizontal">
+ <Image Source="../Images/segment.png" Width="42"></Image>
+ <TextBlock VerticalAlignment="Center" Margin="10 0 0 0" Foreground="DimGray" FontSize="16" FontWeight="SemiBold">SEGMENTS</TextBlock>
+ </StackPanel>
+
+ <StackPanel Orientation="Horizontal" DockPanel.Dock="Bottom" HorizontalAlignment="Right">
+ <Button Command="{Binding RemoveSegmentCommand}" Margin="5" Style="{StaticResource MaterialDesignFlatButton}" Padding="0" ToolTip="Remove Segment">
+ <materialDesign:PackIcon Kind="Minus" Width="24" Height="24"></materialDesign:PackIcon>
+ </Button>
+ <Button Command="{Binding AddSegmentCommand}" Margin="5" Style="{StaticResource MaterialDesignFlatButton}" Padding="0" ToolTip="Add Segment">
+ <materialDesign:PackIcon Kind="Plus" Width="24" Height="24"></materialDesign:PackIcon>
+ </Button>
+ </StackPanel>
+
+ <ListBox ItemsSource="{Binding SelectedJob.Segments}" SelectedItem="{Binding SelectedSegment}">
+ <ListBox.ItemTemplate>
+ <DataTemplate>
+ <StackPanel Orientation="Horizontal" Margin="0 5 0 0">
+ <Image Source="../Images/segment-single.png" Width="24"></Image>
+ <TextBlock Margin="5 0 0 0" Text="{Binding Name}" FontSize="12" FontWeight="SemiBold" VerticalAlignment="Center"></TextBlock>
+ </StackPanel>
+ </DataTemplate>
+ </ListBox.ItemTemplate>
+ </ListBox>
+ </DockPanel>
+
+ <Grid Grid.Column="1" Margin="10 5 0 0">
+ <DockPanel>
+ <StackPanel Orientation="Horizontal" DockPanel.Dock="Top">
+ <Image Source="../Images/segment-single.png" Width="24"></Image>
+ <TextBlock Margin="5 0 0 0" Text="{Binding SelectedSegment.Name,FallbackValue=''}" FontSize="16" FontWeight="SemiBold" VerticalAlignment="Center"></TextBlock>
+ </StackPanel>
+
+ <Grid Margin="0 10 0 0">
+ <DockPanel>
+ <StackPanel DockPanel.Dock="Top" Orientation="Horizontal">
+ <Border Style="{StaticResource JobFieldBorder}">
+ <StackPanel Margin="5" Width="140">
+ <StackPanel Orientation="Horizontal">
+ <Image Source="../Images/name.png" Width="32"></Image>
+ <TextBlock VerticalAlignment="Center" Margin="5 0 0 0" FontSize="10">Name</TextBlock>
+ </StackPanel>
+ <TextBox Margin="0 3 0 0" Text="{Binding SelectedSegment.Name,UpdateSourceTrigger=PropertyChanged}"></TextBox>
+ </StackPanel>
+ </Border>
+ <Border Style="{StaticResource JobFieldBorder}">
+ <StackPanel Margin="5" Width="140">
+ <StackPanel Orientation="Horizontal">
+ <Image Source="../Images/ruler.png" Width="32"></Image>
+ <TextBlock VerticalAlignment="Center" Margin="5 0 0 0" FontSize="10">Length</TextBlock>
+ </StackPanel>
+ <mahapps:NumericUpDown IsEnabled="{Binding SelectedJob.EnableInterSegment}" Margin="0 2 0 0" Minimum="1" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0 0 0 1" BorderBrush="DimGray" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding SelectedSegment.Length,Mode=TwoWay}"></mahapps:NumericUpDown>
+ </StackPanel>
+ </Border>
+ </StackPanel>
+
+ <Grid>
+
+ </Grid>
+ </DockPanel>
+ </Grid>
+ </DockPanel>
+ </Grid>
+ </Grid>
</Grid>
<Grid Grid.Column="1" Margin="10 0 0 0" Width="340">
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Images/formula.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Images/formula.png
new file mode 100644
index 000000000..6f476e79c
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Images/formula.png
Binary files differ
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj
index 64c54b357..bebcf2480 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Tango.MachineStudio.MachineDesigner.csproj
@@ -226,5 +226,8 @@
<ItemGroup>
<Resource Include="Images\machine-designer-module.jpg" />
</ItemGroup>
+ <ItemGroup>
+ <Resource Include="Images\formula.png" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project> \ No newline at end of file
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs
index 5cb216a6c..f4da7beaa 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/ViewModels/MainViewVM.cs
@@ -361,6 +361,18 @@ namespace Tango.MachineStudio.MachineDesigner.ViewModels
idsPack.LiquidTypeGuid = liquidType.Guid;
}
+ /// <summary>
+ /// Drops the ids formula.
+ /// </summary>
+ /// <param name="idsPackFormula">The ids pack formula.</param>
+ /// <param name="idsPack">The ids pack.</param>
+ /// <exception cref="NotImplementedException"></exception>
+ public void DropIdsFormula(IdsPackFormula idsPackFormula, IdsPack idsPack)
+ {
+ idsPack.IdsPackFormula = idsPackFormula;
+ idsPack.IdsPackFormulaGuid = idsPackFormula.Guid;
+ }
+
#endregion
#region Private Methods
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml
index e442e0e6f..61259508a 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml
@@ -226,6 +226,12 @@
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
+
+ <TextBlock Text="{Binding IdsPackFormula.Name}" TextWrapping="Wrap" Height="30" IsHitTestVisible="False" Width="50" Margin="-20 15 0 0" FontSize="7" TextAlignment="Center" RenderTransformOrigin="0.5,0.5" Foreground="White" HorizontalAlignment="Center" VerticalAlignment="Center">
+ <TextBlock.LayoutTransform>
+ <RotateTransform Angle="90" />
+ </TextBlock.LayoutTransform>
+ </TextBlock>
</Grid>
</UniformGrid>
@@ -417,6 +423,10 @@
<Image RenderOptions.BitmapScalingMode="Fant" Source="../Images/liquid.png" Width="12" VerticalAlignment="Center"></Image>
<TextBlock Margin="5 0 0 0" VerticalAlignment="Center"><Run FontWeight="Bold">Liquid:</Run> <Run FontStyle="Italic" Text="{Binding LiquidType.Name}"></Run></TextBlock>
</StackPanel>
+ <StackPanel Orientation="Horizontal" Margin="0 3 0 3">
+ <Image RenderOptions.BitmapScalingMode="Fant" Source="../Images/formula.png" Width="12" VerticalAlignment="Center"></Image>
+ <TextBlock Margin="5 0 0 0" VerticalAlignment="Center"><Run FontWeight="Bold">Formula:</Run> <Run FontStyle="Italic" Text="{Binding IdsPackFormula.Name}"></Run></TextBlock>
+ </StackPanel>
</StackPanel>
</StackPanel>
</DataTemplate>
@@ -618,6 +628,32 @@
</ListBox>
</Expander>
<Border Height="1" HorizontalAlignment="Stretch" Background="{DynamicResource MaterialDesignDivider}" SnapsToDevicePixels="True" />
+ <Expander HorizontalAlignment="Stretch" Header="Formulas">
+ <ListBox ItemsSource="{Binding Adapter.IdsPackFormulasViewSource}" HorizontalContentAlignment="Stretch">
+ <ListBox.ItemContainerStyle>
+ <Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
+ <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
+ <Setter Property="VerticalContentAlignment" Value="Stretch"></Setter>
+ <Setter Property="Padding" Value="1"></Setter>
+ </Style>
+ </ListBox.ItemContainerStyle>
+ <ListBox.ItemTemplate>
+ <DataTemplate>
+ <Grid Background="Transparent" IsHitTestVisible="True" dragAndDrop:DragAndDropService.DraggableBorderBrush="{StaticResource AccentColorBrush}" dragAndDrop:DragAndDropService.Draggable="True" dragAndDrop:DragAndDropService.DraggingSurface="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DraggingSurface}">
+ <StackPanel Orientation="Horizontal" Margin="2 8">
+ <Image IsHitTestVisible="False" Width="24" Height="24" Source="../Images/formula.png" Stretch="Fill" RenderOptions.BitmapScalingMode="Fant"></Image>
+ <StackPanel Margin="5 0 0 0" IsHitTestVisible="False">
+ <TextBlock IsHitTestVisible="False" FontSize="10" Foreground="DimGray"><Run Text="{Binding Name}"></Run></TextBlock>
+ </StackPanel>
+ </StackPanel>
+
+ <Rectangle Margin="0 10 0 0" VerticalAlignment="Bottom" Stroke="Gainsboro" StrokeThickness="1"></Rectangle>
+ </Grid>
+ </DataTemplate>
+ </ListBox.ItemTemplate>
+ </ListBox>
+ </Expander>
+ <Border Height="1" HorizontalAlignment="Stretch" Background="{DynamicResource MaterialDesignDivider}" SnapsToDevicePixels="True" />
<Expander HorizontalAlignment="Stretch" Header="Touch Panels">
<ListBox ItemsSource="{Binding Adapter.ApplicationDisplayPanelVersionsViewSource}" HorizontalContentAlignment="Stretch">
<ListBox.ItemContainerStyle>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml.cs
index 6d08a10e0..70e127b6c 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/Views/MainView.xaml.cs
@@ -62,7 +62,7 @@ namespace Tango.MachineStudio.MachineDesigner.Views
{
SetHighlightRegion(hardwareGrid);
}
- else if (e.DataContext is ApplicationVersion || e.DataContext is ApplicationOsVersion || e.DataContext is ApplicationDisplayPanelVersion)
+ else if (e.DataContext is ApplicationVersion || e.DataContext is ApplicationOsVersion || e.DataContext is ApplicationDisplayPanelVersion || e.DataContext is ApplicationFirmwareVersion)
{
SetHighlightRegion(gridTablet);
}
@@ -70,7 +70,7 @@ namespace Tango.MachineStudio.MachineDesigner.Views
{
SetHighlightRegion(gridEmbedded);
}
- else if (e.DataContext is DispenserType || e.DataContext is CartridgeType || e.DataContext is LiquidType || e.DataContext is MidTankType)
+ else if (e.DataContext is DispenserType || e.DataContext is CartridgeType || e.DataContext is LiquidType || e.DataContext is MidTankType || e.DataContext is IdsPackFormula)
{
SetHighlightRegion(gridIds);
}
@@ -102,6 +102,10 @@ namespace Tango.MachineStudio.MachineDesigner.Views
{
_vm.DropMidTankType(e.Draggable.DataContext as MidTankType, e.Droppable.DataContext as IdsPack);
}
+ else if (e.Draggable.DataContext is IdsPackFormula)
+ {
+ _vm.DropIdsFormula(e.Draggable.DataContext as IdsPackFormula, e.Droppable.DataContext as IdsPack);
+ }
else if (e.Draggable.DataContext is IdsPack)
{
_vm.DropIdsPack(e.Draggable.DataContext as IdsPack, e.Droppable.DataContext as IdsPack);