diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2018-06-11 11:26:47 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2018-06-11 11:26:47 +0300 |
| commit | 23600da8f47bde5e0916b0bea3edb17b9911c654 (patch) | |
| tree | 8a1a685c6e66eaad5e9df0993f628ca842fee00d /Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels | |
| parent | 51d7c41cbbec95d2428a270b3f585011aa9babf3 (diff) | |
| parent | b21d8e7c164b63d14d15cfdf3dda68ae88a03043 (diff) | |
| download | Tango-23600da8f47bde5e0916b0bea3edb17b9911c654.tar.gz Tango-23600da8f47bde5e0916b0bea3edb17b9911c654.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels')
3 files changed, 32 insertions, 25 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 index b5e3e18fc..14204da7d 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/JobsViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/JobsViewVM.cs @@ -51,19 +51,7 @@ namespace Tango.PPC.UI.ViewModels public RelayCommand<DropEventArgs> OnDragAndDropCommand { get; set; } - public JobsViewVM(IPPCApplicationManager application, IAuthenticationProvider authentication, INavigationManager navigation, INotificationProvider notification) : base(application, authentication, navigation, notification) - { - Jobs = new ObservableCollection<Job>(); - - JobSelectedCommand = new RelayCommand((x) => JobSelected(x as Job)); - OnDragAndDropCommand = new RelayCommand<DropEventArgs>((e) => - { - Job draggedJob = e.Draggable.DataContext as Job; - Job droppedJob = e.Droppable.DataContext as Job; - - OnDragAndDropJobs(draggedJob, droppedJob); - }); - } + public RelayCommand<Job> RemoveJobCommand { get; set; } private void OnDragAndDropJobs(Job draggedJob, Job droppedJob) { @@ -88,9 +76,31 @@ namespace Tango.PPC.UI.ViewModels JobsCollectionView.Refresh(); } - private void JobSelected(Job job) + private async void JobSelected(Job job) { Debug.WriteLine(job.Name); + await NotificationProvider.ShowInfo("Job details not yet implemented..."); + } + + public JobsViewVM() + { + Jobs = new ObservableCollection<Job>(); + + JobSelectedCommand = new RelayCommand((x) => JobSelected(x as Job)); + OnDragAndDropCommand = new RelayCommand<DropEventArgs>((e) => + { + Job draggedJob = e.Draggable.DataContext as Job; + Job droppedJob = e.Droppable.DataContext as Job; + + OnDragAndDropJobs(draggedJob, droppedJob); + }); + + RemoveJobCommand = new RelayCommand<Job>(RemoveJob); + } + + private void RemoveJob(Job job) + { + NotificationProvider.ShowQuestion("Are you sure you want to remove " + job.Name); } public override void OnApplicationStarted() @@ -112,7 +122,7 @@ namespace Tango.PPC.UI.ViewModels _jobsContext = ObservablesContext.CreateDefault(); Jobs = _jobsContext.Jobs.Where(x => x.Machine.SerialNumber == Settings.MachineSerialNumber).ToObservableCollection(); - JobsCollectionView = CollectionViewSource.GetDefaultView(Jobs); + JobsCollectionView = CollectionViewSource.GetDefaultView(Jobs.Concat(Jobs).Concat(Jobs).Concat(Jobs).Concat(Jobs).Concat(Jobs).Concat(Jobs)); JobsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Job.LastUpdated), ListSortDirection.Descending)); }); } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs index 37940b2f8..a33dc25d7 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/LoadingViewVM.cs @@ -17,11 +17,6 @@ namespace Tango.PPC.UI.ViewModels { public class LoadingViewVM : PPCViewModel { - public LoadingViewVM(IPPCApplicationManager application, IAuthenticationProvider authentication, INavigationManager navigation, INotificationProvider notification) : base(application, authentication, navigation, notification) - { - - } - public async override void OnApplicationStarted() { await Task.Delay(500); diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs index c75e031f1..d1fc4c015 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MainViewVM.cs @@ -3,18 +3,20 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +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.SharedUI; namespace Tango.PPC.UI.ViewModels { - public class MainViewVM : ViewModel + public class MainViewVM : PPCViewModel { - public String Test { get; set; } - - public MainViewVM(IPPCApplicationManager application) + public override void OnApplicationStarted() { - Test = "This is a binding test"; + } } } |
