aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels
diff options
context:
space:
mode:
authorShai Frieder <Shai.Frieder@twine-s.com>2019-04-28 08:58:52 +0300
committerShai Frieder <Shai.Frieder@twine-s.com>2019-04-28 08:58:52 +0300
commit6b30868785f35d90c63407b807fa3ad5eb51ecef (patch)
tree13659e5021487a4e236c3ca6fed4e3606159ecff /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels
parent62732deacc1abdf0fcdea93353d6cd0a5a65bdc3 (diff)
parent47a05089a3dc2a077f09c1844386e2b6301cb462 (diff)
downloadTango-6b30868785f35d90c63407b807fa3ad5eb51ecef.tar.gz
Tango-6b30868785f35d90c63407b807fa3ad5eb51ecef.zip
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs54
1 files changed, 43 insertions, 11 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 db9d9dbae..e03c64a54 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
@@ -966,9 +966,23 @@ namespace Tango.MachineStudio.Developer.ViewModels
private void MachineOperator_PreparingJobProgress(object sender, PreparingJobProgressEventArgs e)
{
- if (_preparingTaskItem != null)
+ var percent = (e.Progress / e.Total * 100d);
+
+ if (_preparingTaskItem == null && percent == 0)
+ {
+ _preparingTaskItem = _notification.PushTaskItem("Preparing job for printing...");
+ }
+ else if (percent == 100)
{
- _preparingTaskItem.Message = $"Preparing job for printing {(e.Progress / e.Total * 100d).ToString("0.0")}%...";
+ _preparingTaskItem.Pop();
+ _preparingTaskItem = null;
+ }
+ else
+ {
+ if (_preparingTaskItem != null)
+ {
+ _preparingTaskItem.Message = $"Preparing job for printing {(e.Progress / e.Total * 100d).ToString("0.0")}%...";
+ }
}
}
@@ -1293,6 +1307,8 @@ namespace Tango.MachineStudio.Developer.ViewModels
/// </summary>
private async void StartJob(Func<Job, JobHandler> resumeFunc = null)
{
+ SettingsManager.Default.Save();
+
LogManager.Log(String.Format("Starting job {0}...", ActiveJob.Name));
if (MachineOperator == null || MachineOperator.State != TransportComponentState.Connected)
{
@@ -1327,11 +1343,7 @@ namespace Tango.MachineStudio.Developer.ViewModels
if (resumeFunc == null)
{
- using (var item = _notification.PushTaskItem("Preparing job for printing..."))
- {
- _preparingTaskItem = item;
- JobHandler = await MachineOperator.Print(ActiveJob, SelectedProcessParametersTable);
- }
+ JobHandler = await MachineOperator.Print(ActiveJob, SelectedProcessParametersTable);
}
else
{
@@ -1386,7 +1398,7 @@ namespace Tango.MachineStudio.Developer.ViewModels
InvokeUI(() =>
{
- _notification.ShowError("Job failed. " + ex.Message);
+ _notification.ShowError("Job failed. " + ex.FlattenMessage());
StopRecordingIfInProgress();
});
};
@@ -1408,6 +1420,12 @@ namespace Tango.MachineStudio.Developer.ViewModels
JobHandler.Canceled += (x, y) =>
{
+ if (_preparingTaskItem != null)
+ {
+ _preparingTaskItem.Pop();
+ _preparingTaskItem = null;
+ }
+
LogManager.Log(String.Format("Job {0} has been canceled.", RunningJob.Name));
_eventLogger.Log(String.Format("Job {0} has been canceled.", RunningJob.Name));
StopRecordingIfInProgress();
@@ -1750,6 +1768,11 @@ namespace Tango.MachineStudio.Developer.ViewModels
InvalidateRelayCommands();
_disable_gamut_check = false;
+
+ _settings.LastSelectedMachineGuid = SelectedMachine != null ? SelectedMachine.Guid : null;
+ _settings.LastSelectedJobGuid = SelectedMachineJob != null ? SelectedMachineJob.Guid : null;
+
+ _settings.Save();
});
SegmentsCollectionView = CollectionViewSource.GetDefaultView(ActiveJob.Segments);
@@ -1987,6 +2010,11 @@ namespace Tango.MachineStudio.Developer.ViewModels
SelectedSegments.ToList().ForEach(x =>
{
+ if (ActiveJob.Segments.Count == 1)
+ {
+ _notification.ShowInfo("A job must contain at least one segment.");
+ return;
+ }
ActiveJob.Segments.Remove(x);
x.DefferedDelete(_activeJobDbContext);
});
@@ -2114,12 +2142,17 @@ namespace Tango.MachineStudio.Developer.ViewModels
{
if (SelectedBrushStop != null && SelectedSegment != null)
{
- if (_notification.ShowQuestion("Are you sure you want to delete the selected colors?"))
+ if (_notification.ShowQuestion("Are you sure you want to delete the selected brush stops?"))
{
LogManager.Log(String.Format("Removing {0} brush stops...", SelectedBrushStops.Count));
SelectedBrushStops.ToList().ForEach(x =>
{
+ if (SelectedSegment.BrushStops.Count == 1)
+ {
+ _notification.ShowInfo("A job segment must contain at least one brush stop.");
+ return;
+ }
SelectedSegment.BrushStops.Remove(x);
x.DefferedDelete(_activeJobDbContext);
});
@@ -2406,8 +2439,7 @@ namespace Tango.MachineStudio.Developer.ViewModels
public override void OnShuttingDown()
{
- _settings.LastSelectedMachineGuid = SelectedMachine != null ? SelectedMachine.Guid : null;
- _settings.LastSelectedJobGuid = SelectedMachineJob != null ? SelectedMachineJob.Guid : null;
+
}
#endregion