aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/JobsViewVM.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/JobsViewVM.cs')
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/JobsViewVM.cs55
1 files changed, 55 insertions, 0 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/JobsViewVM.cs
new file mode 100644
index 000000000..0eb59eeeb
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/JobsViewVM.cs
@@ -0,0 +1,55 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tango.BL;
+using Tango.BL.Entities;
+using Tango.PPC.Common;
+using Tango.PPC.Common.Application;
+using Tango.PPC.Common.Authentication;
+using Tango.PPC.Common.Navigation;
+using Tango.PPC.Common.Notifications;
+using Tango.Settings;
+using Tango.SharedUI;
+
+namespace Tango.PPC.UI.ViewModels
+{
+ public class JobsViewVM : PPCViewModel
+ {
+ private ObservablesContext _jobsContext;
+
+ private ObservableCollection<Job> _jobs;
+
+ public ObservableCollection<Job> Jobs
+ {
+ get { return _jobs; }
+ set { _jobs = value; RaisePropertyChangedAuto(); }
+ }
+
+ public JobsViewVM(IPPCApplicationManager application, IAuthenticationProvider authentication, INavigationManager navigation, INotificationProvider notification) : base(application, authentication, navigation, notification)
+ {
+ Jobs = new ObservableCollection<Job>();
+ }
+
+ public override void OnApplicationStarted()
+ {
+ LoadJobs();
+ }
+
+ private void LoadJobs()
+ {
+ Task.Factory.StartNew(() =>
+ {
+ if (_jobsContext != null)
+ {
+ _jobsContext.Dispose();
+ }
+
+ _jobsContext = ObservablesContext.CreateDefault();
+ Jobs = _jobsContext.Jobs.Where(x => x.Machine.SerialNumber == Settings.MachineSerialNumber).ToObservableCollection();
+ });
+ }
+ }
+}