aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2021-04-07 10:56:23 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2021-04-07 10:56:23 +0300
commit02fe464c0fc173404771e0e61c5ac0db2a1813d3 (patch)
tree644a088e83e0c5ecad5278c755db89d1e65bede7 /Software/Visual_Studio/MachineStudio/Modules
parent302f706666622cade696eeb024763821536660c4 (diff)
downloadTango-02fe464c0fc173404771e0e61c5ac0db2a1813d3.tar.gz
Tango-02fe464c0fc173404771e0e61c5ac0db2a1813d3.zip
Several bug fixes.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs38
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml2
3 files changed, 28 insertions, 14 deletions
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 96d8582a7..35e27c834 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
@@ -2234,23 +2234,37 @@ namespace Tango.MachineStudio.Developer.ViewModels
{
if (_notification.ShowQuestion("Are you sure you want to delete the selected jobs?"))
{
- var jobsToReport = SelectedJobs.Select(x => JobDTO.FromObservable(x)).ToList();
-
- LogManager.Log(String.Format("Removing {0} jobs...", SelectedJobs.Count));
- SelectedJobs.ToList().ForEach(x =>
+ try
{
- x.Delete(_machineDbContext);
- });
+ IsFree = false;
+
+ var jobsToReport = SelectedJobs.Select(x => JobDTO.FromObservable(x)).ToList();
- using (_notification.PushTaskItem("Removing selected jobs..."))
+ LogManager.Log(String.Format("Removing {0} jobs...", SelectedJobs.Count));
+ SelectedJobs.ToList().ForEach(x =>
+ {
+ x.Delete(_machineDbContext);
+ });
+
+ using (_notification.PushTaskItem("Removing selected jobs..."))
+ {
+ LogManager.Log("Saving selected machine to database...");
+ await SelectedMachine.SaveAsync(_machineDbContext);
+ }
+
+ foreach (var job in jobsToReport)
+ {
+ _actionLogManager.InsertLog(ActionLogType.JobDeleted, AuthenticationProvider.CurrentUser, job.Name, job, "Job deleted using Machine Studio.", true);
+ }
+ }
+ catch (Exception ex)
{
- LogManager.Log("Saving selected machine to database...");
- await SelectedMachine.SaveAsync(_machineDbContext);
+ LogManager.Log(ex, "Error removing the selected job.");
+ _notification.ShowError($"Error removing the selected job.\n{ex.FlattenMessage()}");
}
-
- foreach (var job in jobsToReport)
+ finally
{
- _actionLogManager.InsertLog(ActionLogType.JobDeleted, AuthenticationProvider.CurrentUser, job.Name, job, "Job deleted using Machine Studio.", true);
+ IsFree = true;
}
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml
index a3d2dbd68..ce632539e 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MachineJobSelectionView.xaml
@@ -28,7 +28,7 @@
<converters:BooleanInverseConverter x:Key="BooleanInverseConverter" />
</UserControl.Resources>
- <Grid>
+ <Grid IsEnabled="{Binding IsFree}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="600"/>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml
index a2fce41d1..099637601 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml
@@ -25,7 +25,7 @@
<Grid Margin="20">
<DockPanel>
- <Grid DockPanel.Dock="Top">
+ <Grid DockPanel.Dock="Top" Panel.ZIndex="200">
<StackPanel Orientation="Horizontal">
<Button Style="{StaticResource MaterialDesignFlatButton}" Height="Auto" Command="{Binding BackToRmlsCommand}">
<materialDesign:PackIcon Kind="ArrowLeft" Width="50" Height="50" Foreground="{StaticResource DarkGrayBrush200}" ToolTip="Back to RML list" />