diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2018-11-25 18:41:28 +0200 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2018-11-25 18:41:28 +0200 |
| commit | ab4d7232c388a10224a642fe210b30670f91e574 (patch) | |
| tree | 75b7349a23f5db0c682dcce2ba87a85a18409b42 /Software/Visual_Studio/PPC/Modules | |
| parent | 80ed2914882d82dce0f60c09185da6a500f78d8b (diff) | |
| parent | 03180d26af65c24822cf5ffd44a347db7394d3b2 (diff) | |
| download | Tango-ab4d7232c388a10224a642fe210b30670f91e574.tar.gz Tango-ab4d7232c388a10224a642fe210b30670f91e574.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules')
32 files changed, 1014 insertions, 27 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Converters/JobTypeToImageConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Converters/JobTypeToImageConverter.cs new file mode 100644 index 000000000..aaa6a5bf2 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Converters/JobTypeToImageConverter.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using Tango.BL.Enumerations; +using Tango.SharedUI.Helpers; + +namespace Tango.PPC.Jobs.Converters +{ + public class JobTypeToImageConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + JobTypes jobType = (JobTypes)value; + + switch (jobType) + { + case JobTypes.Embroidery: + return ResourceHelper.GetImageFromResources("Images/Embroidery.png"); + case JobTypes.Sewing: + return ResourceHelper.GetImageFromResources("Images/Sewing.png"); + case JobTypes.Knitting: + return ResourceHelper.GetImageFromResources("Images/Knitting.png"); + } + + return null; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} 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 index 810fcaf41..814f73eb1 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Dialogs/JobTypePickerView.xaml @@ -5,14 +5,15 @@ 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:converters="clr-namespace:Tango.PPC.Jobs.Converters" 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}"> + Background="{StaticResource TangoPrimaryBackgroundBrush}" Width="600" Height="380" d:DataContext="{d:DesignInstance Type=local:JobTypePickerViewVM, IsDesignTimeCreatable=False}"> <UserControl.Resources> - <converters:EnumToXamlVectorConverter x:Key="EnumToXamlVectorConverter" /> + <converters:JobTypeToImageConverter x:Key="JobTypeToImageConverter" /> + </UserControl.Resources> <Grid> @@ -20,17 +21,17 @@ <Grid.RowDefinitions> <RowDefinition Height="40"/> <RowDefinition Height="1*"/> - <RowDefinition Height="60"/> + <RowDefinition Height="0"/> </Grid.RowDefinitions> - <TextBlock VerticalAlignment="Center" Text="Select Job Type" FontSize="{StaticResource TangoMessageBoxTitleFontSize}"></TextBlock> + <TextBlock VerticalAlignment="Center" Text="Select Job Application" FontSize="{StaticResource TangoMessageBoxTitleFontSize}"></TextBlock> <touch:TouchNativeListBox RippleFactor="10" Grid.Row="1" Margin="0 15 0 0" ItemsSource="{Binding SupportedJobTypes}" SelectedItem="{Binding SelectedJobType,Mode=OneWayToSource}" SelectedIndex="-1"> <ListBox.ItemTemplate> <DataTemplate> <Border Padding="0 15"> <StackPanel Orientation="Horizontal"> - <Path Stretch="Fill" Fill="{StaticResource TangoDarkForegroundBrush}" Data="{Binding Converter={StaticResource EnumToXamlVectorConverter}}" Width="60" Height="60"></Path> + <Image Stretch="Fill" Width="60" RenderOptions.BitmapScalingMode="Fant" Height="60" Source="{Binding Converter={StaticResource JobTypeToImageConverter}}"></Image> <TextBlock VerticalAlignment="Center" Margin="20 0 0 0" Text="{Binding Converter={StaticResource EnumToDescriptionConverter}}" FontSize="{StaticResource TangoButtonFontSize}"></TextBlock> </StackPanel> </Border> @@ -38,11 +39,11 @@ </ListBox.ItemTemplate> </touch:TouchNativeListBox> - <Grid Grid.Row="3"> + <!--<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> </Grid> </UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/Embroidery.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/Embroidery.png Binary files differnew file mode 100644 index 000000000..d71717835 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/Embroidery.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/Knitting.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/Knitting.png Binary files differnew file mode 100644 index 000000000..06c345965 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/Knitting.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/Sewing.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/Sewing.png Binary files differnew file mode 100644 index 000000000..51c468eea --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/Sewing.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Properties/AssemblyInfo.cs index 657d58fa3..095f10d3b 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Properties/AssemblyInfo.cs @@ -7,7 +7,7 @@ using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("Tango Panel PC Jobs Module")] +[assembly: AssemblyTitle("Tango PPC Jobs Module")] [assembly: AssemblyVersion("2.0.7.1119")] [assembly:ThemeInfo( diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Resources/Styles.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Resources/Styles.xaml index 60879a7bd..b1f4b6d49 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Resources/Styles.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Resources/Styles.xaml @@ -31,11 +31,11 @@ <Setter Property="CornerRadius" Value="5"></Setter> <Setter Property="Margin" Value="5 4"></Setter> <Setter Property="Height" Value="78"></Setter> - <Setter Property="Effect"> + <!--<Setter Property="Effect"> <Setter.Value> <DropShadowEffect BlurRadius="5" ShadowDepth="1" Color="{StaticResource TangoDropShadowColor}" /> </Setter.Value> - </Setter> + </Setter>--> </Style> <Style TargetType="{x:Type touch:LightTouchDataGridCell}" BasedOn="{StaticResource {x:Type touch:LightTouchDataGridCell}}"> 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 d804f4f28..aa473ec02 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 @@ -149,6 +149,7 @@ <Compile Include="Converters\JobCollectionToCategoryCountConverter.cs" /> <Compile Include="Converters\JobProgressToPositionConverter.cs" /> <Compile Include="Converters\JobToPieImageConverter.cs" /> + <Compile Include="Converters\JobTypeToImageConverter.cs" /> <Compile Include="Dialogs\AdvancedColorCorrectionView.xaml.cs"> <DependentUpon>AdvancedColorCorrectionView.xaml</DependentUpon> </Compile> @@ -232,6 +233,10 @@ <Project>{b112d89a-a106-41ae-a0c1-4abc84c477f5}</Project> <Name>Tango.DragAndDrop</Name> </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Explorer\Tango.Explorer.csproj"> + <Project>{4399AF76-DB52-4CFB-8020-6F85BDB29FD5}</Project> + <Name>Tango.Explorer</Name> + </ProjectReference> <ProjectReference Include="..\..\..\Tango.Hive\Tango.Hive.csproj"> <Project>{942134ac-6ea2-4500-8f22-0f739b70a05f}</Project> <Name>Tango.Hive</Name> @@ -268,6 +273,10 @@ <Project>{0be74eee-22cb-4dba-b896-793b9e1a3ac0}</Project> <Name>Tango.PPC.Common</Name> </ProjectReference> + <ProjectReference Include="..\Tango.PPC.Storage\Tango.PPC.Storage.csproj"> + <Project>{04febb02-f782-4b96-b47d-f6902afa43be}</Project> + <Name>Tango.PPC.Storage</Name> + </ProjectReference> </ItemGroup> <ItemGroup> <Resource Include="Images\jobs-module.png" /> @@ -338,10 +347,19 @@ <ItemGroup> <Resource Include="Images\JobView\color-picker.png" /> </ItemGroup> + <ItemGroup> + <Resource Include="Images\Sewing.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\Embroidery.png" /> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\Knitting.png" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs index 874beba75..6b2a610b3 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs @@ -967,7 +967,7 @@ namespace Tango.PPC.Jobs.ViewModels { Thread.Sleep(500); - if (Job != null && IsVisible && (Job.ColorSpace != null && Job.ColorSpace.Code == BL.Enumerations.ColorSpaces.RGB.ToInt32())) + if (Job != null && IsVisible && (Job.ColorSpace != null && (Job.ColorSpace.Code == BL.Enumerations.ColorSpaces.RGB.ToInt32() || Job.ColorSpace.Code == BL.Enumerations.ColorSpaces.LAB.ToInt32()))) { var brushStops = Job.Segments.SelectMany(x => x.BrushStops).Where(x => !x.Corrected && !x.OutOfGamutChecked).ToList(); 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 c4bd1f5b8..2f22e2f2d 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 @@ -22,6 +22,11 @@ using Tango.PPC.Jobs.Views; using System.Data.Entity; using Tango.BL.Builders; using Tango.PPC.Jobs.NavigationObjects; +using Tango.PPC.Storage; +using Tango.Explorer; +using System.IO; +using Google.Protobuf; +using Tango.PMR.Exports; namespace Tango.PPC.Jobs.ViewModels { @@ -137,6 +142,11 @@ namespace Tango.PPC.Jobs.ViewModels /// </summary> public RelayCommand CloneJobsCommand { get; set; } + /// <summary> + /// Gets or sets the export job command. + /// </summary> + public RelayCommand ExportJobCommand { get; set; } + #endregion #region Constructors @@ -162,6 +172,7 @@ namespace Tango.PPC.Jobs.ViewModels AddJobCommand = new RelayCommand(AddNewJob); DeleteJobsCommand = new RelayCommand(() => DeleteJobs(SelectedJobs)); CloneJobsCommand = new RelayCommand(() => CloneJobs(SelectedJobs)); + ExportJobCommand = new RelayCommand(ExportJob); RegisterForMessage<JobRemovedMessage>(HandleJobRemovedMessage); RegisterForMessage<JobSavedMessage>(HandleJobSavedMessage); @@ -451,6 +462,56 @@ namespace Tango.PPC.Jobs.ViewModels public override void OnApplicationReady() { base.OnApplicationReady(); + StorageProvider.RegisterFileHandler(ExplorerFileDefinition.Job.Extension, HandleJobFileLoaded); + } + + #endregion + + #region Job Export + + private async void ExportJob() + { + var selected_job = SelectedJobs.First(); + ClearSelection(); + + var result = await NavigationManager. + NavigateForResult<StorageModule, + Storage.Views.MainView, ExplorerFileItem, + Storage.Models.StorageNavigationRequest>( + new Storage.Models.StorageNavigationRequest() + { + Intent = Storage.Models.StorageNavigationIntent.SaveFile, + DefaultFileName = selected_job.Name + ExplorerFileDefinition.Job.Extension, + Filter = ExplorerFileDefinition.Job.Extension + }); + + if (result != null) + { + var jobFile = await selected_job.ToJobFile(); + + using (FileStream fs = new FileStream(result.Path, FileMode.Create)) + { + jobFile.WriteTo(fs); + } + + await NotificationProvider.ShowInfo("Job saved."); + } + } + + #endregion + + #region Handle Job File Loading From Storage + + private async void HandleJobFileLoaded(ExplorerFileItem jobFile) + { + using (ObservablesContext jobContext = ObservablesContext.CreateDefault()) + { + JobFile jFile = JobFile.Parser.ParseFrom(File.ReadAllBytes(jobFile.Path)); + var job = await Job.FromJobFile(jFile, MachineProvider.Machine.Guid, AuthenticationProvider.CurrentUser.Guid); + jobContext.Jobs.Add(job); + await jobContext.SaveChangesAsync(); + LoadJobs(); + } } #endregion diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml index 46fa981e9..ada22ce5a 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml @@ -39,24 +39,24 @@ <DataTemplate x:Key="CMYK_Template" DataType="{x:Type entities:BrushStop}"> <UniformGrid Rows="1" Columns="4"> - <touch:TouchNumericTextBox Margin="2 0" HorizontalContentAlignment="Center" Value="{Binding Cyan,Converter={StaticResource OneToPercentConverter}}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Maximum="100" StringFormat="0" /> - <touch:TouchNumericTextBox Margin="2 0" HorizontalContentAlignment="Center" Value="{Binding Magenta,Converter={StaticResource OneToPercentConverter}}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Maximum="100" StringFormat="0" /> - <touch:TouchNumericTextBox Margin="2 0" HorizontalContentAlignment="Center" Value="{Binding Yellow,Converter={StaticResource OneToPercentConverter}}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Maximum="100" StringFormat="0" /> - <touch:TouchNumericTextBox Margin="2 0" HorizontalContentAlignment="Center" Value="{Binding Black,Converter={StaticResource OneToPercentConverter}}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Maximum="100" StringFormat="0" /> + <touch:TouchNumericTextBox Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Cyan,Converter={StaticResource OneToPercentConverter}}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Maximum="100" StringFormat="0" /> + <touch:TouchNumericTextBox Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Magenta,Converter={StaticResource OneToPercentConverter}}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Maximum="100" StringFormat="0" /> + <touch:TouchNumericTextBox Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Yellow,Converter={StaticResource OneToPercentConverter}}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Maximum="100" StringFormat="0" /> + <touch:TouchNumericTextBox Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding Black,Converter={StaticResource OneToPercentConverter}}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Maximum="100" StringFormat="0" /> </UniformGrid> </DataTemplate> <DataTemplate x:Key="LAB_Template" DataType="{x:Type entities:BrushStop}"> <UniformGrid Rows="1" Columns="3"> - <touch:TouchNumericTextBox Margin="2 0" HorizontalContentAlignment="Center" Value="{Binding L}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Minimum="0" Maximum="100" StringFormat="0.00" /> - <touch:TouchNumericTextBox Margin="2 0" HorizontalContentAlignment="Center" Value="{Binding A}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Minimum="-128" Maximum="128" StringFormat="0.00" /> - <touch:TouchNumericTextBox Margin="2 0" HorizontalContentAlignment="Center" Value="{Binding B}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Minimum="-128" Maximum="128" StringFormat="0.00" /> + <touch:TouchNumericTextBox Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding L}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Minimum="0" Maximum="100" StringFormat="0.00" /> + <touch:TouchNumericTextBox Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding A}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Minimum="-128" Maximum="128" StringFormat="0.00" /> + <touch:TouchNumericTextBox Margin="2 0" ValueChanged="OnBrushStopFieldValueChanged" HorizontalContentAlignment="Center" Value="{Binding B}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Minimum="-128" Maximum="128" StringFormat="0.00" /> </UniformGrid> </DataTemplate> <DataTemplate x:Key="TWINE_Template" DataType="{x:Type entities:BrushStop}"> <DockPanel> - <touch:TouchIconButton Margin="0 0 -40 0" CornerRadius="50" Width="32" Height="32" Padding="5" RippleBrush="{StaticResource TangoRippleDarkBrush}" DockPanel.Dock="Right" Icon="FormatColorFill" Foreground="{StaticResource TangoPrimaryAccentBrush}" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.OpenTwineCatalogCommand}" CommandParameter="{Binding}"></touch:TouchIconButton> + <touch:TouchIconButton Margin="0 0 -40 0" CornerRadius="50" Width="32" Height="32" Padding="5" RippleBrush="{StaticResource TangoRippleDarkBrush}" DockPanel.Dock="Right" Icon="Palette" Foreground="{StaticResource TangoPrimaryAccentBrush}" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.OpenTwineCatalogCommand}" CommandParameter="{Binding}"></touch:TouchIconButton> <touch:TouchAutoComplete Margin="2 0" ItemsSource="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.TwineCatalogItems}" Watermark="Color Code" PopupHeight="250" DisplayMemberPath="Name" AutoCompleteProvider="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.TwineCatalogAutoCompleteProvider}" SelectedItem="{Binding ColorCatalog,Mode=TwoWay,ValidatesOnDataErrors=True,ValidatesOnNotifyDataErrors=True}" keyboard:KeyboardView.Container="{Binding ElementName=Container}"> <touch:TouchAutoComplete.ItemTemplate> <DataTemplate> @@ -140,10 +140,10 @@ </DataTemplate> <DataTemplate x:Key="Segment_Template" DataType="{x:Type entities:Segment}"> - <Border Margin="0 0 0 15" RenderOptions.EdgeMode="Aliased" CornerRadius="8" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="1" BorderBrush="{StaticResource TangoGrayBrush}"> - <Border.Effect> + <Border Margin="0 0 0 15" RenderOptions.EdgeMode="Unspecified" CornerRadius="8" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="1" BorderBrush="{StaticResource TangoGrayBrush}"> + <!--<Border.Effect> <DropShadowEffect Opacity="0.5" Color="{StaticResource TangoDropShadowColor}" BlurRadius="10" ShadowDepth="15" /> - </Border.Effect> + </Border.Effect>--> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> @@ -388,7 +388,7 @@ <touch:TouchAutoComplete Text="{Binding CustomersFilter}" ItemsSource="{Binding Customers}" SelectedItem="{Binding Job.Customer}" DisplayMemberPath="Name" AutoCompleteProvider="{Binding CustomersAutoCompleteProvider}" KeyboardMode="AlphaNumeric" KeyboardAction="Next" KeyboardContainer="{Binding ElementName=Container}" /> <TextBlock>Thread type:</TextBlock> - <touch:TouchComboBox ItemsSource="{Binding Rmls}" SelectedItem="{Binding Job.Rml}" DisplayMemberPath="Name" Title="Select Thread Type" /> + <touch:TouchComboBox ItemsSource="{Binding Rmls}" SelectedItem="{Binding Job.Rml}" DisplayMemberPath="Name" Title="Select Thread" /> <TextBlock>Comment:</TextBlock> <TextBox Margin="20 0 0 -42" Text="{Binding Job.Description}" FocusVisualStyle="{x:Null}" BorderBrush="{StaticResource TangoDividerBrush}" Foreground="{StaticResource TangoDarkForegroundBrush}" AcceptsReturn="True" TextWrapping="Wrap" Height="60" Padding="5"> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml index 09b6bc572..89feb8dc3 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml @@ -81,6 +81,7 @@ </Style> </touch:TouchIconButton.Style> </touch:TouchIconButton> + <touch:TouchIconButton Command="{Binding ExportJobCommand}" Margin="0 0 30 0" Padding="20" Icon="HddRegular" Style="{StaticResource TangoRoundTouchIconButton}"></touch:TouchIconButton> <touch:TouchIconButton Command="{Binding CloneJobsCommand}" Margin="0 0 30 0" Padding="20" Icon="CopyRegular" Style="{StaticResource TangoRoundTouchIconButton}"></touch:TouchIconButton> <touch:TouchIconButton Command="{Binding DeleteJobsCommand}" Padding="20" Icon="TrashAltRegular" Style="{StaticResource TangoRoundTouchIconButton}"></touch:TouchIconButton> </StackPanel> @@ -132,7 +133,7 @@ <Grid Grid.Row="1" x:Name="moveGrid"> <touch:TouchLoadingPanel IsLoading="{Binding IsLoadingJobs}"> - <touch:LightTouchDataGrid RenderOptions.EdgeMode="Aliased" Style="{StaticResource TangoJobsGrid}" x:Name="dataGridJobs" SelectedItems="{Binding SelectedJobs}" IsMultiSelecting="{Binding IsMultiSelecting,Mode=TwoWay}" OnDragAndDropCommand="{Binding JobDragedDroppedCommand}" ItemsSource="{Binding JobsCollectionView}" ItemSelectedCommand="{Binding JobSelectedCommand}" Margin="10"> + <touch:LightTouchDataGrid RenderOptions.EdgeMode="Unspecified" Style="{StaticResource TangoJobsGrid}" x:Name="dataGridJobs" SelectedItems="{Binding SelectedJobs}" IsMultiSelecting="{Binding IsMultiSelecting,Mode=TwoWay}" OnDragAndDropCommand="{Binding JobDragedDroppedCommand}" ItemsSource="{Binding JobsCollectionView}" ItemSelectedCommand="{Binding JobSelectedCommand}" Margin="10"> <touch:LightTouchDataGrid.Columns> <touch:LightTouchDataGridColumn Width="50"> <touch:LightTouchDataGridColumn.Header> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/AssemblyInfo.cs index 8e6777b64..d07b99ec8 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Properties/AssemblyInfo.cs @@ -7,7 +7,7 @@ using System.Windows; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("Tango Module")] +[assembly: AssemblyTitle("Tango PPC Settings Module")] [assembly: AssemblyVersion("2.0.4.1119")] [assembly: ThemeInfo( diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/App.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/App.xaml new file mode 100644 index 000000000..3a30cbc37 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/App.xaml @@ -0,0 +1,11 @@ +<Application x:Class="Tango.PPC.Storage.App" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> + <Application.Resources> + <ResourceDictionary> + <ResourceDictionary.MergedDictionaries> + <ResourceDictionary Source="pack://application:,,,/Tango.PPC.Common;component/Resources/Merged.xaml" /> + </ResourceDictionary.MergedDictionaries> + </ResourceDictionary> + </Application.Resources> +</Application>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Images/storage-module.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Images/storage-module.png Binary files differnew file mode 100644 index 000000000..252e42e38 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Images/storage-module.png diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Models/StorageNavigationIntent.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Models/StorageNavigationIntent.cs new file mode 100644 index 000000000..2c2a7f10d --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Models/StorageNavigationIntent.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Storage.Models +{ + public enum StorageNavigationIntent + { + LoadFile, + SaveFile + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Models/StorageNavigationRequest.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Models/StorageNavigationRequest.cs new file mode 100644 index 000000000..32a546f4f --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Models/StorageNavigationRequest.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.PPC.Storage.Models +{ + public class StorageNavigationRequest + { + /// <summary> + /// Gets or sets the request intent. + /// </summary> + public StorageNavigationIntent Intent { get; set; } + + /// <summary> + /// Gets or sets the file display filter (e.g .tup|.job|.ccp). + /// </summary> + public String Filter { get; set; } + + /// <summary> + /// Gets or sets the default file name when saving a file. + /// </summary> + public String DefaultFileName { get; set; } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..201341ef7 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Properties/AssemblyInfo.cs @@ -0,0 +1,20 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Tango PPC Storage Module")] +[assembly: AssemblyVersion("2.0.2.1119")] + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Properties/Resources.Designer.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Properties/Resources.Designer.cs new file mode 100644 index 000000000..8d882d6ad --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Properties/Resources.Designer.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Tango.PPC.Storage.Properties { + + + /// <summary> + /// A strongly-typed resource class, for looking up localized strings, etc. + /// </summary> + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// <summary> + /// Returns the cached ResourceManager instance used by this class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if ((resourceMan == null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tango.PPC.Storage.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// <summary> + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// </summary> + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Properties/Resources.resx b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Properties/Resources.resx @@ -0,0 +1,117 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Properties/Settings.Designer.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Properties/Settings.Designer.cs new file mode 100644 index 000000000..8e95a1b27 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Properties/Settings.Designer.cs @@ -0,0 +1,30 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace Tango.PPC.Storage.Properties +{ + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase + { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default + { + get + { + return defaultInstance; + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Properties/Settings.settings b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Properties/Settings.settings @@ -0,0 +1,7 @@ +<?xml version='1.0' encoding='utf-8'?> +<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)"> + <Profiles> + <Profile Name="(Default)" /> + </Profiles> + <Settings /> +</SettingsFile>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/StorageModule.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/StorageModule.cs new file mode 100644 index 000000000..a589e35bd --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/StorageModule.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media.Imaging; +using Tango.BL.Enumerations; +using Tango.PPC.Common; +using Tango.PPC.Storage.Views; +using Tango.SharedUI.Helpers; + +namespace Tango.PPC.Storage +{ + /// <summary> + /// Represents a PPC <see cref="StorageModule"/>. + /// </summary> + /// <seealso cref="Tango.PPC.Common.PPCModuleBase" /> + [PPCModule(3)] + public class StorageModule : PPCModuleBase + { + /// <summary> + /// Gets the module name. + /// </summary> + public override string Name + { + get + { + return "Storage"; + } + } + + /// <summary> + /// Gets the module description. + /// </summary> + public override string Description + { + get + { + return "Tango PPC Removable Drive Storage Module."; + } + } + + /// <summary> + /// Gets the module cover image. + /// </summary> + public override BitmapSource Image + { + get + { + return ResourceHelper.GetImageFromResources("Images/storage-module.png"); + } + } + + /// <summary> + /// Gets the module entry point view type. + /// </summary> + public override Type MainViewType + { + get + { + return typeof(MainView); + } + } + + /// <summary> + /// Gets the permission required to see and load this module. + /// </summary> + public override Permissions Permission + { + get + { + return Permissions.RunMachineStudio; + } + } + + /// <summary> + /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. + /// </summary> + public override void Dispose() + { + //Dispose module here... + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Tango.PPC.Storage.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Tango.PPC.Storage.csproj new file mode 100644 index 000000000..83f23e6b9 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Tango.PPC.Storage.csproj @@ -0,0 +1,132 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProjectGuid>{04FEBB02-F782-4B96-B47D-F6902AFA43BE}</ProjectGuid> + <OutputType>library</OutputType> + <RootNamespace>Tango.PPC.Storage</RootNamespace> + <AssemblyName>Tango.PPC.Storage</AssemblyName> + <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>..\..\..\Build\PPC\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>..\..\..\Build\PPC\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + <Reference Include="Microsoft.CSharp" /> + <Reference Include="System.Core" /> + <Reference Include="System.Xml.Linq" /> + <Reference Include="System.Data.DataSetExtensions" /> + <Reference Include="System.Net.Http" /> + <Reference Include="System.Xaml"> + <RequiredTargetFramework>4.0</RequiredTargetFramework> + </Reference> + <Reference Include="WindowsBase" /> + <Reference Include="PresentationCore" /> + <Reference Include="PresentationFramework" /> + </ItemGroup> + <ItemGroup> + <Compile Include="..\..\..\Versioning\GlobalVersionInfo.cs"> + <Link>GlobalVersionInfo.cs</Link> + </Compile> + <Compile Include="Models\StorageNavigationIntent.cs" /> + <Compile Include="Models\StorageNavigationRequest.cs" /> + <Compile Include="StorageModule.cs" /> + <Compile Include="Properties\AssemblyInfo.cs"> + <SubType>Code</SubType> + </Compile> + <Compile Include="Properties\Resources.Designer.cs"> + <AutoGen>True</AutoGen> + <DesignTime>True</DesignTime> + <DependentUpon>Resources.resx</DependentUpon> + </Compile> + <Compile Include="Properties\Settings.Designer.cs"> + <AutoGen>True</AutoGen> + <DependentUpon>Settings.settings</DependentUpon> + <DesignTimeSharedInput>True</DesignTimeSharedInput> + </Compile> + <Compile Include="TaskBarItems\StorageTaskBarItem.cs" /> + <Compile Include="TaskBarItems\StorageTaskBarItemView.xaml.cs"> + <DependentUpon>StorageTaskBarItemView.xaml</DependentUpon> + </Compile> + <Compile Include="ViewContracts\IMainView.cs" /> + <Compile Include="ViewModelLocator.cs" /> + <Compile Include="ViewModels\MainViewVM.cs" /> + <Compile Include="Views\MainView.xaml.cs"> + <DependentUpon>MainView.xaml</DependentUpon> + </Compile> + <EmbeddedResource Include="Properties\Resources.resx"> + <Generator>ResXFileCodeGenerator</Generator> + <LastGenOutput>Resources.Designer.cs</LastGenOutput> + </EmbeddedResource> + <None Include="Properties\Settings.settings"> + <Generator>SettingsSingleFileGenerator</Generator> + <LastGenOutput>Settings.Designer.cs</LastGenOutput> + </None> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\..\Tango.BL\Tango.BL.csproj"> + <Project>{f441feee-322a-4943-b566-110e12fd3b72}</Project> + <Name>Tango.BL</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Core\Tango.Core.csproj"> + <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> + <Name>Tango.Core</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Explorer\Tango.Explorer.csproj"> + <Project>{4399af76-db52-4cfb-8020-6f85bdb29fd5}</Project> + <Name>Tango.Explorer</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.SharedUI\Tango.SharedUI.csproj"> + <Project>{8491d07b-c1f6-4b62-a412-41b9fd2d6538}</Project> + <Name>Tango.SharedUI</Name> + </ProjectReference> + <ProjectReference Include="..\..\..\Tango.Touch\Tango.Touch.csproj"> + <Project>{fd86424c-6e84-491b-8df9-3d0f5c236a2a}</Project> + <Name>Tango.Touch</Name> + </ProjectReference> + <ProjectReference Include="..\..\Tango.PPC.Common\Tango.PPC.Common.csproj"> + <Project>{0be74eee-22cb-4dba-b896-793b9e1a3ac0}</Project> + <Name>Tango.PPC.Common</Name> + </ProjectReference> + </ItemGroup> + <ItemGroup> + <Page Include="App.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Page Include="TaskBarItems\StorageTaskBarItemView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\MainView.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + </ItemGroup> + <ItemGroup> + <Resource Include="Images\storage-module.png" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> +</Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/TaskBarItems/StorageTaskBarItem.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/TaskBarItems/StorageTaskBarItem.cs new file mode 100644 index 000000000..a77d47713 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/TaskBarItems/StorageTaskBarItem.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.DI; +using Tango.PPC.Common.Notifications; +using Tango.PPC.Common.Storage; + +namespace Tango.PPC.Storage.TaskBarItems +{ + public class StorageTaskBarItem : TaskBarItem + { + public override Type ViewType => typeof(StorageTaskBarItemView); + + [TangoInject] + public IStorageProvider StorageProvider { get; set; } + + public StorageTaskBarItem() + { + TangoIOC.Default.Inject(this); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/TaskBarItems/StorageTaskBarItemView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/TaskBarItems/StorageTaskBarItemView.xaml new file mode 100644 index 000000000..dc63949a0 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/TaskBarItems/StorageTaskBarItemView.xaml @@ -0,0 +1,24 @@ +<UserControl x:Class="Tango.PPC.Storage.TaskBarItems.StorageTaskBarItemView" + 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:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:local="clr-namespace:Tango.PPC.Storage.TaskBarItems" + mc:Ignorable="d" + d:DesignHeight="20" d:DesignWidth="20" d:DataContext="{d:DesignInstance Type=local:StorageTaskBarItem, IsDesignTimeCreatable=False}"> + <Grid> + <touch:TouchIcon Width="20" Height="20" Icon="HddSolid"> + <touch:TouchIcon.Style> + <Style TargetType="touch:TouchIcon" BasedOn="{StaticResource {x:Type touch:TouchIcon}}"> + <Setter Property="Foreground" Value="{StaticResource TangoGrayBrush}"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding StorageProvider.IsConnected}" Value="True"> + <Setter Property="Foreground" Value="{StaticResource TangoSuccessBrush}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchIcon.Style> + </touch:TouchIcon> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/TaskBarItems/StorageTaskBarItemView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/TaskBarItems/StorageTaskBarItemView.xaml.cs new file mode 100644 index 000000000..f66cf4465 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/TaskBarItems/StorageTaskBarItemView.xaml.cs @@ -0,0 +1,28 @@ +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; + +namespace Tango.PPC.Storage.TaskBarItems +{ + /// <summary> + /// Interaction logic for StorageTaskBarItem.xaml + /// </summary> + public partial class StorageTaskBarItemView : UserControl + { + public StorageTaskBarItemView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewContracts/IMainView.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewContracts/IMainView.cs new file mode 100644 index 000000000..8c08f5a28 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewContracts/IMainView.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Common; +using Tango.SharedUI; + +namespace Tango.PPC.Storage.ViewContracts +{ + public interface IMainView : IPPCView + { + void NavigateBack(); + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModelLocator.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModelLocator.cs new file mode 100644 index 000000000..8634b8179 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModelLocator.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.DI; +using Tango.PPC.Storage.ViewModels; + +namespace Tango.PPC.Storage +{ + public static class ViewModelLocator + { + /// <summary> + /// Initializes a new instance of the ViewModelLocator class. + /// </summary> + static ViewModelLocator() + { + TangoIOC.Default.Register<MainViewVM>(); + } + + /// <summary> + /// Gets the main view VM. + /// </summary> + public static MainViewVM MainViewVM + { + get + { + return TangoIOC.Default.GetInstance<MainViewVM>(); + } + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs new file mode 100644 index 000000000..05316d1f6 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs @@ -0,0 +1,164 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.Explorer; +using Tango.PPC.Common; +using Tango.PPC.Common.Navigation; +using Tango.PPC.Storage.Models; +using Tango.PPC.Storage.TaskBarItems; +using Tango.PPC.Storage.ViewContracts; + +namespace Tango.PPC.Storage.ViewModels +{ + /// <summary> + /// Represents the main view VM and entry point for <see cref="Storage.StorageModule"/>. + /// </summary> + /// <seealso cref="Tango.PPC.Common.PPCViewModel" /> + public class MainViewVM : PPCViewModel<IMainView>, INavigationResultProvider<ExplorerFileItem, StorageNavigationRequest> + { + private bool _allow_exit; + private ExplorerFileItem _selectedItem; + + private String _currentPath; + public String CurrentPath + { + get { return _currentPath; } + set { _currentPath = value; RaisePropertyChangedAuto(); } + } + + private StorageNavigationRequest _request; + public StorageNavigationRequest Request + { + get { return _request; } + set { _request = value; RaisePropertyChangedAuto(); } + } + + public RelayCommand<ExplorerFileItem> FileSelectedCommand { get; set; } + + public RelayCommand SaveCommand { get; set; } + + public MainViewVM() + { + FileSelectedCommand = new RelayCommand<ExplorerFileItem>(OnFileSelected); + SaveCommand = new RelayCommand(OnSaveCommand); + Request = new StorageNavigationRequest(); + } + + public override void OnApplicationStarted() + { + + } + + public override void OnApplicationReady() + { + base.OnApplicationReady(); + + NotificationProvider.PushTaskBarItem<StorageTaskBarItem>(); + StorageProvider.StorageConnected += StorageProvider_StorageConnected; + StorageProvider.StorageDisconnected += StorageProvider_StorageDisconnected; + } + + public override async void OnNavigatedTo() + { + base.OnNavigatedTo(); + + _allow_exit = false; + _selectedItem = null; + + if (StorageProvider.IsConnected && StorageProvider.Drive != null) + { + CurrentPath = null; + CurrentPath = StorageProvider.Drive.RootDirectory.FullName; + } + else + { + _allow_exit = true; + await NotificationProvider.ShowError("No storage device connected."); + await NavigationManager.NavigateBack(); + } + } + + public override void OnNavigatedFrom() + { + base.OnNavigatedFrom(); + Request = new StorageNavigationRequest(); + } + + /// <summary> + /// Handles the storage connected event. + /// </summary> + /// <param name="sender">The sender.</param> + /// <param name="e">The drive info.</param> + private void StorageProvider_StorageConnected(object sender, System.IO.DriveInfo e) + { + InvokeUI(async () => + { + if (await NotificationProvider.ShowQuestion("Disk Inserted. Do you want to browse?")) + { + await NavigationManager.NavigateTo(Common.Navigation.NavigationView.StorageView); + } + }); + } + + /// <summary> + /// Handles the storage disconnected event. + /// </summary> + /// <param name="sender">The sender.</param> + /// <param name="e">The drive info.</param> + private void StorageProvider_StorageDisconnected(object sender, System.IO.DriveInfo e) + { + InvokeUI(async () => + { + if (IsVisible) + { + await NotificationProvider.ShowError("Storage device disconnected."); + await NavigationManager.NavigateBack(); + CurrentPath = null; + } + }); + } + + public override Task<bool> OnNavigateBackRequest() + { + if (_allow_exit || CurrentPath == StorageProvider.Drive.RootDirectory.FullName) + { + Request = null; + return Task.FromResult(true); + } + else + { + View.NavigateBack(); + return Task.FromResult(false); + } + } + + private async void OnFileSelected(ExplorerFileItem fileItem) + { + _allow_exit = true; + await NavigationManager.NavigateBack(); + StorageProvider.SubmitFileSelection(fileItem); + } + + public ExplorerFileItem GetNavigationResult() + { + return _selectedItem; + } + + public void OnNavigationObjectReceived(StorageNavigationRequest request) + { + Request = request; + } + + private void OnSaveCommand() + { + _selectedItem = new ExplorerFileItem() + { + Path = CurrentPath + "\\" + Request.DefaultFileName, + }; + NavigationManager.NavigateBack(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Views/MainView.xaml new file mode 100644 index 000000000..d7817fe6f --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Views/MainView.xaml @@ -0,0 +1,42 @@ +<UserControl x:Class="Tango.PPC.Storage.Views.MainView" + 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:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" + xmlns:explorer="clr-namespace:Tango.Explorer;assembly=Tango.Explorer" + xmlns:vm="clr-namespace:Tango.PPC.Storage.ViewModels" + xmlns:models="clr-namespace:Tango.PPC.Storage.Models" + xmlns:global="clr-namespace:Tango.PPC.Storage" + xmlns:local="clr-namespace:Tango.PPC.Storage.Views" + mc:Ignorable="d" + d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}" Background="{StaticResource TangoPrimaryBackgroundBrush}"> + <Grid> + <Grid Margin="10"> + <DockPanel> + + <Grid DockPanel.Dock="Top" Visibility="{Binding Request.Intent,Converter={StaticResource EnumToVisibilityConverter},ConverterParameter=SaveFile,TargetNullValue=Visibility.Collapsed,FallbackValue=Visibility.Collapsed}"> + <Border BorderThickness="0 0 0 1" BorderBrush="{StaticResource TangoDividerBrush}" Padding="20"> + <DockPanel> + <touch:TouchButton Command="{Binding SaveCommand}" Margin="20 0 0 0" Height="50" Width="200" Style="{StaticResource TangoHollowButton}" CornerRadius="0" DockPanel.Dock="Right">SAVE</touch:TouchButton> + <touch:TouchTextBox VerticalAlignment="Bottom" Text="{Binding Request.DefaultFileName}" /> + </DockPanel> + </Border> + </Grid> + + <explorer:ExplorerControl x:Name="explorer" CurrentPath="{Binding CurrentPath,Mode=TwoWay}" FileSelectedCommand="{Binding FileSelectedCommand}" Filter="{Binding Request.Filter}"> + <explorer:ExplorerControl.Style> + <Style TargetType="explorer:ExplorerControl" BasedOn="{StaticResource {x:Type explorer:ExplorerControl}}"> + <Setter Property="EnableFileSelection" Value="True"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding Request.Intent}" Value="SaveFile"> + <Setter Property="EnableFileSelection" Value="False"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </explorer:ExplorerControl.Style> + </explorer:ExplorerControl> + </DockPanel> + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Views/MainView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Views/MainView.xaml.cs new file mode 100644 index 000000000..f77eaa401 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/Views/MainView.xaml.cs @@ -0,0 +1,37 @@ +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.Core.DI; +using Tango.PPC.Storage.ViewContracts; + +namespace Tango.PPC.Storage.Views +{ + /// <summary> + /// Interaction logic for MainView.xaml + /// </summary> + public partial class MainView : UserControl, IMainView + { + public MainView() + { + InitializeComponent(); + + TangoIOC.Default.Register<IMainView>(this); + } + + public void NavigateBack() + { + explorer.NavigateBack(); + } + } +} |
