aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio
diff options
context:
space:
mode:
authorAvi Levkovich <avi@twine-s.com>2020-05-13 13:27:01 +0300
committerAvi Levkovich <avi@twine-s.com>2020-05-13 13:27:01 +0300
commit15dfc2cdcbc2e518c09c1ee75f32ff149d4a337d (patch)
tree4c0b49773706b85282e6f6b1ec3d2e949d3ca22e /Software/Visual_Studio/MachineStudio
parent6a49e917c587dcbbfe8175b8dde73840b7d105fc (diff)
parentcd750d626d3780990797faf09446033bbaa4311c (diff)
downloadTango-15dfc2cdcbc2e518c09c1ee75f32ff149d4a337d.tar.gz
Tango-15dfc2cdcbc2e518c09c1ee75f32ff149d4a337d.zip
commit merge
Diffstat (limited to 'Software/Visual_Studio/MachineStudio')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Catalogs/ViewModels/MainViewVM.cs29
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/ViewModels/MainViewVM.cs10
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineLoginViewVM.cs5
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs2
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineLoginView.xaml23
6 files changed, 62 insertions, 9 deletions
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 406622ee1..8a33f15ef 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
@@ -318,6 +318,35 @@ namespace Tango.MachineStudio.Catalogs.ViewModels
try
{
IsFree = false;
+
+ //Validate color codes.
+ var duplicateCodes = ActiveCatalog
+ .ColorCatalogsGroups
+ .SelectMany(x => x.ColorCatalogsItems)
+ .GroupBy(x => x.Code)
+ .Where(x => x.Count() > 1)
+ .Select(x => x.First().Code)
+ .ToList();
+
+ if (duplicateCodes.Count > 0)
+ {
+ throw new InvalidOperationException($"Duplicate color codes found:\n{String.Join(Environment.NewLine, duplicateCodes)}");
+ }
+
+ //Validate color names.
+ var duplicateNames = ActiveCatalog
+ .ColorCatalogsGroups
+ .SelectMany(x => x.ColorCatalogsItems)
+ .GroupBy(x => x.Name)
+ .Where(x => x.Count() > 1)
+ .Select(x => x.First().Name)
+ .ToList();
+
+ if (duplicateNames.Count > 0)
+ {
+ throw new InvalidOperationException($"Duplicate color names found:\n{String.Join(Environment.NewLine, duplicateNames)}");
+ }
+
ActiveCatalog.LastUpdated = DateTime.UtcNow;
await _activeCatalogContext.SaveChangesAsync();
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/ViewModels/MainViewVM.cs
index d20b74c77..16395d6bc 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.UsersAndRoles/ViewModels/MainViewVM.cs
@@ -274,6 +274,11 @@ namespace Tango.MachineStudio.UsersAndRoles.ViewModels
try
{
ManagedUser.Validate(_userContext);
+
+ if (ManagedUser.Roles.GroupBy(x => x.RoleEnum).Any(x => x.Count() > 1))
+ {
+ throw new InvalidOperationException("Cannot save user with duplicate roles.");
+ }
}
catch (Exception ex)
{
@@ -296,6 +301,11 @@ namespace Tango.MachineStudio.UsersAndRoles.ViewModels
try
{
ManagedUser.Validate(_userContext);
+
+ if (ManagedUser.Roles.GroupBy(x => x.RoleEnum).Any(x => x.Count() > 1))
+ {
+ throw new InvalidOperationException("Cannot save user with duplicate roles.");
+ }
}
catch (Exception ex)
{
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs
index 26859b94a..20cfa84df 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Properties/AssemblyInfo.cs
@@ -4,5 +4,5 @@ using System.Runtime.InteropServices;
[assembly: System.Windows.ThemeInfo(System.Windows.ResourceDictionaryLocation.None, System.Windows.ResourceDictionaryLocation.SourceAssembly)]
[assembly: AssemblyTitle("Tango - Machine Studio")]
-[assembly: AssemblyVersion("4.1.9.0")]
+[assembly: AssemblyVersion("4.1.10.0")]
[assembly: ComVisible(false)] \ No newline at end of file
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineLoginViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineLoginViewVM.cs
index 9bee35697..81d3f4243 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineLoginViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineLoginViewVM.cs
@@ -27,6 +27,11 @@ namespace Tango.MachineStudio.UI.ViewModels
public ExternalBridgeLoginIntent Intent { get; set; }
/// <summary>
+ /// Gets or sets a value indicating whether to require safety level operations permission from the remote machine.
+ /// </summary>
+ public bool RequireSafetyOperations { get; set; }
+
+ /// <summary>
/// Gets or sets the login command.
/// </summary>
public RelayCommand<String> LoginCommand { get; set; }
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 46491c823..0e02d779f 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MainViewVM.cs
@@ -598,6 +598,8 @@ namespace Tango.MachineStudio.UI.ViewModels
Password = config.Password,
UserGuid = AuthenticationProvider.CurrentUser.Guid,
Intent = config.Intent,
+ UserName = AuthenticationProvider.CurrentUser.Contact.FullName,
+ RequireSafetyLevelOperations = config.RequireSafetyOperations
});
_reconnectionMachine = machine;
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineLoginView.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineLoginView.xaml
index 5be9ba089..e4cdfe199 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineLoginView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Views/MachineLoginView.xaml
@@ -17,14 +17,21 @@
<Grid>
<DockPanel LastChildFill="True">
- <StackPanel Margin="10" Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Right" DockPanel.Dock="Bottom">
- <Button Command="{Binding LoginCommand}" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Password}" Style="{StaticResource MaterialDesignFlatButton}" IsDefault="True" Margin="0 8 8 0">
- LOGIN
- </Button>
- <Button Command="{Binding CancelCommand}" Style="{StaticResource MaterialDesignFlatButton}" Margin="0 8 0 0">
- CANCEL
- </Button>
- </StackPanel>
+ <Grid DockPanel.Dock="Bottom">
+
+ <CheckBox IsChecked="{Binding RequireSafetyOperations}" VerticalAlignment="Center" Margin="68 0 0 0" ToolTip="Require safety level operations permission from a near-by machine user">
+ <TextBlock Margin="0 -2 0 0">Require Safety Level Operations</TextBlock>
+ </CheckBox>
+
+ <StackPanel Margin="10" Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Right">
+ <Button Command="{Binding LoginCommand}" CommandParameter="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Password}" Style="{StaticResource MaterialDesignFlatButton}" IsDefault="True" Margin="0 8 8 0">
+ LOGIN
+ </Button>
+ <Button Command="{Binding CancelCommand}" Style="{StaticResource MaterialDesignFlatButton}" Margin="0 8 0 0">
+ CANCEL
+ </Button>
+ </StackPanel>
+ </Grid>
<Grid Margin="10">
<StackPanel>
<StackPanel Orientation="Horizontal" VerticalAlignment="Top">