aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/MachineStudio')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs74
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml6
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs7
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/TextInputBoxWindow.xaml2
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs1
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml12
6 files changed, 95 insertions, 7 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs
index c2637b527..a76799881 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/ViewModels/MainViewVM.cs
@@ -20,6 +20,7 @@ using Tango.MachineStudio.RML.Models;
using Tango.MachineStudio.RML.Views;
using Tango.PMR.ColorLab;
using System.Data.Entity;
+using Tango.Core.ExtensionMethods;
namespace Tango.MachineStudio.RML.ViewModels
{
@@ -178,11 +179,14 @@ namespace Tango.MachineStudio.RML.ViewModels
public RelayCommand SaveCommand { get; set; }
+ public RelayCommand CloneRmlCommand { get; set; }
+
public MainViewVM(INotificationProvider notificationProvider)
{
_notification = notificationProvider;
ManageRmlCommand = new RelayCommand(() => LoadActiveRML(SelectedRML.Guid), () => SelectedRML != null);
- RemoveRmlCommand = new RelayCommand(RemoveSelectedRml);
+ RemoveRmlCommand = new RelayCommand(RemoveSelectedRml, () => SelectedRML != null);
+ CloneRmlCommand = new RelayCommand(CloneSelectedRml, () => SelectedRML != null);
AddRmlCommand = new RelayCommand(AddNewRml);
BackToRmlsCommand = new RelayCommand(BackToRmls, () => IsFree);
AddProcessParametersTableCommand = new RelayCommand(AddProcessParametersTable, () => IsFree);
@@ -443,6 +447,74 @@ namespace Tango.MachineStudio.RML.ViewModels
}
}
+ private async void CloneSelectedRml()
+ {
+ String name = _notification.ShowTextInput("Enter thread name", "thread name");
+
+ if (!String.IsNullOrWhiteSpace(name))
+ {
+ using (_notification.PushTaskItem("Cloning thread..."))
+ {
+ try
+ {
+ IsFree = false;
+
+ using (var context = ObservablesContext.CreateDefault())
+ {
+ var rml = await new RmlBuilder(context).Set(SelectedRML.Guid).WithActiveParametersGroup().WithLiquidFactors().BuildAsync();
+
+ Rml cloned = new Rml();
+ rml.MapPrimitivesWithStrings(cloned);
+
+ cloned.Code = Rmls.Max(x => x.Code) + 1;
+ cloned.Guid = Guid.NewGuid().ToString();
+ cloned.ID = 0;
+ cloned.Name = name;
+
+ ProcessParametersTablesGroup group = new ProcessParametersTablesGroup();
+ group.Name = rml.GetActiveProcessGroup().Name;
+ group.Active = true;
+
+ foreach (var p in rml.GetActiveProcessGroup().ProcessParametersTables)
+ {
+ var pc = new ProcessParametersTable();
+ p.MapPrimitivesTo(pc);
+ pc.Name = p.Name;
+
+ group.ProcessParametersTables.Add(pc);
+ }
+
+ cloned.ProcessParametersTablesGroups.Add(group);
+
+ foreach (var liquidFactor in rml.LiquidTypesRmls)
+ {
+ LiquidTypesRml l = new LiquidTypesRml();
+ l.DefaultCatData = liquidFactor.DefaultCatData;
+ l.LiquidType = liquidFactor.LiquidType;
+ l.MaxNlPerCm = liquidFactor.MaxNlPerCm;
+ cloned.LiquidTypesRmls.Add(l);
+ }
+
+ context.Rmls.Add(cloned);
+ await context.SaveChangesAsync();
+ }
+
+ LoadRmls();
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error cloning thread.");
+ _notification.ShowError($"An error occurred while trying to clone the selected thread\n{ex.Message}");
+ }
+ finally
+ {
+ IsFree = true;
+ }
+ }
+
+ }
+ }
+
private void AddProcessParametersTable()
{
var name = _notification.ShowTextInput("Enter table name", "Name");
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml
index 9f09ad248..719167679 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlsView.xaml
@@ -31,6 +31,12 @@
<TextBlock Margin="5 0 0 0" FontSize="16">DELETE</TextBlock>
</StackPanel>
</Button>
+ <Button Margin="0 0 10 0" MinWidth="160" Height="50" Background="{StaticResource OrangeBrush300}" BorderBrush="{StaticResource OrangeBrush300}" Command="{Binding CloneRmlCommand}">
+ <StackPanel Orientation="Horizontal">
+ <materialDesign:PackIcon Kind="ContentCopy" Width="20" Height="20" />
+ <TextBlock Margin="5 0 0 0" FontSize="16">DUPLICATE</TextBlock>
+ </StackPanel>
+ </Button>
<Button Margin="0 0 10 0" MinWidth="160" Height="50" Background="{StaticResource GreenBrush300}" BorderBrush="{StaticResource GreenBrush300}" Command="{Binding AddRmlCommand}">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Plus" Width="20" Height="20" />
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs
index 2920c8dd9..219b6faf0 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/MachineStudioSettings.cs
@@ -6,6 +6,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Tango.BL;
+using Tango.Integration.Operation;
using Tango.Logging;
using Tango.PMR.Printing;
using Tango.Settings;
@@ -104,6 +105,11 @@ namespace Tango.MachineStudio.Common
public JobUploadStrategy JobUploadStrategy { get; set; }
/// <summary>
+ /// Gets or sets the job number of units method.
+ /// </summary>
+ public JobUnitsMethods JobUnitsMethod { get; set; }
+
+ /// <summary>
/// Gets or sets a value indicating whether to by pass environment version check.
/// </summary>
public bool ByPassEnvironmentVersionCheck { get; set; }
@@ -155,6 +161,7 @@ namespace Tango.MachineStudio.Common
MaximumCacheTime = TimeSpan.FromMinutes(5);
CachingMode = ObservablesContextInMemoryCachingMode.None;
Theme = MachineStudioTheme.Light;
+ JobUnitsMethod = JobUnitsMethods.Operator;
}
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/TextInputBoxWindow.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/TextInputBoxWindow.xaml
index 5cc3d719b..a43fafb46 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/TextInputBoxWindow.xaml
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Notifications/TextInputBoxWindow.xaml
@@ -32,7 +32,7 @@
<StackPanel VerticalAlignment="Top" Margin="0 30 0 0">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=IconKind}" VerticalAlignment="Top" Width="50" Height="50" Foreground="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=IconColor}" />
- <TextBlock Padding="0 10 0 0" TextWrapping="Wrap" Margin="10 0 0 0" VerticalAlignment="Top" FontSize="14" Text="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=Message}" Width="400" Foreground="{StaticResource TransparentBackgroundBrush}"></TextBlock>
+ <TextBlock Padding="0 10 0 0" TextWrapping="Wrap" Margin="10 0 0 0" VerticalAlignment="Top" FontSize="14" Text="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=Message}" Width="400"></TextBlock>
</StackPanel>
<TextBox x:Name="txtText" Margin="60 0 20 0" materialDesign:HintAssist.Hint="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=Hint}" Text="{Binding RelativeSource={RelativeSource AncestorType=Window},Path=Response,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Foreground="{StaticResource Dialog.Foreground}"></TextBox>
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
index 95f9f800d..b22d65192 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
@@ -454,6 +454,7 @@ namespace Tango.MachineStudio.UI.ViewModels
x.SelectedMachine.EnableEmbeddedDebugging = x.EnableDiagnostics;
x.SelectedMachine.EnableEventsNotification = x.EnableDiagnostics;
x.SelectedMachine.UseKeepAlive = x.EnableKeepAlive;
+ x.SelectedMachine.JobUnitsMethod = _settings.JobUnitsMethod;
if (x.SelectedMachine is ExternalBridgeTcpClient)
{
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml
index a5ffe9964..f7e90d4f5 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/AboutView.xaml
@@ -7,6 +7,7 @@
xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI"
xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
xmlns:pmrPrinting="clr-namespace:Tango.PMR.Printing;assembly=Tango.PMR"
+ xmlns:operation="clr-namespace:Tango.Integration.Operation;assembly=Tango.Integration"
xmlns:bl="clr-namespace:Tango.BL;assembly=Tango.BL"
xmlns:local="clr-namespace:Tango.MachineStudio.UI.Views"
mc:Ignorable="d"
@@ -46,7 +47,7 @@
- <controls:TableGrid RowHeight="25" DockPanel.Dock="Top">
+ <controls:TableGrid RowHeight="27" DockPanel.Dock="Top">
<TextBlock FontWeight="SemiBold">Machine Studio:</TextBlock>
<TextBlock><Run>v</Run><Run Text="{Binding ApplicationManager.Version,Mode=OneWay}"></Run></TextBlock>
<TextBlock FontWeight="SemiBold">Core Libraries:</TextBlock>
@@ -69,10 +70,11 @@
<TextBlock Margin="20 0 0 0" Foreground="{StaticResource GrayBrush}" VerticalAlignment="Center">(Requires restart)</TextBlock>
</DockPanel>
<TextBlock FontWeight="SemiBold">Job Upload Strategy:</TextBlock>
- <DockPanel>
- <ComboBox Width="150" DockPanel.Dock="Left" ItemsSource="{Binding Source={x:Type pmrPrinting:JobUploadStrategy},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding MachineStudioSettings.JobUploadStrategy}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"></ComboBox>
- <TextBlock Margin="20 0 0 0" Foreground="{StaticResource GrayBrush}" VerticalAlignment="Center">(Requires restart)</TextBlock>
- </DockPanel>
+ <ComboBox HorizontalAlignment="Left" Width="150" ItemsSource="{Binding Source={x:Type pmrPrinting:JobUploadStrategy},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding MachineStudioSettings.JobUploadStrategy}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"></ComboBox>
+
+ <TextBlock FontWeight="SemiBold">Job Units Duplication Method:</TextBlock>
+ <ComboBox HorizontalAlignment="Left" Width="150" DockPanel.Dock="Left" ItemsSource="{Binding Source={x:Type operation:JobUnitsMethods},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValue="{Binding MachineStudioSettings.JobUnitsMethod}" SelectedValuePath="Value" DisplayMemberPath="DisplayName"></ComboBox>
+
</controls:TableGrid>
<DockPanel Margin="0 0 0 0">