aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2020-07-05 10:37:21 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2020-07-05 10:37:21 +0300
commit93f4cb963fa4ba040809779e60e64fb1161ea50d (patch)
treed3f47dde9f92f20c480f9d3ccee88945fdbdf82a /Software/Visual_Studio/PPC
parent4d3782e72e3bc9db6aab280abe7dd8c9cc2b5dbe (diff)
downloadTango-93f4cb963fa4ba040809779e60e64fb1161ea50d.tar.gz
Tango-93f4cb963fa4ba040809779e60e64fb1161ea50d.zip
Several corrections
Diffstat (limited to 'Software/Visual_Studio/PPC')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs21
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs14
2 files changed, 30 insertions, 5 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs
index 087e30be6..7869e6990 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/MainViewVM.cs
@@ -24,6 +24,7 @@ namespace Tango.PPC.Jobs.ViewModels
public class MainViewVM : PPCViewModel
{
private NotificationItem _last_failed_job_notification;
+ private bool resuming;
/// <summary>
/// Called when the application has been started.
@@ -33,15 +34,14 @@ namespace Tango.PPC.Jobs.ViewModels
MachineProvider.MachineOperator.PrintingCompleted += MachineOperator_PrintingCompleted;
MachineProvider.MachineOperator.PrintingFailed += MachineOperator_PrintingFailed;
MachineProvider.MachineOperator.ResumingJob += MachineOperator_ResumingJob;
+ MachineProvider.MachineOperator.PrintingStarted += MachineOperator_PrintingStarted;
}
- private void MachineOperator_ResumingJob(object sender, ResumingJobEventArgs e)
+ private void MachineOperator_PrintingStarted(object sender, PrintingEventArgs e)
{
- LogManager.Log($"Trying to resume job '{e.JobGuid}'...");
-
- try
+ if (resuming)
{
- e.Approve();
+ resuming = false;
InvokeUI(() =>
{
@@ -54,6 +54,17 @@ namespace Tango.PPC.Jobs.ViewModels
}
});
}
+ }
+
+ private void MachineOperator_ResumingJob(object sender, ResumingJobEventArgs e)
+ {
+ LogManager.Log($"Job resume request '{e.JobGuid}' approving...");
+
+ try
+ {
+ e.Approve();
+ resuming = true;
+ }
catch (Exception ex)
{
LogManager.Log(ex, "An error occurred while trying to resume the job.");
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs
index 54a92aa5c..d4d78dac6 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineUpdateViewVM.cs
@@ -609,6 +609,7 @@ namespace Tango.PPC.UI.ViewModels
{
_update_result = await MachineUpdateManager.UpdateFromTUP(request.RemoteTupFilePath, request.SetupFirmware, request.SetupFPGA);
LogManager.Log("Machine update from package completed.");
+ stopReporting = true;
InvokeUI(() =>
{
@@ -624,6 +625,8 @@ namespace Tango.PPC.UI.ViewModels
{
NavigateTo(MachineUpdateView.UpdateFailedFromPackageView);
});
+
+ throw ex;
}
await receiver.SendGenericResponse(new StartRemoteApplicationUpgradeResponse()
@@ -646,10 +649,13 @@ namespace Tango.PPC.UI.ViewModels
}
catch (Exception ex)
{
+ stopReporting = true;
await receiver.SendErrorResponse(ex, token);
}
finally
{
+ stopReporting = true;
+
try
{
File.Delete(request.RemoteTupFilePath);
@@ -707,6 +713,7 @@ namespace Tango.PPC.UI.ViewModels
try
{
await MachineUpdateManager.UpdateFromTFP(request.RemoteTfpFilePath);
+ stopReporting = true;
LogManager.Log("Firmware upgrade from package completed.");
_update_result = new MachineUpdateResult()
{
@@ -720,6 +727,8 @@ namespace Tango.PPC.UI.ViewModels
}
catch (Exception ex)
{
+ stopReporting = true;
+
LogManager.Log(ex, "Firmware upgrade from package failed.");
FailedError = ex.FlattenMessage();
@@ -727,6 +736,8 @@ namespace Tango.PPC.UI.ViewModels
{
NavigateTo(MachineUpdateView.UpdateFailedFromPackageView);
});
+
+ throw ex;
}
await receiver.SendGenericResponse(new StartRemoteFirmwareUpgradeResponse()
@@ -749,10 +760,13 @@ namespace Tango.PPC.UI.ViewModels
}
catch (Exception ex)
{
+ stopReporting = true;
await receiver.SendErrorResponse(ex, token);
}
finally
{
+ stopReporting = true;
+
try
{
File.Delete(request.RemoteTfpFilePath);