aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-07-10 11:38:50 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-07-10 11:38:50 +0300
commitafd359b383a09f720d512dbf1f3bb6707dc4b83e (patch)
tree950435d3dd35a268f44576330a2c9b0996ae97c2 /Software/Visual_Studio/PPC
parent17edf0cd108fb4a27dade328eaa294d352909b8f (diff)
downloadTango-afd359b383a09f720d512dbf1f3bb6707dc4b83e.tar.gz
Tango-afd359b383a09f720d512dbf1f3bb6707dc4b83e.zip
Implemented job type picker dialog.
Implemented "native" touch listbox.
Diffstat (limited to 'Software/Visual_Studio/PPC')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerView.xaml48
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerView.xaml.cs32
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerViewVM.cs42
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj8
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs7
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.Common/Resources/Merged.xaml1
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs6
7 files changed, 140 insertions, 4 deletions
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 @@
+<UserControl x:Class="Tango.PPC.Jobs.Dialogs.JobTypePickerView"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:local="clr-namespace:Tango.PPC.Jobs.Dialogs"
+ xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL"
+ xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
+ xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
+ xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch"
+ mc:Ignorable="d"
+ Background="{StaticResource TangoPrimaryBackgroundBrush}" Width="500" Height="400" d:DataContext="{d:DesignInstance Type=local:JobTypePickerViewVM, IsDesignTimeCreatable=False}">
+
+ <UserControl.Resources>
+ <converters:EnumToXamlVectorConverter x:Key="EnumToXamlVectorConverter" />
+ </UserControl.Resources>
+
+ <Grid>
+ <Grid Margin="20">
+ <Grid.RowDefinitions>
+ <RowDefinition Height="40"/>
+ <RowDefinition Height="1*"/>
+ <RowDefinition Height="60"/>
+ </Grid.RowDefinitions>
+
+ <TextBlock VerticalAlignment="Center" Text="Select Job Type" FontSize="{StaticResource TangoMessageBoxTitleFontSize}"></TextBlock>
+
+ <touch:TouchNativeListBox RippleFactor="10" Grid.Row="1" Margin="0 15 0 0" ItemsSource="{Binding Source={x:Type enumerations:JobTypes},Converter={StaticResource EnumToItemsSourceConverter}}" SelectedValuePath="Value" SelectedValue="{Binding SelectedJobType,Mode=OneWayToSource}" SelectedIndex="-1">
+ <ListBox.ItemTemplate>
+ <DataTemplate>
+ <Border Padding="0 15">
+ <StackPanel Orientation="Horizontal">
+ <Path Stretch="Fill" Fill="{StaticResource TangoDarkForegroundBrush}" Data="{Binding Value,Converter={StaticResource EnumToXamlVectorConverter}}" Width="60" Height="60"></Path>
+ <TextBlock VerticalAlignment="Center" Margin="20 0 0 0" Text="{Binding DisplayName}" FontSize="{StaticResource TangoButtonFontSize}"></TextBlock>
+ </StackPanel>
+ </Border>
+ </DataTemplate>
+ </ListBox.ItemTemplate>
+ </touch:TouchNativeListBox>
+
+ <Grid Grid.Row="3">
+ <StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
+ <touch:TouchButton Command="{Binding CloseCommand}" CornerRadius="25" Style="{StaticResource TangoHollowButton}" Width="170" Height="50" VerticalAlignment="Bottom">CLOSE</touch:TouchButton>
+ </StackPanel>
+ </Grid>
+ </Grid>
+ </Grid>
+</UserControl>
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
+{
+ /// <summary>
+ /// Interaction logic for JobTypePickerView.xaml
+ /// </summary>
+ public partial class JobTypePickerView : UserControl
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="JobTypePickerView"/> class.
+ /// </summary>
+ 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
+{
+ /// <summary>
+ /// Represents the a job type picker view model
+ /// </summary>
+ /// <seealso cref="Tango.SharedUI.DialogViewVM" />
+ public class JobTypePickerViewVM : DialogViewVM
+ {
+ private JobTypes? _selectedJobType;
+ /// <summary>
+ /// Gets or sets the type of the selected job.
+ /// </summary>
+ public JobTypes? SelectedJobType
+ {
+ get { return _selectedJobType; }
+ set
+ {
+ _selectedJobType = value;
+ OnSelectedJobTypeChanged();
+ }
+ }
+
+ /// <summary>
+ /// Called when the selected job type has been changed
+ /// </summary>
+ 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 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
+ <Page Include="Dialogs\JobTypePickerView.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
<Page Include="Resources\Styles.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
@@ -138,6 +142,10 @@
<DependentUpon>BasicColorCorrectionView.xaml</DependentUpon>
</Compile>
<Compile Include="Dialogs\BasicColorCorrectionViewVM.cs" />
+ <Compile Include="Dialogs\JobTypePickerView.xaml.cs">
+ <DependentUpon>JobTypePickerView.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="Dialogs\JobTypePickerViewVM.cs" />
<Compile Include="JobsModule.cs" />
<Compile Include="JobsModuleSettings.cs" />
<Compile Include="Messages\JobRemovedMessage.cs" />
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
/// </summary>
private async void AddNewJob()
{
+ var vm = await NotificationProvider.ShowDialog<JobTypePickerViewVM>();
+
+ 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 @@
<converters:WidthHeightToRectConverter x:Key="WidthHeightToRectConverter" />
<converters:OneToPercentConverter x:Key="OneToPercentConverter" />
<converters:SmallerThanToBooleanConverter x:Key="SmallerThanToBooleanConverter" />
+ <converters:EnumToItemsSourceConverter x:Key="EnumToItemsSourceConverter" />
<Style TargetType="FrameworkElement">
<Setter Property="TextElement.FontFamily" Value="{StaticResource TangoFlexoFontFamily}"></Setter>
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs
index 65ee12124..c9d0ab35c 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/PPCApplication/DefaultPPCApplicationManager.cs
@@ -192,9 +192,9 @@ namespace Tango.PPC.UI.PPCApplication
private async void ConnectToMachine()
{
- var machine = new MachineOperator(new UsbTransportAdapter("COM3", UsbSerialBaudRates.BR_9600));
- await machine.Connect();
- ConnectedMachine = machine;
+ //var machine = new MachineOperator(new UsbTransportAdapter("COM3", UsbSerialBaudRates.BR_9600));
+ //await machine.Connect();
+ //ConnectedMachine = machine;
}
}
}