aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2019-12-18 15:52:25 +0200
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2019-12-18 15:52:25 +0200
commit41b950b3f3f7fa0384cccd13ed4ef38119bbcbcf (patch)
treef6c535ae38fcf71842f0af4622c806044224974d /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs
parent615bc666c8d0618d93bc4401a74928535c2cc7f6 (diff)
downloadTango-41b950b3f3f7fa0384cccd13ed4ef38119bbcbcf.tar.gz
Tango-41b950b3f3f7fa0384cccd13ed4ef38119bbcbcf.zip
Fixed ContinueThreadLoadingResponse.
Refactored ActionLog Difference data structure to node tree.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs23
1 files changed, 22 insertions, 1 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 d598e2458..4b276462e 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
@@ -1928,7 +1928,7 @@ namespace Tango.MachineStudio.Developer.ViewModels
_activeJobDbContext.SaveChanges();
var afterJobDTO = JobDTO.FromObservable(ActiveJob);
- _actionLogManager.InsertLog(ActionLogType.JobSaved, AuthenticationProvider.CurrentUser, _beforeSaveJobDTO.Name, _beforeSaveJobDTO, afterJobDTO, "Job saved from research module in Machine Studio.").GetAwaiter().GetResult();
+ _actionLogManager.InsertLog(ActionLogType.JobSaved, AuthenticationProvider.CurrentUser, _beforeSaveJobDTO.Name, _beforeSaveJobDTO, afterJobDTO, "Job saved from research module in Machine Studio.");
_beforeSaveJobDTO = afterJobDTO;
_machineDbContext.Entry(SelectedMachineJob).Reload();
@@ -2191,6 +2191,8 @@ 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 =>
{
@@ -2202,6 +2204,11 @@ namespace Tango.MachineStudio.Developer.ViewModels
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);
+ }
}
}
}
@@ -2258,6 +2265,7 @@ namespace Tango.MachineStudio.Developer.ViewModels
LogManager.Log("Saving selected machine to database...");
await SelectedMachine.SaveAsync(_machineDbContext);
+ _actionLogManager.InsertLog(ActionLogType.JobCreated, AuthenticationProvider.CurrentUser, newJob.Name, newJob, "Job created using Machine Studio.");
SelectedMachineJob = newJob;
LoadSelectedJob();
}
@@ -2388,6 +2396,11 @@ namespace Tango.MachineStudio.Developer.ViewModels
LogManager.Log("Saving selected machine to database...");
await SelectedMachine.SaveAsync(_machineDbContext);
+ foreach (var job in SelectedJobs)
+ {
+ _actionLogManager.InsertLog(ActionLogType.JobCreated, AuthenticationProvider.CurrentUser, job.Name, job, "Job created using Machine Studio.");
+ }
+
CanWork = true;
}
}
@@ -2611,6 +2624,8 @@ namespace Tango.MachineStudio.Developer.ViewModels
LogManager.Log($"Importing job files...");
+ List<Job> jobsToReport = new List<Job>();
+
foreach (var file in dlg.FileNames)
{
var bytes = File.ReadAllBytes(file);
@@ -2619,10 +2634,16 @@ namespace Tango.MachineStudio.Developer.ViewModels
job.JobSource = JobSource.Remote;
_machineDbContext.Jobs.Add(job);
+ jobsToReport.Add(job);
}
await _machineDbContext.SaveChangesAsync();
+ foreach (var job in jobsToReport)
+ {
+ _actionLogManager.InsertLog(ActionLogType.JobImported, AuthenticationProvider.CurrentUser, job.Name, job, "New job imported using Machine Studio.");
+ }
+
IsFree = true;
_notification.ShowInfo($"Jobs imported successfully.");