aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules
diff options
context:
space:
mode:
authorShai Frieder <Shai.Frieder@twine-s.com>2019-11-12 15:23:00 +0200
committerShai Frieder <Shai.Frieder@twine-s.com>2019-11-12 15:23:00 +0200
commit1d5da0064e2e82db6cf5544a2ea7836556d730c9 (patch)
treefac39137a9b0528a9d966fa259f9713590cdfdb5 /Software/Visual_Studio/MachineStudio/Modules
parent9dcd1a18c22a9eb8c6e7c6409ea785f4ed0fed1f (diff)
parent81ad4efdc9ec8593a75bf68fb3b39b97aa35aaa6 (diff)
downloadTango-1d5da0064e2e82db6cf5544a2ea7836556d730c9.tar.gz
Tango-1d5da0064e2e82db6cf5544a2ea7836556d730c9.zip
take remote
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs135
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml35
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml8
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Views/RmlView.xaml2
4 files changed, 119 insertions, 61 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 3a1f3fb11..93baf3b9d 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
@@ -1034,6 +1034,11 @@ namespace Tango.MachineStudio.Developer.ViewModels
{
var percent = (e.Progress / e.Total * 100d);
+ if (_preparingTaskItem != null)
+ {
+ _preparingTaskItem.Message = $"Preparing job for printing {(e.Progress / e.Total * 100d).ToString("0.0")}%...";
+ }
+
if (_preparingTaskItem == null && percent == 0)
{
_preparingTaskItem = _notification.PushTaskItem("Preparing job for printing...");
@@ -1043,13 +1048,6 @@ namespace Tango.MachineStudio.Developer.ViewModels
_preparingTaskItem.Pop();
_preparingTaskItem = null;
}
- else
- {
- if (_preparingTaskItem != null)
- {
- _preparingTaskItem.Message = $"Preparing job for printing {(e.Progress / e.Total * 100d).ToString("0.0")}%...";
- }
- }
}
private void MachineOperator_ResumingJob(object sender, ResumingJobEventArgs e)
@@ -1481,15 +1479,39 @@ namespace Tango.MachineStudio.Developer.ViewModels
JobHandler.Failed += (x, ex) =>
{
- LogManager.Log(ex, String.Format("Job {0} has failed.", RunningJob.Name));
- _eventLogger.Log(ex, String.Format("Job {0} has failed.", RunningJob.Name));
- SetJobFailed();
+ if (ex is InsufficientLiquidQuantityException)
+ {
+ InvokeUI(() =>
+ {
+ _notification.ShowModalDialog<InsufficientLiquidQuantityViewVM, InsufficientLiquidQuantityView>(new InsufficientLiquidQuantityViewVM(ex as InsufficientLiquidQuantityException), (_) =>
+ {
- InvokeUI(() =>
+ MachineOperator.EnableJobLiquidQuantityValidation = false;
+ StartJob();
+
+ }, () =>
+ {
+ SetJobFailed();
+
+ InvokeUI(() =>
+ {
+ StopRecordingIfInProgress();
+ });
+ });
+ });
+ }
+ else
{
- _notification.ShowError("Job failed. " + ex.FlattenMessage());
- StopRecordingIfInProgress();
- });
+ LogManager.Log(ex, String.Format("Job {0} has failed.", RunningJob.Name));
+ _eventLogger.Log(ex, String.Format("Job {0} has failed.", RunningJob.Name));
+ SetJobFailed();
+
+ InvokeUI(() =>
+ {
+ _notification.ShowError("Job failed. " + ex.FlattenMessage());
+ StopRecordingIfInProgress();
+ });
+ }
};
JobHandler.Finalizing += (_, __) =>
@@ -1521,16 +1543,6 @@ namespace Tango.MachineStudio.Developer.ViewModels
//Finally Canceled..
};
}
- catch (InsufficientLiquidQuantityException ex)
- {
- _notification.ShowModalDialog<InsufficientLiquidQuantityViewVM, InsufficientLiquidQuantityView>(new InsufficientLiquidQuantityViewVM(ex), (x) =>
- {
-
- MachineOperator.EnableJobLiquidQuantityValidation = false;
- StartJob();
-
- }, () => { });
- }
catch (Exception ex)
{
LogManager.Log(ex);
@@ -1908,50 +1920,60 @@ namespace Tango.MachineStudio.Developer.ViewModels
{
CanWork = false;
- using (_notification.PushTaskItem("Saving job details..."))
+ try
{
- await Task.Factory.StartNew(() =>
+ using (_notification.PushTaskItem("Saving job details..."))
{
- LogManager.Log(String.Format("Saving the active job {0}...", ActiveJob.Name));
- ActiveJob.LastUpdated = DateTime.UtcNow;
- ActiveJob.Rml = SelectedRML;
- ActiveJob.EstimatedDurationMili = (int)EstimatedDuration.TotalMilliseconds;
- _activeJobDbContext.SaveChanges();
-
- _machineDbContext.Entry(SelectedMachineJob).Reload();
+ await Task.Factory.StartNew(() =>
+ {
+ LogManager.Log(String.Format("Saving the active job {0}...", ActiveJob.Name));
+ ActiveJob.LastUpdated = DateTime.UtcNow;
+ ActiveJob.Rml = SelectedRML;
+ ActiveJob.EstimatedDurationMili = (int)EstimatedDuration.TotalMilliseconds;
+ _activeJobDbContext.SaveChanges();
+ _machineDbContext.Entry(SelectedMachineJob).Reload();
- _machineDbContext.Entry(SelectedMachineJob).Collection(x => x.Segments).Load();
- foreach (var segment in SelectedMachineJob.Segments.ToList())
- {
- _machineDbContext.Entry(segment).Collection(x => x.BrushStops).Load();
+ _machineDbContext.Entry(SelectedMachineJob).Collection(x => x.Segments).Load();
- foreach (var brushStop in segment.BrushStops.ToList())
+ foreach (var segment in SelectedMachineJob.Segments.ToList())
{
- _machineDbContext.Entry(brushStop).Reload();
- }
+ _machineDbContext.Entry(segment).Collection(x => x.BrushStops).Load();
- _machineDbContext.Entry(segment).Reload();
- }
+ foreach (var brushStop in segment.BrushStops.ToList())
+ {
+ _machineDbContext.Entry(brushStop).Reload();
+ }
- InvokeUI(() =>
- {
- SelectedMachineJob.Segments = SelectedMachineJob.Segments;
- });
+ _machineDbContext.Entry(segment).Reload();
+ }
- var settings = SettingsManager.Default.GetOrCreate<DeveloperModuleSettings>();
- settings.DefaultJobRmlGuid = ActiveJob.RmlGuid;
- settings.Save();
+ InvokeUI(() =>
+ {
+ SelectedMachineJob.Segments = SelectedMachineJob.Segments;
+ });
- if (ActiveJob != null)
- {
- _current_job_string = ActiveJob.ToJobFileWhenLoaded().ToString();
- }
- });
- }
+ var settings = SettingsManager.Default.GetOrCreate<DeveloperModuleSettings>();
+ settings.DefaultJobRmlGuid = ActiveJob.RmlGuid;
+ settings.Save();
- CanWork = true;
+ if (ActiveJob != null)
+ {
+ _current_job_string = ActiveJob.ToJobFileWhenLoaded().ToString();
+ }
+ });
+ }
+ }
+ catch (Exception ex)
+ {
+ LogManager.Log(ex, "Error saving active job.");
+ _notification.ShowError($"An error occurred while trying to save the current job.\n{ex.FlattenMessage()}");
+ }
+ finally
+ {
+ CanWork = true;
+ }
}
}
@@ -2261,6 +2283,7 @@ namespace Tango.MachineStudio.Developer.ViewModels
return;
}
SelectedSegment.BrushStops.Remove(x);
+ _activeJobDbContext.BrushStops.Remove(x);
});
ArrangeBrushStopsIndices();
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml
index 3bda86036..e1bbad6a7 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/JobView.xaml
@@ -1187,6 +1187,41 @@
<Setter Property="Content">
<Setter.Value>
<TextBlock>
+ <Run Text="{Binding PulsePerSecondFull,Mode=OneWay,StringFormat='0.0'}"></Run>
+ <Run Text="(pulse)" FontSize="9" Foreground="{StaticResource GrayBrush250}"></Run>
+ </TextBlock>
+ </Setter.Value>
+ </Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding DispenserStepDivision}" Value="{x:Static dispensing:DispenserStepDivisions.Auto}">
+ <Setter Property="Content" Value="Auto"></Setter>
+ </DataTrigger>
+ <DataTrigger Binding="{Binding DispenserStepDivision,Converter={StaticResource IsNotConverter},ConverterParameter={x:Static dispensing:DispenserStepDivisions.Auto}}" Value="True">
+ <Setter Property="Content">
+ <Setter.Value>
+ <TextBlock>
+ <Run Text="{Binding PulsePerSecondFull,Mode=OneWay,StringFormat='0.0'}"></Run>
+ <Run Text="(pulse)" FontSize="9" Foreground="{StaticResource GrayBrush250}"></Run>
+ </TextBlock>
+ </Setter.Value>
+ </Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Label.Style>
+ </Label>
+ </DataTemplate>
+ </DataGridTemplateColumn.CellTemplate>
+ </DataGridTemplateColumn>
+ <DataGridTemplateColumn Header="PULSE / SEC (full step)">
+ <DataGridTemplateColumn.CellTemplate>
+ <DataTemplate>
+ <Label VerticalAlignment="Center">
+ <Label.Style>
+ <Style TargetType="Label">
+ <Setter Property="Content">
+ <Setter.Value>
+ <TextBlock>
<Run Text="{Binding PulsePerSecond,Mode=OneWay,StringFormat='0.0'}"></Run>
<Run Text="(pulse)" FontSize="9" Foreground="{StaticResource GrayBrush250}"></Run>
</TextBlock>
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 08ba5b699..abea6aec9 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
@@ -555,15 +555,15 @@
<Border BorderBrush="{StaticResource GrayBrush280}" BorderThickness="0 1 0 1" Padding="5">
<DockPanel>
- <StackPanel Orientation="Horizontal" DockPanel.Dock="Left">
- <materialDesign:PackIcon Kind="Alert" Width="32" Height="32" VerticalAlignment="Center" />
- <TextBlock VerticalAlignment="Center" FontSize="16" FontWeight="SemiBold" Margin="10 0 0 0" FontStyle="Italic">Job Aborted By User</TextBlock>
+ <StackPanel Orientation="Horizontal" DockPanel.Dock="Left" >
+ <materialDesign:PackIcon Kind="Alert" Width="32" Height="32" VerticalAlignment="Center" Foreground="#FF494949"/>
+ <TextBlock VerticalAlignment="Center" Foreground="#FF494949" FontSize="16" FontWeight="SemiBold" Margin="10 0 0 0" FontStyle="Italic">Job Aborted By User</TextBlock>
</StackPanel>
<StackPanel Orientation="Horizontal" DockPanel.Dock="Right" Margin="0 0 10 0">
<Button Padding="0" Height="20" Command="{Binding CloseJobCompletionStatusCommand}" Style="{StaticResource MaterialDesignFlatButton}">
<StackPanel Orientation="Horizontal">
- <materialDesign:PackIcon Foreground="{StaticResource DarkGrayBrush}" VerticalAlignment="Center" Width="20" Height="20" Kind="Close" />
+ <materialDesign:PackIcon Foreground="#FF494949" VerticalAlignment="Center" Width="20" Height="20" Kind="Close" />
</StackPanel>
</Button>
</StackPanel>
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 50f6a6297..e34854046 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
@@ -191,7 +191,7 @@
</UniformGrid>
<TextBlock Margin="0 40 0 0" Text="Color Conversion Version:" HorizontalAlignment="Center"></TextBlock>
- <mahapps:NumericUpDown Minimum="1" Maximum="2" Value="{Binding ActiveRML.ColorConversionVersion}" HorizontalContentAlignment="Center" Background="Transparent" BorderBrush="{StaticResource DimGrayBrush}" HasDecimals="False" Margin="0 5 0 0" />
+ <mahapps:NumericUpDown Minimum="1" Maximum="3" Value="{Binding ActiveRML.ColorConversionVersion}" HorizontalContentAlignment="Center" Background="Transparent" BorderBrush="{StaticResource DimGrayBrush}" HasDecimals="False" Margin="0 5 0 0" />
</StackPanel>
</StackPanel>
</Grid>