From afd359b383a09f720d512dbf1f3bb6707dc4b83e Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Tue, 10 Jul 2018 11:38:50 +0300 Subject: Implemented job type picker dialog. Implemented "native" touch listbox. --- .../Tango.PPC.Jobs/Dialogs/JobTypePickerView.xaml | 48 ++++++++++++++++++++++ .../Dialogs/JobTypePickerView.xaml.cs | 32 +++++++++++++++ .../Tango.PPC.Jobs/Dialogs/JobTypePickerViewVM.cs | 42 +++++++++++++++++++ .../Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj | 8 ++++ .../Tango.PPC.Jobs/ViewModels/JobsViewVM.cs | 7 +++- .../PPC/Tango.PPC.Common/Resources/Merged.xaml | 1 + .../PPCApplication/DefaultPPCApplicationManager.cs | 6 +-- 7 files changed, 140 insertions(+), 4 deletions(-) create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerView.xaml create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerView.xaml.cs create mode 100644 Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerViewVM.cs (limited to 'Software/Visual_Studio/PPC') diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerView.xaml new file mode 100644 index 000000000..07a662c77 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerView.xaml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CLOSE + + + + + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerView.xaml.cs new file mode 100644 index 000000000..cf5725685 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerView.xaml.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; +using Tango.BL.Enumerations; + +namespace Tango.PPC.Jobs.Dialogs +{ + /// + /// Interaction logic for JobTypePickerView.xaml + /// + public partial class JobTypePickerView : UserControl + { + /// + /// Initializes a new instance of the class. + /// + public JobTypePickerView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerViewVM.cs new file mode 100644 index 000000000..ead969126 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerViewVM.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.BL.Enumerations; +using Tango.SharedUI; + +namespace Tango.PPC.Jobs.Dialogs +{ + /// + /// Represents the a job type picker view model + /// + /// + public class JobTypePickerViewVM : DialogViewVM + { + private JobTypes? _selectedJobType; + /// + /// Gets or sets the type of the selected job. + /// + public JobTypes? SelectedJobType + { + get { return _selectedJobType; } + set + { + _selectedJobType = value; + OnSelectedJobTypeChanged(); + } + } + + /// + /// Called when the selected job type has been changed + /// + private void OnSelectedJobTypeChanged() + { + if (SelectedJobType.HasValue) + { + Accept(); + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj index 0a151b54b..0163b77c2 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj @@ -84,6 +84,10 @@ Designer MSBuild:Compile + + Designer + MSBuild:Compile + Designer MSBuild:Compile @@ -138,6 +142,10 @@ BasicColorCorrectionView.xaml + + JobTypePickerView.xaml + + diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs index d2c229187..39963201e 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs @@ -15,6 +15,7 @@ using Tango.Core.Commands; using Tango.Core.DI; using Tango.DragAndDrop; using Tango.PPC.Common; +using Tango.PPC.Jobs.Dialogs; using Tango.PPC.Jobs.Messages; using Tango.PPC.Jobs.Views; @@ -263,11 +264,15 @@ namespace Tango.PPC.Jobs.ViewModels /// private async void AddNewJob() { + var vm = await NotificationProvider.ShowDialog(); + + if (!vm.DialogResult) return; + Job job = new Job(); job.Name = "untitled"; job.CreationDate = DateTime.UtcNow; job.JobStatus = JobStatuses.Draft; - job.JobType = JobTypes.Sewing; + job.JobType = vm.SelectedJobType.Value; job.ColorSpaceGuid = Adapter.ColorSpaces.FirstOrDefault(x => x.Code == ColorSpaces.RGB.ToInt32()).Guid; job.MachineGuid = ApplicationManager.Machine.Guid; job.UserGuid = AuthenticationProvider.CurrentUser.Guid; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml index 21e37307f..7115b6557 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml @@ -36,6 +36,7 @@ +