aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-05-13 13:58:45 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-05-13 13:58:45 +0300
commit4cc4089f36b0a9b9d754e33acb49da930f846699 (patch)
tree314c77ca012d10ff1440a112893072943e479066 /Software/Visual_Studio/PPC
parent8d58d0b03648069600f8abf39dbe68b16c90559b (diff)
downloadTango-4cc4089f36b0a9b9d754e33acb49da930f846699.tar.gz
Tango-4cc4089f36b0a9b9d754e33acb49da930f846699.zip
Some fixed to TCC mobile design.
Implemented DFU reset on Machine Operator.
Diffstat (limited to 'Software/Visual_Studio/PPC')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs2
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs24
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml3
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs46
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest2
5 files changed, 68 insertions, 9 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs
index 3b7c70bf8..e2c29cac5 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs
@@ -522,6 +522,8 @@ namespace Tango.PPC.Jobs.ViewModels
}
}
+ Job.LastUpdated = DateTime.UtcNow;
+ Job.JobStatus = BL.Enumerations.JobStatuses.Draft;
await _db.SaveChangesAsync();
RaiseMessage(new JobSavedMessage() { Job = Job });
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs
index 47d5835f5..b2f93c29d 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/ViewModels/SystemViewVM.cs
@@ -17,6 +17,7 @@ namespace Tango.PPC.Technician.ViewModels
{
private IOperationSystemManager _os;
private Timer _statsTimer;
+ private bool _resettingDevice;
private float _cpu;
public float CPU
@@ -39,6 +40,8 @@ namespace Tango.PPC.Technician.ViewModels
set { _temperature = value; RaisePropertyChangedAuto(); }
}
+ public RelayCommand ResetDeviceCommand { get; set; }
+
public RelayCommand RestartCommand { get; set; }
public RelayCommand ShutdownCommand { get; set; }
@@ -58,6 +61,27 @@ namespace Tango.PPC.Technician.ViewModels
ShutdownCommand = new RelayCommand(ShutdownSystem);
FactoryResetCommand = new RelayCommand(FactoryReset);
ExitToExplorerCommand = new RelayCommand(ExitToExplorer);
+ ResetDeviceCommand = new RelayCommand(ResetDevice, () => !_resettingDevice);
+ }
+
+ private async void ResetDevice()
+ {
+ try
+ {
+ _resettingDevice = true;
+ ResetDeviceCommand.RaiseCanExecuteChanged();
+ await MachineProvider.MachineOperator.ResetDFU();
+ await NotificationProvider.ShowInfo("Embedded device has been reset successfully.");
+ }
+ catch (Exception ex)
+ {
+ await NotificationProvider.ShowError(ex.FlattenMessage());
+ }
+ finally
+ {
+ _resettingDevice = false;
+ ResetDeviceCommand.RaiseCanExecuteChanged();
+ }
}
private async void FactoryReset()
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml
index 0b067b09b..d96da4f93 100644
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Technician/Views/SystemView.xaml
@@ -50,7 +50,8 @@
</UniformGrid>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Width="300" TextElement.FontSize="{StaticResource TangoTitleFontSize}">
- <touch:TouchButton Command="{Binding RestartCommand}" Height="60" Background="{StaticResource TangoErrorBrush}">Restart Device</touch:TouchButton>
+ <touch:TouchButton Command="{Binding ResetDeviceCommand}" Height="60" Background="{StaticResource TangoErrorBrush}">Reset Machine</touch:TouchButton>
+ <touch:TouchButton Command="{Binding RestartCommand}" Height="60" Background="{StaticResource TangoErrorBrush}" Margin="0 20 0 0">Restart Device</touch:TouchButton>
<touch:TouchButton Command="{Binding ShutdownCommand}" Height="60" Background="{StaticResource TangoErrorBrush}" Margin="0 20 0 0">Shutdown Device</touch:TouchButton>
<touch:TouchButton Command="{Binding FactoryResetCommand}" Height="60" Background="{StaticResource TangoErrorBrush}" Margin="0 20 0 0">Factory Reset</touch:TouchButton>
<touch:TouchButton Command="{Binding ExitToExplorerCommand}" Height="60" Background="{StaticResource TangoErrorBrush}" Margin="0 20 0 0">Exit To Shell</touch:TouchButton>
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs
index 7d4aa154e..1f09023cb 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs
@@ -45,7 +45,6 @@ namespace Tango.PPC.UI.Printing
/// <returns></returns>
public async Task<JobHandler> Print(Job job, ObservablesContext context)
{
-
JobHandler handler = null;
#if STUBPRINT
@@ -66,9 +65,25 @@ namespace Tango.PPC.UI.Printing
{
try
{
+ job.JobStatus = JobStatuses.Completed;
+
+ if (!context.IsDisposed)
+ {
+ await context.SaveChangesAsync();
+ }
+ else
+ {
+ using (var newContext = ObservablesContext.CreateDefault())
+ {
+ var newJob = newContext.Jobs.SingleOrDefault(y => y.Guid == job.Guid);
+ if (newJob != null)
+ {
+ newJob.JobStatus = JobStatuses.Completed;
+ await newContext.SaveChangesAsync();
+ }
+ }
+ }
- job.JobStatus = BL.Enumerations.JobStatuses.Completed;
- await context.SaveChangesAsync();
RaiseJobSaved(job);
}
catch (Exception ex)
@@ -76,12 +91,12 @@ namespace Tango.PPC.UI.Printing
LogManager.Log(ex, "Error occurred after job printing completed.");
}
};
- handler.Canceled += async (x, e) =>
+ handler.Canceled += (x, e) =>
{
try
{
//No change in status !
- await context.SaveChangesAsync();
+ //await context.SaveChangesAsync();
RaiseJobSaved(job);
}
catch (Exception ex)
@@ -94,8 +109,25 @@ namespace Tango.PPC.UI.Printing
try
{
- job.JobStatus = BL.Enumerations.JobStatuses.Disrupted;
- await context.SaveChangesAsync();
+ job.JobStatus = JobStatuses.Disrupted;
+
+ if (!context.IsDisposed)
+ {
+ await context.SaveChangesAsync();
+ }
+ else
+ {
+ using (var newContext = ObservablesContext.CreateDefault())
+ {
+ var newJob = newContext.Jobs.SingleOrDefault(y => y.Guid == job.Guid);
+ if (newJob != null)
+ {
+ newJob.JobStatus = JobStatuses.Disrupted;
+ await newContext.SaveChangesAsync();
+ }
+ }
+ }
+
RaiseJobSaved(job);
}
catch (Exception ex)
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest
index d72e75011..efc5f8179 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest
@@ -16,7 +16,7 @@
Remove this element if your application requires this virtualization for backwards
compatibility.
-->
- <requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
+ <!--<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />-->
</requestedPrivileges>
</security>
</trustInfo>