diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2019-05-27 16:46:30 +0300 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2019-05-27 16:46:30 +0300 |
| commit | 8fefb650921f35b2b72ae5d49d7adefe30bd8a6c (patch) | |
| tree | 0a0525e9865473f8b571390f9e7531df9acb9af4 /Software/Visual_Studio | |
| parent | ea1a4d93784b5110a59a3acbece767fd1e9078d8 (diff) | |
| parent | 56c56d443d7ebd5a9fbab098e8500390bfc0c7cc (diff) | |
| download | Tango-8fefb650921f35b2b72ae5d49d7adefe30bd8a6c.tar.gz Tango-8fefb650921f35b2b72ae5d49d7adefe30bd8a6c.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio')
37 files changed, 2005 insertions, 706 deletions
diff --git a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt Binary files differindex a603ff06b..6d87e9201 100644 --- a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt +++ b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer-cache/cacheIndex.txt diff --git a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip index 2b29263f5..ef999f972 100644 --- a/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip +++ b/Software/Visual_Studio/Advanced Installer Projects/PPC Installer.aip @@ -18,10 +18,10 @@ <ROW Property="ARPNOREPAIR" Value="1" MultiBuildValue="DefaultBuild:1"/> <ROW Property="ARPSYSTEMCOMPONENT" Value="1"/> <ROW Property="Manufacturer" Value="Twine"/> - <ROW Property="ProductCode" Value="1033:{62479073-8D6E-4F24-91DA-F55F44FEE521} " Type="16"/> + <ROW Property="ProductCode" Value="1033:{ABFCB7CD-5FD0-4A63-A1B5-FDE09DE3EE2E} " Type="16"/> <ROW Property="ProductLanguage" Value="1033"/> <ROW Property="ProductName" Value="Tango"/> - <ROW Property="ProductVersion" Value="1.0.30.0" Type="32"/> + <ROW Property="ProductVersion" Value="1.0.31.0" Type="32"/> <ROW Property="SecureCustomProperties" Value="OLDPRODUCTS;AI_NEWERPRODUCTFOUND;AI_SETUPEXEPATH;SETUPEXEDIR"/> <ROW Property="UpgradeCode" Value="{F8EAB8B4-FD57-45B7-8307-D52DF760273D}"/> <ROW Property="WindowsType9X" MultiBuildValue="DefaultBuild:Windows 9x/ME" ValueLocId="-"/> @@ -423,7 +423,7 @@ <ROW Action="AI_DetectSoftware" Sequence="101"/> </COMPONENT> <COMPONENT cid="caphyon.advinst.msicomp.BuildComponent"> - <ROW BuildKey="DefaultBuild" BuildName="DefaultBuild" BuildOrder="1" BuildType="0" PackageFolder="..\Build\Installers\PPC" PackageFileName="PPC Installer v1.0.3" Languages="en" InstallationType="4" CabsLocation="1" PackageType="1" FilesInsideExe="true" ExtractionFolder="[AppDataFolder][|Manufacturer]\[|ProductName] [|ProductVersion]\install" ExtUI="true" UseLargeSchema="true" ExeName="PPC Installer_v1.0.30"/> + <ROW BuildKey="DefaultBuild" BuildName="DefaultBuild" BuildOrder="1" BuildType="0" PackageFolder="..\Build\Installers\PPC" PackageFileName="PPC Installer v1.0.3" Languages="en" InstallationType="4" CabsLocation="1" PackageType="1" FilesInsideExe="true" ExtractionFolder="[AppDataFolder][|Manufacturer]\[|ProductName] [|ProductVersion]\install" ExtUI="true" UseLargeSchema="true" ExeName="PPC Installer_v1.0.31"/> </COMPONENT> <COMPONENT cid="caphyon.advinst.msicomp.DictionaryComponent"> <ROW Path="<AI_DICTS>ui.ail"/> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Converters/JobsCategoryToOpacityConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Converters/JobsCategoryToOpacityConverter.cs new file mode 100644 index 000000000..0eaad280a --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Converters/JobsCategoryToOpacityConverter.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using static Tango.PPC.Jobs.ViewModels.JobsViewVM; + +namespace Tango.PPC.Jobs.Converters +{ + public class JobsCategoryToOpacityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + JobsCategory selected = (JobsCategory)Enum.Parse(typeof(JobsCategory), parameter.ToString()); + JobsCategory category = (JobsCategory)value; + + return category.Equals(selected) ? 1 : 0; + } + + 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/Tango.PPC.Jobs.csproj b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj index bbfef32fd..55983118d 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 @@ -170,6 +170,7 @@ </Compile> <Compile Include="Converters\ColorSpaceToImageConverter.cs" /> <Compile Include="Converters\ColorSpaceToVisibilityConverter.cs" /> + <Compile Include="Converters\JobsCategoryToOpacityConverter.cs" /> <Compile Include="Converters\JobProgressToPositionConverter.cs" /> <Compile Include="Converters\JobsCategoryToVisibilityConverter.cs" /> <Compile Include="Converters\JobToEmbroideryImageConverter.cs" /> @@ -231,6 +232,7 @@ <DependentUpon>Settings.settings</DependentUpon> <DesignTimeSharedInput>True</DesignTimeSharedInput> </Compile> + <Compile Include="ViewContracts\IJobsView.cs" /> <Compile Include="ViewContracts\IJobView.cs" /> <Compile Include="ViewModelLocator.cs" /> <Compile Include="ViewModels\JobProgressViewVM.cs" /> @@ -449,7 +451,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> + <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> </VisualStudio> </ProjectExtensions> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewContracts/IJobsView.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewContracts/IJobsView.cs new file mode 100644 index 000000000..7a8907c36 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewContracts/IJobsView.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.PPC.Common; + +namespace Tango.PPC.Jobs.ViewContracts +{ + public interface IJobsView : IPPCView + { + void ScrollToTop(); + } +} 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 c89db820d..9862a4afb 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 @@ -33,6 +33,8 @@ using System.Windows.Media; using Tango.PMR.TCC; using Tango.Pulse; using System.Windows.Media.Imaging; +using Tango.Touch.Components; +using Tango.PPC.Jobs.ViewContracts; namespace Tango.PPC.Jobs.ViewModels { @@ -40,7 +42,7 @@ namespace Tango.PPC.Jobs.ViewModels /// Represents the jobs list view model. /// </summary> /// <seealso cref="Tango.PPC.Common.PPCViewModel" /> - public class JobsViewVM : PPCViewModel + public class JobsViewVM : PPCViewModel<IJobsView> { private ObservablesContext _db; //Holds the db context for the job list. @@ -132,7 +134,6 @@ namespace Tango.PPC.Jobs.ViewModels _selectedCategoryIndex = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(SelectedCategory)); - Filter = null; } } @@ -162,6 +163,14 @@ namespace Tango.PPC.Jobs.ViewModels set { _filter = value; RaisePropertyChangedAuto(); OnFilterChanged(); } } + private ICollectionFilter _collectionFilter; + public ICollectionFilter CollectionFilter + { + get { return _collectionFilter; } + set { _collectionFilter = value; RaisePropertyChangedAuto(); } + } + + #endregion #region Commands @@ -231,6 +240,28 @@ namespace Tango.PPC.Jobs.ViewModels RegisterForMessage<JobRemovedMessage>(HandleJobRemovedMessage); RegisterForMessage<JobSavedMessage>(HandleJobSavedMessage); RegisterForMessage<NavigatedToJobsModuleMessage>((x) => Filter = null); + + CollectionFilter = new DefaultCollectionFilter(); + CollectionFilter.RegisterFilter(item => + { + var job = item as Job; + + if (job != null) + { + if (String.IsNullOrEmpty(Filter)) + { + return true; + } + else + { + return (job.Name.ToLower().StartsWith(Filter) || (job.Customer != null && job.Customer.Name.ToLower().StartsWith(Filter))); + } + } + else + { + return true; + } + }); } #endregion @@ -326,15 +357,7 @@ namespace Tango.PPC.Jobs.ViewModels DraftJobsCollectionView.Filter = new Predicate<object>(x => { var job = x as Job; - - if (String.IsNullOrWhiteSpace(Filter)) - { - return job.JobStatus == JobStatuses.Draft; - } - else - { - return job.JobStatus == JobStatuses.Draft && (job.Name.ToLower().StartsWith(Filter) || (job.Customer != null && job.Customer.Name.ToLower().StartsWith(Filter))); - } + return job.JobStatus == JobStatuses.Draft; }); @@ -343,15 +366,7 @@ namespace Tango.PPC.Jobs.ViewModels HistoryJobsCollectionView.Filter = new Predicate<object>(x => { var job = x as Job; - - if (String.IsNullOrWhiteSpace(Filter)) - { - return job.JobStatus != JobStatuses.Draft; - } - else - { - return job.JobStatus != JobStatuses.Draft && (job.Name.ToLower().StartsWith(Filter) || (job.Customer != null && job.Customer.Name.ToLower().StartsWith(Filter))); - } + return job.JobStatus != JobStatuses.Draft; }); IsLoadingJobs = false; @@ -611,14 +626,8 @@ namespace Tango.PPC.Jobs.ViewModels { if (DraftJobsCollectionView != null && HistoryJobsCollectionView != null) { - if (SelectedCategory == JobsCategory.Draft) - { - DraftJobsCollectionView.Refresh(); - } - else if (SelectedCategory == JobsCategory.History) - { - HistoryJobsCollectionView.Refresh(); - } + CollectionFilter.RaiseFilterChanged(); + View.ScrollToTop(); } } 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 9448665d0..136644f5c 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 @@ -56,7 +56,7 @@ </ItemsControl> <Canvas VerticalAlignment="Bottom" Visibility="{Binding IsLiquidVolumesOutOfRange,Converter={StaticResource BooleanToVisibilityConverter}}"> - <controls:FastTextBlock Canvas.Top="2" Foreground="{StaticResource TangoErrorBrush}" FontSize="{StaticResource TangoSmallFontSize}" Text="Liquid volumes are out of range."></controls:FastTextBlock> + <TextBlock Canvas.Top="2" Foreground="{StaticResource TangoErrorBrush}" FontSize="{StaticResource TangoSmallFontSize}" Text="Liquid volumes are out of range."></TextBlock> </Canvas> </Grid> </DataTemplate> @@ -122,7 +122,7 @@ </StackPanel> <DockPanel LastChildFill="False" Margin="0 20 0 0"> - <controls:FastTextBlock VerticalAlignment="Bottom" DockPanel.Dock="Left">Color code:</controls:FastTextBlock> + <TextBlock VerticalAlignment="Bottom" DockPanel.Dock="Left">Color code:</TextBlock> <ContentControl Focusable="False" Margin="20 0 0 0" DockPanel.Dock="Right" HorizontalAlignment="Right" Width="300" Content="{Binding}"> <ContentControl.Style> <Style TargetType="ContentControl"> @@ -179,129 +179,169 @@ </DataTemplate> <DataTemplate x:Key="Segment_Template" DataType="{x:Type entities:Segment}"> - <Border Margin="0 0 0 15" RenderOptions.EdgeMode="Unspecified" CornerRadius="8" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="1" BorderBrush="{StaticResource TangoGrayBrush}"> - <Border.CacheMode> - <BitmapCache RenderAtScale="1" SnapsToDevicePixels="True" /> - </Border.CacheMode> - <!--<Border.Effect> + <touch:TouchVirtualizedContentControl Margin="0 0 0 15"> + <Border RenderOptions.EdgeMode="Unspecified" CornerRadius="8" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="1" BorderBrush="{StaticResource TangoGrayBrush}"> + <Border.CacheMode> + <BitmapCache RenderAtScale="1" SnapsToDevicePixels="True" /> + </Border.CacheMode> + <!--<Border.Effect> <DropShadowEffect Opacity="0.5" Color="{StaticResource TangoDropShadowColor}" BlurRadius="10" ShadowDepth="15" /> </Border.Effect>--> - <Grid> - <Grid.RowDefinitions> - <RowDefinition Height="Auto" /> - <RowDefinition Height="Auto" /> - </Grid.RowDefinitions> - <Grid Background="Transparent" dragAndDrop:DragAndDropService.DropCommand="{Binding ElementName=view,Path=DataContext.SegmentDroppedCommand}" dragAndDrop:DragAndDropService.Draggable="True" dragAndDrop:DragAndDropService.Droppable="True" dragAndDrop:DragAndDropService.DraggingSurface="{Binding ElementName=DraggingSurface}"> - <Grid.Style> - <Style TargetType="Grid"> - <Setter Property="Opacity" Value="1"></Setter> - <Style.Triggers> - <Trigger Property="dragAndDrop:DragAndDropService.IsDraggableOver" Value="True"> - <Setter Property="Opacity" Value="0.5"></Setter> - </Trigger> - </Style.Triggers> - </Style> - </Grid.Style> - <DockPanel> - <DockPanel.Style> - <Style TargetType="DockPanel"> - <Setter Property="Height" Value="163"></Setter> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + <Grid Background="Transparent" dragAndDrop:DragAndDropService.DropCommand="{Binding ElementName=view,Path=DataContext.SegmentDroppedCommand}" dragAndDrop:DragAndDropService.Draggable="True" dragAndDrop:DragAndDropService.Droppable="True" dragAndDrop:DragAndDropService.DraggingSurface="{Binding ElementName=DraggingSurface}"> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="Opacity" Value="1"></Setter> <Style.Triggers> - <DataTrigger Binding="{Binding ElementName=toggle_small_list,Path=IsChecked,IsAsync=True}" Value="True"> - <Setter Property="Height" Value="74"></Setter> - </DataTrigger> + <Trigger Property="dragAndDrop:DragAndDropService.IsDraggableOver" Value="True"> + <Setter Property="Opacity" Value="0.5"></Setter> + </Trigger> </Style.Triggers> </Style> - </DockPanel.Style> - <Border DockPanel.Dock="Left" Background="{Binding SegmentBrush}" BorderThickness="0 0 1 0" BorderBrush="{StaticResource TangoLightBorderBrush}"> - <Border.Style> - <Style TargetType="Border"> - <Setter Property="CornerRadius" Value="8 0 0 8"></Setter> - <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight,IsAsync=True}"></Setter> + </Grid.Style> + <DockPanel> + <DockPanel.Style> + <Style TargetType="DockPanel"> + <Setter Property="Height" Value="163"></Setter> <Style.Triggers> <DataTrigger Binding="{Binding ElementName=toggle_small_list,Path=IsChecked,IsAsync=True}" Value="True"> - <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight,Converter={StaticResource MathOperatorConverter},ConverterParameter='*2',IsAsync=True}"></Setter> + <Setter Property="Height" Value="74"></Setter> </DataTrigger> - <MultiDataTrigger> - <MultiDataTrigger.Conditions> - <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="True"></Condition> - <Condition Binding="{Binding ElementName=toggle_large_list,Path=IsChecked,IsAsync=True}" Value="True"></Condition> - </MultiDataTrigger.Conditions> - <Setter Property="CornerRadius" Value="8 0 0 0"></Setter> - </MultiDataTrigger> </Style.Triggers> </Style> - </Border.Style> - </Border> + </DockPanel.Style> + <Border DockPanel.Dock="Left" Background="{Binding SegmentBrush}" BorderThickness="0 0 1 0" BorderBrush="{StaticResource TangoLightBorderBrush}"> + <Border.Style> + <Style TargetType="Border"> + <Setter Property="CornerRadius" Value="8 0 0 8"></Setter> + <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight,IsAsync=True}"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding ElementName=toggle_small_list,Path=IsChecked,IsAsync=True}" Value="True"> + <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight,Converter={StaticResource MathOperatorConverter},ConverterParameter='*2',IsAsync=True}"></Setter> + </DataTrigger> + <MultiDataTrigger> + <MultiDataTrigger.Conditions> + <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="True"></Condition> + <Condition Binding="{Binding ElementName=toggle_large_list,Path=IsChecked,IsAsync=True}" Value="True"></Condition> + </MultiDataTrigger.Conditions> + <Setter Property="CornerRadius" Value="8 0 0 0"></Setter> + </MultiDataTrigger> + </Style.Triggers> + </Style> + </Border.Style> + </Border> - <Grid> - <DockPanel Margin="30 0" VerticalAlignment="Center"> - <StackPanel DockPanel.Dock="Top" Orientation="Horizontal"> - <Canvas Visibility="{Binding HasOutOfGamutBrushStop,Converter={StaticResource BooleanToVisibilityConverter},IsAsync=True}"> - <Image Canvas.Left="-25" Canvas.Top="1" Source="{StaticResource Image_Out_Of_Gamut}" Width="19" Height="19" /> - </Canvas> - <TextBlock FontSize="{StaticResource TangoTitleFontSize}"> + <Grid> + <DockPanel Margin="30 0" VerticalAlignment="Center"> + <StackPanel DockPanel.Dock="Top" Orientation="Horizontal"> + <Canvas Visibility="{Binding HasOutOfGamutBrushStop,Converter={StaticResource BooleanToVisibilityConverter},IsAsync=True}"> + <Image Canvas.Left="-25" Canvas.Top="1" Source="{StaticResource Image_Out_Of_Gamut}" Width="19" Height="19" /> + </Canvas> + <TextBlock FontSize="{StaticResource TangoTitleFontSize}"> <Run>Segment #</Run> <Run Text="{Binding SegmentIndex,Mode=OneWay,IsAsync=True}"></Run> - </TextBlock> - </StackPanel> + </TextBlock> + </StackPanel> - <StackPanel Margin="0 30 0 0" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="300" Visibility="{Binding ElementName=toggle_large_list,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter},IsAsync=True}"> - <DockPanel LastChildFill="False"> - <DockPanel.Style> - <Style TargetType="DockPanel"> - <Setter Property="Visibility" Value="Visible"></Setter> + <StackPanel Margin="0 30 0 0" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="300" Visibility="{Binding ElementName=toggle_large_list,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter},IsAsync=True}"> + <DockPanel LastChildFill="False"> + <DockPanel.Style> + <Style TargetType="DockPanel"> + <Setter Property="Visibility" Value="Visible"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="True"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </DockPanel.Style> + <TextBlock VerticalAlignment="Bottom" DockPanel.Dock="Left" Text="Color code:"></TextBlock> + + <Grid DockPanel.Dock="Right" DataContext="{Binding BrushStops[0],IsAsync=True}"> + <StackPanel> + <ContentControl Focusable="False" FocusVisualStyle="{x:Null}" d:DataContext="{d:DesignInstance Type=entities:BrushStop, IsDesignTimeCreatable=False}" Content="{Binding}" Width="180"> + <ContentControl.Style> + <Style TargetType="ContentControl"> + <Setter Property="ContentTemplate"> + <Setter.Value> + <DataTemplate> + + </DataTemplate> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="RGB"> + <Setter Property="ContentTemplate" Value="{StaticResource RGB_Template}" /> + </DataTrigger> + <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="CMYK"> + <Setter Property="ContentTemplate" Value="{StaticResource CMYK_Template}" /> + </DataTrigger> + <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="LAB"> + <Setter Property="ContentTemplate" Value="{StaticResource LAB_Template}" /> + </DataTrigger> + <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="Twine"> + <Setter Property="ContentTemplate" Value="{StaticResource TWINE_Template}" /> + </DataTrigger> + <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="Volume"> + <Setter Property="ContentTemplate" Value="{StaticResource Volume_Template}" /> + </DataTrigger> + </Style.Triggers> + </Style> + </ContentControl.Style> + </ContentControl> + </StackPanel> + </Grid> + </DockPanel> + <Canvas> + <Canvas.Style> + <Style TargetType="Canvas"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <MultiDataTrigger> + <MultiDataTrigger.Conditions> + <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="False" /> + <Condition Binding="{Binding BrushStops[0].IsOutOfGamut,IsAsync=True}" Value="True" /> + </MultiDataTrigger.Conditions> + <Setter Property="Visibility" Value="Visible"></Setter> + </MultiDataTrigger> + </Style.Triggers> + </Style> + </Canvas.Style> + <TextBlock Canvas.Top="2" Foreground="{StaticResource TangoErrorBrush}" FontSize="{StaticResource TangoSmallFontSize}" Text="Color is out of gamut. Modify color or select an alternative."></TextBlock> + </Canvas> + <DockPanel LastChildFill="False" Margin="0 20 0 0"> + <TextBlock VerticalAlignment="Bottom" DockPanel.Dock="Left" Text="Length (m):"></TextBlock> + <touch:TouchNumericTextBox Width="180" DockPanel.Dock="Right" Value="{Binding Length}" StringFormat="0.0" AutoCalculateJogStep="False" HasDecimalPoint="True" Minimum="1" Maximum="100000" KeyboardContainer="{Binding ElementName=Container}" /> + </DockPanel> + </StackPanel> + </DockPanel> + + <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0 10 10 0"> + <TextBlock Visibility="{Binding ElementName=toggle_small_list,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter},IsAsync=True}" HorizontalAlignment="Right" VerticalAlignment="Center" Text="{Binding Length,StringFormat={}{0:N1} m}"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Margin" Value="0 16 20 0"></Setter> <Style.Triggers> - <DataTrigger Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="True"> - <Setter Property="Visibility" Value="Collapsed"></Setter> + <DataTrigger Binding="{Binding ElementName=toggleEdit,Path=IsChecked}" Value="True"> + <Setter Property="Margin" Value="0 5 20 0"></Setter> </DataTrigger> </Style.Triggers> </Style> - </DockPanel.Style> - <controls:FastTextBlock VerticalAlignment="Bottom" DockPanel.Dock="Left" Text="Color code:"></controls:FastTextBlock> - - <Grid DockPanel.Dock="Right" DataContext="{Binding BrushStops[0],IsAsync=True}"> - <StackPanel> - <ContentControl Focusable="False" FocusVisualStyle="{x:Null}" d:DataContext="{d:DesignInstance Type=entities:BrushStop, IsDesignTimeCreatable=False}" Content="{Binding}" Width="180"> - <ContentControl.Style> - <Style TargetType="ContentControl"> - <Setter Property="ContentTemplate"> - <Setter.Value> - <DataTemplate> + </TextBlock.Style> + </TextBlock> - </DataTemplate> - </Setter.Value> - </Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="RGB"> - <Setter Property="ContentTemplate" Value="{StaticResource RGB_Template}" /> - </DataTrigger> - <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="CMYK"> - <Setter Property="ContentTemplate" Value="{StaticResource CMYK_Template}" /> - </DataTrigger> - <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="LAB"> - <Setter Property="ContentTemplate" Value="{StaticResource LAB_Template}" /> - </DataTrigger> - <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="Twine"> - <Setter Property="ContentTemplate" Value="{StaticResource TWINE_Template}" /> - </DataTrigger> - <DataTrigger Binding="{Binding ElementName=view,Path=DataContext.Job.ColorSpace.Name,IsAsync=True}" Value="Volume"> - <Setter Property="ContentTemplate" Value="{StaticResource Volume_Template}" /> - </DataTrigger> - </Style.Triggers> - </Style> - </ContentControl.Style> - </ContentControl> - </StackPanel> - </Grid> - </DockPanel> - <Canvas> - <Canvas.Style> - <Style TargetType="Canvas"> + <touch:TouchImageButton Command="{Binding ElementName=view,Path=DataContext.ReplaceBrushStopCommand}" CommandParameter="{Binding BrushStops[0]}" Width="50" Height="50" Padding="10" Image="{StaticResource Image_Replace_Color}" CornerRadius="30"> + <touch:TouchImageButton.Style> + <Style TargetType="{x:Type touch:TouchImageButton}" BasedOn="{StaticResource {x:Type touch:TouchImageButton}}"> <Setter Property="Visibility" Value="Collapsed"></Setter> <Style.Triggers> <MultiDataTrigger> <MultiDataTrigger.Conditions> + <Condition Binding="{Binding ElementName=toggle_large_list,Path=IsChecked,IsAsync=True}" Value="True" /> <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="False" /> <Condition Binding="{Binding BrushStops[0].IsOutOfGamut,IsAsync=True}" Value="True" /> </MultiDataTrigger.Conditions> @@ -309,97 +349,59 @@ </MultiDataTrigger> </Style.Triggers> </Style> - </Canvas.Style> - <controls:FastTextBlock Canvas.Top="2" Foreground="{StaticResource TangoErrorBrush}" FontSize="{StaticResource TangoSmallFontSize}" Text="Color is out of gamut. Modify color or select an alternative."></controls:FastTextBlock> - </Canvas> - <DockPanel LastChildFill="False" Margin="0 20 0 0"> - <controls:FastTextBlock VerticalAlignment="Bottom" DockPanel.Dock="Left" Text="Length (m):"></controls:FastTextBlock> - <touch:TouchNumericTextBox Width="180" DockPanel.Dock="Right" Value="{Binding Length}" StringFormat="0.0" AutoCalculateJogStep="False" HasDecimalPoint="True" Minimum="1" Maximum="100000" KeyboardContainer="{Binding ElementName=Container}" /> - </DockPanel> - </StackPanel> - </DockPanel> - - <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0 10 10 0"> - <controls:FastTextBlock Visibility="{Binding ElementName=toggle_small_list,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter},IsAsync=True}" HorizontalAlignment="Right" VerticalAlignment="Center" Text="{Binding Length,StringFormat={}{0:N1} m}"> - <controls:FastTextBlock.Style> - <Style TargetType="controls:FastTextBlock"> - <Setter Property="Margin" Value="0 16 20 0"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding ElementName=toggleEdit,Path=IsChecked}" Value="True"> - <Setter Property="Margin" Value="0 5 20 0"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </controls:FastTextBlock.Style> - </controls:FastTextBlock> + </touch:TouchImageButton.Style> + </touch:TouchImageButton> - <touch:TouchImageButton Command="{Binding ElementName=view,Path=DataContext.ReplaceBrushStopCommand}" CommandParameter="{Binding BrushStops[0]}" Width="50" Height="50" Padding="10" Image="{StaticResource Image_Replace_Color}" CornerRadius="30"> - <touch:TouchImageButton.Style> - <Style TargetType="{x:Type touch:TouchImageButton}" BasedOn="{StaticResource {x:Type touch:TouchImageButton}}"> - <Setter Property="Visibility" Value="Collapsed"></Setter> - <Style.Triggers> - <MultiDataTrigger> - <MultiDataTrigger.Conditions> - <Condition Binding="{Binding ElementName=toggle_large_list,Path=IsChecked,IsAsync=True}" Value="True" /> - <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="False" /> - <Condition Binding="{Binding BrushStops[0].IsOutOfGamut,IsAsync=True}" Value="True" /> - </MultiDataTrigger.Conditions> - <Setter Property="Visibility" Value="Visible"></Setter> - </MultiDataTrigger> - </Style.Triggers> - </Style> - </touch:TouchImageButton.Style> - </touch:TouchImageButton> + <StackPanel Visibility="{Binding ElementName=toggleEdit,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter},IsAsync=True}" Orientation="Horizontal"> - <StackPanel Visibility="{Binding ElementName=toggleEdit,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter},IsAsync=True}" Orientation="Horizontal"> + <touch:TouchIconButton Command="{Binding ElementName=view,Path=DataContext.RemoveSegmentCommand}" CommandParameter="{Binding}" EnableDropShadow="False" Icon="TrashAltRegular" Padding="12" Foreground="{StaticResource TangoPrimaryAccentBrush}" Width="50" Height="50" RippleBrush="{StaticResource TangoRippleDarkBrush}" CornerRadius="30" /> - <touch:TouchIconButton Command="{Binding ElementName=view,Path=DataContext.RemoveSegmentCommand}" CommandParameter="{Binding}" EnableDropShadow="False" Icon="TrashAltRegular" Padding="12" Foreground="{StaticResource TangoPrimaryAccentBrush}" Width="50" Height="50" RippleBrush="{StaticResource TangoRippleDarkBrush}" CornerRadius="30" /> - - <dragAndDrop:DragThumb Background="Transparent" IsHitTestVisible="True"> - <touch:TouchIconButton IsHitTestVisible="False" EnableDropShadow="False" Icon="BarsSolid" Padding="15" Foreground="{StaticResource TangoPrimaryAccentBrush}" Width="50" Height="50" RippleBrush="{StaticResource TangoRippleDarkBrush}" CornerRadius="30" /> - </dragAndDrop:DragThumb> + <dragAndDrop:DragThumb Background="Transparent" IsHitTestVisible="True"> + <touch:TouchIconButton IsHitTestVisible="False" EnableDropShadow="False" Icon="BarsSolid" Padding="15" Foreground="{StaticResource TangoPrimaryAccentBrush}" Width="50" Height="50" RippleBrush="{StaticResource TangoRippleDarkBrush}" CornerRadius="30" /> + </dragAndDrop:DragThumb> + </StackPanel> </StackPanel> - </StackPanel> - </Grid> - </DockPanel> - </Grid> + </Grid> + </DockPanel> + </Grid> - <Border Grid.Row="1" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0 1 0 0"> - <Border.Style> - <Style TargetType="Border"> - <Setter Property="Visibility" Value="Collapsed"></Setter> - <Style.Triggers> - <MultiDataTrigger> - <MultiDataTrigger.Conditions> - <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="True"></Condition> - <Condition Binding="{Binding ElementName=toggle_large_list,Path=IsChecked,IsAsync=True}" Value="True"></Condition> - </MultiDataTrigger.Conditions> + <Border Grid.Row="1" BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0 1 0 0"> + <Border.Style> + <Style TargetType="Border"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <MultiDataTrigger> + <MultiDataTrigger.Conditions> + <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter},IsAsync=True}" Value="True"></Condition> + <Condition Binding="{Binding ElementName=toggle_large_list,Path=IsChecked,IsAsync=True}" Value="True"></Condition> + </MultiDataTrigger.Conditions> - <Setter Property="Visibility" Value="Visible"></Setter> - </MultiDataTrigger> - </Style.Triggers> - </Style> - </Border.Style> + <Setter Property="Visibility" Value="Visible"></Setter> + </MultiDataTrigger> + </Style.Triggers> + </Style> + </Border.Style> - <StackPanel> - <ItemsControl ItemsSource="{Binding BrushStops}" ItemTemplate="{StaticResource BrushStop_Template}"> + <StackPanel> + <ItemsControl ItemsSource="{Binding BrushStops}" ItemTemplate="{StaticResource BrushStop_Template}"> - </ItemsControl> + </ItemsControl> - <touch:TouchButton Command="{Binding ElementName=view,Path=DataContext.AddBrushStopCommand}" CommandParameter="{Binding}" Background="Transparent" RippleBrush="{StaticResource TangoRippleDarkBrush}" FontWeight="Normal" Foreground="{StaticResource TangoPrimaryAccentBrush}" HorizontalAlignment="Left" EnableDropShadow="False" Margin="50 30 0 60"> - <StackPanel Orientation="Horizontal"> - <Grid Width="49" Height="49"> - <Rectangle Stroke="{StaticResource TangoPrimaryAccentBrush}" StrokeThickness="1" StrokeDashArray="5 5 5 5" RadiusX="5" RadiusY="5"></Rectangle> - <fa:ImageAwesome Icon="Plus" Width="16" Height="16" Foreground="{StaticResource TangoPrimaryAccentBrush}" /> - </Grid> + <touch:TouchButton Command="{Binding ElementName=view,Path=DataContext.AddBrushStopCommand}" CommandParameter="{Binding}" Background="Transparent" RippleBrush="{StaticResource TangoRippleDarkBrush}" FontWeight="Normal" Foreground="{StaticResource TangoPrimaryAccentBrush}" HorizontalAlignment="Left" EnableDropShadow="False" Margin="50 30 0 60"> + <StackPanel Orientation="Horizontal"> + <Grid Width="49" Height="49"> + <Rectangle Stroke="{StaticResource TangoPrimaryAccentBrush}" StrokeThickness="1" StrokeDashArray="5 5 5 5" RadiusX="5" RadiusY="5"></Rectangle> + <fa:ImageAwesome Icon="Plus" Width="16" Height="16" Foreground="{StaticResource TangoPrimaryAccentBrush}" /> + </Grid> - <controls:FastTextBlock VerticalAlignment="Center" Margin="20 0 0 0">ADD COLOR</controls:FastTextBlock> - </StackPanel> - </touch:TouchButton> - </StackPanel> - </Border> - </Grid> - </Border> + <TextBlock VerticalAlignment="Center" Margin="20 0 0 0">ADD COLOR</TextBlock> + </StackPanel> + </touch:TouchButton> + </StackPanel> + </Border> + </Grid> + </Border> + </touch:TouchVirtualizedContentControl> </DataTemplate> </UserControl.Resources> @@ -425,67 +427,69 @@ <touch:LightTouchScrollViewer x:Name="scrollViewer" Scrolling="scrollViewer_Scrolling"> <StackPanel Margin="10 60 10 0"> <StackPanel> - <touch:TouchExpander Padding="20 15" IsExpanded="{Binding IsJobDetailsExpanded}"> - <touch:TouchExpander.Header> - <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0 0 20 0"> - <Image Source="../Images/JobView/job-details.png" Width="39" /> - <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Job Details</TextBlock> + <touch:TouchVirtualizedContentControl> + <touch:TouchExpander Padding="20 15" IsExpanded="{Binding IsJobDetailsExpanded}"> + <touch:TouchExpander.Header> + <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0 0 20 0"> + <Image Source="../Images/JobView/job-details.png" Width="39" /> + <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Job Details</TextBlock> - <TextBlock FontWeight="Medium" Margin="50 0 0 0" VerticalAlignment="Center"> + <TextBlock FontWeight="Medium" Margin="50 0 0 0" VerticalAlignment="Center"> <Run Text="{Binding Job.Rml.Name}"></Run><Run>,</Run> <Run Text="{Binding Job.ColorSpace.Name}"></Run> - </TextBlock> - </StackPanel> - </touch:TouchExpander.Header> + </TextBlock> + </StackPanel> + </touch:TouchExpander.Header> - <StackPanel Margin="60 30 60 20" TextElement.FontWeight="Medium"> - <controls:TableGrid RowHeight="50"> + <StackPanel Margin="60 30 60 20" TextElement.FontWeight="Medium"> + <controls:TableGrid RowHeight="50"> - <TextBlock>Job name:</TextBlock> - <touch:TouchTextBox Text="{Binding Job.Name,UpdateSourceTrigger=PropertyChanged,ValidatesOnDataErrors=True,ValidatesOnNotifyDataErrors=True}" KeyboardMode="AlphaNumeric" FocusSelectionMode="SelectAll" KeyboardAction="Next" KeyboardContainer="{Binding ElementName=Container}" /> + <TextBlock>Job name:</TextBlock> + <touch:TouchTextBox Text="{Binding Job.Name,UpdateSourceTrigger=PropertyChanged,ValidatesOnDataErrors=True,ValidatesOnNotifyDataErrors=True}" KeyboardMode="AlphaNumeric" FocusSelectionMode="SelectAll" KeyboardAction="Next" KeyboardContainer="{Binding ElementName=Container}" /> - <TextBlock>Customer:</TextBlock> - <touch:TouchAutoComplete ForceItemSelection="False" Text="{Binding CustomersFilter}" ItemsSource="{Binding Customers}" SelectedItem="{Binding Job.Customer}" DisplayMemberPath="Name" AutoCompleteProvider="{Binding CustomersAutoCompleteProvider}" KeyboardMode="AlphaNumeric" KeyboardAction="Next" KeyboardContainer="{Binding ElementName=Container}" /> + <TextBlock>Customer:</TextBlock> + <touch:TouchAutoComplete ForceItemSelection="False" 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" /> + <TextBlock>Thread type:</TextBlock> + <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" keyboard:KeyboardView.Container="{Binding ElementName=Container}" keyboard:KeyboardView.Mode="AlphaNumeric"> + <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" keyboard:KeyboardView.Container="{Binding ElementName=Container}" keyboard:KeyboardView.Mode="AlphaNumeric"> - </TextBox> - </controls:TableGrid> + </TextBox> + </controls:TableGrid> - <Grid HorizontalAlignment="Center" Margin="0 20 0 0" TextElement.Foreground="{StaticResource TangoGrayTextBrush}"> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="Auto" /> - <ColumnDefinition Width="Auto" /> - <ColumnDefinition Width="Auto" /> - <ColumnDefinition Width="Auto" /> - <ColumnDefinition Width="Auto" /> - </Grid.ColumnDefinitions> + <Grid HorizontalAlignment="Center" Margin="0 20 0 0" TextElement.Foreground="{StaticResource TangoGrayTextBrush}"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + <ColumnDefinition Width="Auto" /> + </Grid.ColumnDefinitions> - <TextBlock HorizontalAlignment="Left"> + <TextBlock HorizontalAlignment="Left"> <Run Text="Job status:"></Run> <Run Text="{Binding Job.JobStatus}"></Run> - </TextBlock> + </TextBlock> - <Rectangle Margin="20 0" Grid.Column="1" HorizontalAlignment="Center" StrokeThickness="1" Stroke="{StaticResource TangoGrayTextBrush}" /> + <Rectangle Margin="20 0" Grid.Column="1" HorizontalAlignment="Center" StrokeThickness="1" Stroke="{StaticResource TangoGrayTextBrush}" /> - <TextBlock Grid.Column="2" HorizontalAlignment="Center"> + <TextBlock Grid.Column="2" HorizontalAlignment="Center"> <Run Text="Last updated:"></Run> <Run Text="{Binding Job.LastUpdated,Converter={StaticResource DateTimeUTCToShortDateConverter},TargetNullValue=Never}"></Run> - </TextBlock> + </TextBlock> - <Rectangle Margin="20 0" Grid.Column="3" HorizontalAlignment="Center" StrokeThickness="1" Stroke="{StaticResource TangoGrayTextBrush}" /> + <Rectangle Margin="20 0" Grid.Column="3" HorizontalAlignment="Center" StrokeThickness="1" Stroke="{StaticResource TangoGrayTextBrush}" /> - <TextBlock Grid.Column="4" HorizontalAlignment="Right"> + <TextBlock Grid.Column="4" HorizontalAlignment="Right"> <Run Text="Last dye:"></Run> <Run Text="{Binding Job.LastRun,Converter={StaticResource DateTimeUTCToShortDateConverter},TargetNullValue=Never}"></Run> - </TextBlock> - </Grid> - </StackPanel> - </touch:TouchExpander> + </TextBlock> + </Grid> + </StackPanel> + </touch:TouchExpander> + </touch:TouchVirtualizedContentControl> <Border Style="{StaticResource TangoTouchBorder}" Margin="0 12 0 0" Padding="0 0 0 40"> <Grid> @@ -612,75 +616,79 @@ </Grid> </Border> - <Border Style="{StaticResource TangoTouchBorder}" Margin="0 20 0 0" Padding="0 0 0 50" Visibility="{Binding Job.EmbroideryFileData,Converter={StaticResource IsNullToVisibilityConverter}}"> - <StackPanel> - <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Style="{StaticResource Level1Container}"> - <Image Source="../Images/embroidery.png" RenderOptions.BitmapScalingMode="Fant" Width="39" /> - <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Embroidery File</TextBlock> - </StackPanel> + <touch:TouchVirtualizedContentControl Margin="0 20 0 0"> + <Border Style="{StaticResource TangoTouchBorder}" Padding="0 0 0 50" Visibility="{Binding Job.EmbroideryFileData,Converter={StaticResource IsNullToVisibilityConverter}}"> + <StackPanel> + <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Style="{StaticResource Level1Container}"> + <Image Source="../Images/embroidery.png" RenderOptions.BitmapScalingMode="Fant" Width="39" /> + <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Embroidery File</TextBlock> + </StackPanel> - <StackPanel Style="{StaticResource Level2ContainerExtraMargin}"> - <DockPanel> - <Image Source="{Binding Job,Converter={StaticResource JobToEmbroideryImageConverter}}" Width="230" Stretch="Uniform" HorizontalAlignment="Left"></Image> + <StackPanel Style="{StaticResource Level2ContainerExtraMargin}"> + <DockPanel> + <Image Source="{Binding Job,Converter={StaticResource JobToEmbroideryImageConverter}}" Width="230" Stretch="Uniform" HorizontalAlignment="Left"></Image> - <StackPanel VerticalAlignment="Center" HorizontalAlignment="Right"> - <TextBlock TextWrapping="Wrap" TextAlignment="Right">Export the attached embroidery file to storage.</TextBlock> - <touch:TouchButton Command="{Binding ExportEmbroideryCommand}" Style="{StaticResource TangoHollowButton}" Width="240" Height="60" Margin="0 30 0 0" HorizontalAlignment="Right">EXPORT FILE</touch:TouchButton> - </StackPanel> - </DockPanel> + <StackPanel VerticalAlignment="Center" HorizontalAlignment="Right"> + <TextBlock TextWrapping="Wrap" TextAlignment="Right">Export the attached embroidery file to storage.</TextBlock> + <touch:TouchButton Command="{Binding ExportEmbroideryCommand}" Style="{StaticResource TangoHollowButton}" Width="240" Height="60" Margin="0 30 0 0" HorizontalAlignment="Right">EXPORT FILE</touch:TouchButton> + </StackPanel> + </DockPanel> + </StackPanel> </StackPanel> - </StackPanel> - </Border> + </Border> + </touch:TouchVirtualizedContentControl> - <Border Style="{StaticResource TangoTouchBorder}" Margin="0 20 0 0" Padding="0 0 0 50"> - <StackPanel> - <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Style="{StaticResource Level1Container}"> - <Image Source="../Images/JobView/job-summary.png" Width="39" /> - <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Job Summary</TextBlock> - </StackPanel> + <touch:TouchVirtualizedContentControl Margin="0 20 0 0" > + <Border Style="{StaticResource TangoTouchBorder}" Padding="0 0 0 50"> + <StackPanel> + <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Style="{StaticResource Level1Container}"> + <Image Source="../Images/JobView/job-summary.png" Width="39" /> + <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Job Summary</TextBlock> + </StackPanel> - <StackPanel Style="{StaticResource Level2ContainerExtraMargin}"> - <Grid> - <localControls:JobSummeryViewer DataContext="{Binding Job,IsAsync=True}" /> - </Grid> + <StackPanel Style="{StaticResource Level2ContainerExtraMargin}"> + <Grid> + <localControls:JobSummeryViewer DataContext="{Binding Job,IsAsync=True}" /> + </Grid> - <DockPanel Margin="0 30 0 0" LastChildFill="False"> + <DockPanel Margin="0 30 0 0" LastChildFill="False"> - <StackPanel Orientation="Horizontal" DockPanel.Dock="Left" VerticalAlignment="Center"> - <TextBlock> + <StackPanel Orientation="Horizontal" DockPanel.Dock="Left" VerticalAlignment="Center"> + <TextBlock> <Run Text="Job length (m):"></Run> <Run Text="{Binding Job.Length,Mode=OneWay}"></Run> - </TextBlock> - <TextBlock Foreground="{StaticResource TangoGrayTextBrush}"> - <TextBlock.Style> - <Style TargetType="TextBlock"> - <Setter Property="Visibility" Value="Collapsed"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding Job.LengthPercentageFactor,Converter={StaticResource GreaterThanToBooleanConverter},ConverterParameter=0}" Value="True"> - <Setter Property="Visibility" Value="Visible"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </TextBlock.Style> + </TextBlock> + <TextBlock Foreground="{StaticResource TangoGrayTextBrush}"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding Job.LengthPercentageFactor,Converter={StaticResource GreaterThanToBooleanConverter},ConverterParameter=0}" Value="True"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> <Run>(</Run><Run Text="{Binding Job.Length,Mode=OneWay}"></Run><Run>+</Run><Run Text="{Binding Job.LengthPercentageFactor,Mode=OneWay}"></Run><Run>%</Run><Run>)</Run> - </TextBlock> - </StackPanel> + </TextBlock> + </StackPanel> - <StackPanel DockPanel.Dock="Right" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0 -20 5 0"> - <TextBlock Margin="0 3 0 0" Foreground="{StaticResource TangoGrayTextBrush}" VerticalAlignment="Bottom"> + <StackPanel DockPanel.Dock="Right" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0 -20 5 0"> + <TextBlock Margin="0 3 0 0" Foreground="{StaticResource TangoGrayTextBrush}" VerticalAlignment="Bottom"> <Run Text="Factor: +"></Run> - </TextBlock> + </TextBlock> - <touch:TouchNumericTextBox Foreground="{StaticResource TangoGrayTextBrush}" Margin="5 0 0 0" Width="50" HorizontalContentAlignment="Center" Maximum="100" Minimum="0" Value="{Binding Job.LengthPercentageFactor}" KeyboardContainer="{Binding ElementName=Container}" StringFormat="0" FocusSelectionMode="SelectAll" /> + <touch:TouchNumericTextBox Foreground="{StaticResource TangoGrayTextBrush}" Margin="5 0 0 0" Width="50" HorizontalContentAlignment="Center" Maximum="100" Minimum="0" Value="{Binding Job.LengthPercentageFactor}" KeyboardContainer="{Binding ElementName=Container}" StringFormat="0" FocusSelectionMode="SelectAll" /> - <TextBlock VerticalAlignment="Bottom" Foreground="{StaticResource TangoGrayTextBrush}">%</TextBlock> + <TextBlock VerticalAlignment="Bottom" Foreground="{StaticResource TangoGrayTextBrush}">%</TextBlock> - <Image Margin="10 0 0 0" Source="../Images/JobView/settings.png" VerticalAlignment="Bottom" /> - </StackPanel> - </DockPanel> + <Image Margin="10 0 0 0" Source="../Images/JobView/settings.png" VerticalAlignment="Bottom" /> + </StackPanel> + </DockPanel> + </StackPanel> </StackPanel> - </StackPanel> - </Border> + </Border> + </touch:TouchVirtualizedContentControl> <StackPanel HorizontalAlignment="Center" Margin="20 40 0 40" Orientation="Horizontal" VerticalAlignment="Center" Style="{StaticResource Level1Container}"> <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">Additional Tools</TextBlock> @@ -708,286 +716,202 @@ </StackPanel> </Border>--> - <touch:TouchExpander x:Name="expander_sample_dye" Margin="0 0 0 0" Padding="20 15"> - <touch:TouchExpander.Header> - <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0 0 20 0"> - <Image Source="../Images/JobView/sample-dye.png" Width="39" /> - <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Sample Dye</TextBlock> - </StackPanel> - </touch:TouchExpander.Header> + <touch:TouchVirtualizedContentControl> + <touch:TouchExpander x:Name="expander_sample_dye" Margin="0 0 0 0" Padding="20 15"> + <touch:TouchExpander.Header> + <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0 0 20 0"> + <Image Source="../Images/JobView/sample-dye.png" Width="39" /> + <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Sample Dye</TextBlock> + </StackPanel> + </touch:TouchExpander.Header> - <StackPanel> - <StackPanel Margin="60 20 0 0"> - <ContentControl> - <ContentControl.Style> - <Style TargetType="ContentControl"> - <Setter Property="Content"> - <Setter.Value> - <StackPanel> - <ContentControl Content="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext}"> - <ContentControl.Style> - <Style TargetType="ContentControl"> - <Setter Property="ContentTemplate"> - <Setter.Value> - <DataTemplate> - <StackPanel> - <TextBlock> + <StackPanel> + <StackPanel Margin="60 20 0 0"> + <ContentControl> + <ContentControl.Style> + <Style TargetType="ContentControl"> + <Setter Property="Content"> + <Setter.Value> + <StackPanel> + <ContentControl Content="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext}"> + <ContentControl.Style> + <Style TargetType="ContentControl"> + <Setter Property="ContentTemplate"> + <Setter.Value> + <DataTemplate> + <StackPanel> + <TextBlock> <Run>Dye 1 or more units in order to get approval.</Run> <LineBreak/> <Run>Once approved, you can dye the entire job.</Run> - </TextBlock> + </TextBlock> - <DockPanel Margin="0 50 0 0" LastChildFill="True" Width="450" HorizontalAlignment="Left"> - <TextBlock DockPanel.Dock="Left" VerticalAlignment="Center">How many sample units?</TextBlock> + <DockPanel Margin="0 50 0 0" LastChildFill="True" Width="450" HorizontalAlignment="Left"> + <TextBlock DockPanel.Dock="Left" VerticalAlignment="Center">How many sample units?</TextBlock> - <DockPanel Margin="50 0 0 0"> - <touch:TouchIconButton Command="{Binding IncreaseDecreaseSamplesToDyeCommand}" CommandParameter="-" DockPanel.Dock="Left" Icon="Minus" Padding="15" Style="{StaticResource TangoHollowButton}" BorderThickness="2" Width="51" Height="51" /> - <touch:TouchIconButton Command="{Binding IncreaseDecreaseSamplesToDyeCommand}" CommandParameter="+" DockPanel.Dock="Right" Icon="Plus" Padding="15" Style="{StaticResource TangoHollowButton}" BorderThickness="2" Width="51" Height="51" /> - <touch:TouchNumericTextBox Value="{Binding Job.SampleUnitsOrMeters}" Minimum="1" Maximum="100" HorizontalContentAlignment="Center" VerticalAlignment="Center" Margin="10 0" Foreground="{StaticResource TangoPrimaryAccentBrush}" FontSize="{StaticResource TangoTitleFontSize}" DockPanel.Dock="Right" KeyboardContainer="{Binding ElementName=Container}" /> + <DockPanel Margin="50 0 0 0"> + <touch:TouchIconButton Command="{Binding IncreaseDecreaseSamplesToDyeCommand}" CommandParameter="-" DockPanel.Dock="Left" Icon="Minus" Padding="15" Style="{StaticResource TangoHollowButton}" BorderThickness="2" Width="51" Height="51" /> + <touch:TouchIconButton Command="{Binding IncreaseDecreaseSamplesToDyeCommand}" CommandParameter="+" DockPanel.Dock="Right" Icon="Plus" Padding="15" Style="{StaticResource TangoHollowButton}" BorderThickness="2" Width="51" Height="51" /> + <touch:TouchNumericTextBox Value="{Binding Job.SampleUnitsOrMeters}" Minimum="1" Maximum="100" HorizontalContentAlignment="Center" VerticalAlignment="Center" Margin="10 0" Foreground="{StaticResource TangoPrimaryAccentBrush}" FontSize="{StaticResource TangoTitleFontSize}" DockPanel.Dock="Right" KeyboardContainer="{Binding ElementName=Container}" /> + </DockPanel> </DockPanel> - </DockPanel> - </StackPanel> - </DataTemplate> - </Setter.Value> - </Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding Job.JobType}" Value="{x:Static enumerations:JobTypes.Sewing}"> - <Setter Property="ContentTemplate"> - <Setter.Value> - <DataTemplate> - <StackPanel> - <TextBlock> + </StackPanel> + </DataTemplate> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding Job.JobType}" Value="{x:Static enumerations:JobTypes.Sewing}"> + <Setter Property="ContentTemplate"> + <Setter.Value> + <DataTemplate> + <StackPanel> + <TextBlock> <Run>Dye several meters per segment in order to get approval.</Run> <LineBreak/> <Run>Once approved, you can dye the entire job.</Run> - </TextBlock> + </TextBlock> - <DockPanel Margin="0 50 0 0" LastChildFill="True" Width="450" HorizontalAlignment="Left"> - <TextBlock DockPanel.Dock="Left" VerticalAlignment="Center">Meters per segment</TextBlock> + <DockPanel Margin="0 50 0 0" LastChildFill="True" Width="450" HorizontalAlignment="Left"> + <TextBlock DockPanel.Dock="Left" VerticalAlignment="Center">Meters per segment</TextBlock> - <DockPanel Margin="50 0 0 0"> - <touch:TouchIconButton Command="{Binding IncreaseDecreaseSamplesToDyeCommand}" CommandParameter="-" DockPanel.Dock="Left" Icon="Minus" Padding="15" Style="{StaticResource TangoHollowButton}" BorderThickness="2" Width="51" Height="51" /> - <touch:TouchIconButton Command="{Binding IncreaseDecreaseSamplesToDyeCommand}" CommandParameter="+" DockPanel.Dock="Right" Icon="Plus" Padding="15" Style="{StaticResource TangoHollowButton}" BorderThickness="2" Width="51" Height="51" /> - <touch:TouchNumericTextBox Value="{Binding Job.SampleUnitsOrMeters}" Minimum="1" Maximum="100" HorizontalContentAlignment="Center" VerticalAlignment="Center" Margin="10 0" Foreground="{StaticResource TangoPrimaryAccentBrush}" FontSize="{StaticResource TangoTitleFontSize}" DockPanel.Dock="Right" KeyboardContainer="{Binding ElementName=Container}" /> + <DockPanel Margin="50 0 0 0"> + <touch:TouchIconButton Command="{Binding IncreaseDecreaseSamplesToDyeCommand}" CommandParameter="-" DockPanel.Dock="Left" Icon="Minus" Padding="15" Style="{StaticResource TangoHollowButton}" BorderThickness="2" Width="51" Height="51" /> + <touch:TouchIconButton Command="{Binding IncreaseDecreaseSamplesToDyeCommand}" CommandParameter="+" DockPanel.Dock="Right" Icon="Plus" Padding="15" Style="{StaticResource TangoHollowButton}" BorderThickness="2" Width="51" Height="51" /> + <touch:TouchNumericTextBox Value="{Binding Job.SampleUnitsOrMeters}" Minimum="1" Maximum="100" HorizontalContentAlignment="Center" VerticalAlignment="Center" Margin="10 0" Foreground="{StaticResource TangoPrimaryAccentBrush}" FontSize="{StaticResource TangoTitleFontSize}" DockPanel.Dock="Right" KeyboardContainer="{Binding ElementName=Container}" /> + </DockPanel> </DockPanel> - </DockPanel> - </StackPanel> - </DataTemplate> - </Setter.Value> - </Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </ContentControl.Style> - </ContentControl> + </StackPanel> + </DataTemplate> + </Setter.Value> + </Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </ContentControl.Style> + </ContentControl> - <touch:TouchButton Margin="0 50 0 15" DockPanel.Dock="Right" Height="54" Padding="0" Width="184" CornerRadius="30" BlurRadius="20" HorizontalAlignment="Right" Command="{Binding StartSampleDyeCommand}" IsEnabled="{Binding MachineProvider.MachineOperator.CanPrint}"> - START - </touch:TouchButton> - </StackPanel> - </Setter.Value> - </Setter> + <touch:TouchButton Margin="0 50 0 15" DockPanel.Dock="Right" Height="54" Padding="0" Width="184" CornerRadius="30" BlurRadius="20" HorizontalAlignment="Right" Command="{Binding StartSampleDyeCommand}" IsEnabled="{Binding MachineProvider.MachineOperator.CanPrint}"> + START + </touch:TouchButton> + </StackPanel> + </Setter.Value> + </Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding Job.JobSampleDyeStatus}" Value="{x:Static enumerations:SampleDyeStatuses.PendingApproval}"> - <Setter Property="Content"> - <Setter.Value> - <StackPanel> - <TextBlock>How to continue?</TextBlock> + <Style.Triggers> + <DataTrigger Binding="{Binding Job.JobSampleDyeStatus}" Value="{x:Static enumerations:SampleDyeStatuses.PendingApproval}"> + <Setter Property="Content"> + <Setter.Value> + <StackPanel> + <TextBlock>How to continue?</TextBlock> - <UniformGrid Columns="2" Width="420" HorizontalAlignment="Left" Margin="0 40 0 20"> - <StackPanel HorizontalAlignment="Left"> - <touch:TouchButton Style="{StaticResource TangoHollowButton}" Width="180" Height="50" Command="{Binding ApproveSampleCommand}"> - <StackPanel Orientation="Horizontal"> - <touch:TouchIcon Icon="Check"></touch:TouchIcon> - <TextBlock Margin="10 0 0 0">DONE</TextBlock> - </StackPanel> - </touch:TouchButton> + <UniformGrid Columns="2" Width="420" HorizontalAlignment="Left" Margin="0 40 0 20"> + <StackPanel HorizontalAlignment="Left"> + <touch:TouchButton Style="{StaticResource TangoHollowButton}" Width="180" Height="50" Command="{Binding ApproveSampleCommand}"> + <StackPanel Orientation="Horizontal"> + <touch:TouchIcon Icon="Check"></touch:TouchIcon> + <TextBlock Margin="10 0 0 0">DONE</TextBlock> + </StackPanel> + </touch:TouchButton> - <TextBlock Margin="0 15 0 0" TextAlignment="Center">The sample is approved</TextBlock> - </StackPanel> + <TextBlock Margin="0 15 0 0" TextAlignment="Center">The sample is approved</TextBlock> + </StackPanel> - <StackPanel HorizontalAlignment="Right"> - <touch:TouchButton Style="{StaticResource TangoHollowButton}" Width="180" Height="50" Command="{Binding RepeatSampleDyeCommand}"> - <StackPanel Orientation="Horizontal"> - <touch:TouchIcon Icon="Repeat"></touch:TouchIcon> - <TextBlock Margin="10 0 0 0">REPEAT</TextBlock> - </StackPanel> - </touch:TouchButton> + <StackPanel HorizontalAlignment="Right"> + <touch:TouchButton Style="{StaticResource TangoHollowButton}" Width="180" Height="50" Command="{Binding RepeatSampleDyeCommand}"> + <StackPanel Orientation="Horizontal"> + <touch:TouchIcon Icon="Repeat"></touch:TouchIcon> + <TextBlock Margin="10 0 0 0">REPEAT</TextBlock> + </StackPanel> + </touch:TouchButton> - <TextBlock Margin="0 15 0 0" TextAlignment="Center">Dye more samples</TextBlock> - </StackPanel> - </UniformGrid> + <TextBlock Margin="0 15 0 0" TextAlignment="Center">Dye more samples</TextBlock> + </StackPanel> + </UniformGrid> - </StackPanel> - </Setter.Value> - </Setter> - </DataTrigger> + </StackPanel> + </Setter.Value> + </Setter> + </DataTrigger> - <DataTrigger Binding="{Binding Job.JobSampleDyeStatus}" Value="{x:Static enumerations:SampleDyeStatuses.Approved}"> - <Setter Property="Content"> - <Setter.Value> - <StackPanel Margin="0 40 80 40"> - <DockPanel LastChildFill="False"> - <TextBlock DockPanel.Dock="Left" VerticalAlignment="Center"> + <DataTrigger Binding="{Binding Job.JobSampleDyeStatus}" Value="{x:Static enumerations:SampleDyeStatuses.Approved}"> + <Setter Property="Content"> + <Setter.Value> + <StackPanel Margin="0 40 80 40"> + <DockPanel LastChildFill="False"> + <TextBlock DockPanel.Dock="Left" VerticalAlignment="Center"> <Run>Sample Approved:</Run> <Run Text="{Binding Job.SampleDyeApproveDate,Converter={StaticResource DateTimeUTCToShortDateConverter},TargetNullValue=''}"></Run> - </TextBlock> - <touch:TouchButton DockPanel.Dock="Right" HorizontalAlignment="Right" Style="{StaticResource TangoHollowButton}" Width="220" Height="50" Command="{Binding AnotherSampleCommand}"> - <StackPanel Orientation="Horizontal"> - <touch:TouchIcon Icon="Plus"></touch:TouchIcon> - <TextBlock Margin="10 0 0 0">ANOTHER SAMPLE</TextBlock> - </StackPanel> - </touch:TouchButton> - </DockPanel> - </StackPanel> - </Setter.Value> - </Setter> + </TextBlock> + <touch:TouchButton DockPanel.Dock="Right" HorizontalAlignment="Right" Style="{StaticResource TangoHollowButton}" Width="220" Height="50" Command="{Binding AnotherSampleCommand}"> + <StackPanel Orientation="Horizontal"> + <touch:TouchIcon Icon="Plus"></touch:TouchIcon> + <TextBlock Margin="10 0 0 0">ANOTHER SAMPLE</TextBlock> + </StackPanel> + </touch:TouchButton> + </DockPanel> + </StackPanel> + </Setter.Value> + </Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </ContentControl.Style> + </ContentControl> + </StackPanel> + + <StackPanel Margin="0 0 0 15"> + <StackPanel.Style> + <Style TargetType="StackPanel"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding Job.JobSampleDyeStatus}" Value="{x:Static enumerations:SampleDyeStatuses.PendingApproval}"> + <Setter Property="Visibility" Value="Visible"></Setter> </DataTrigger> </Style.Triggers> </Style> - </ContentControl.Style> - </ContentControl> - </StackPanel> - - <StackPanel Margin="0 0 0 15"> - <StackPanel.Style> - <Style TargetType="StackPanel"> - <Setter Property="Visibility" Value="Collapsed"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding Job.JobSampleDyeStatus}" Value="{x:Static enumerations:SampleDyeStatuses.PendingApproval}"> - <Setter Property="Visibility" Value="Visible"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </StackPanel.Style> - <Rectangle HorizontalAlignment="Stretch" StrokeThickness="1" Stroke="{StaticResource TangoDividerBrush}" Margin="-20 30"></Rectangle> + </StackPanel.Style> + <Rectangle HorizontalAlignment="Stretch" StrokeThickness="1" Stroke="{StaticResource TangoDividerBrush}" Margin="-20 30"></Rectangle> - <StackPanel Orientation="Horizontal" Margin="60 0 0 0"> - <touch:TouchIcon Icon="AlertCircleOutline" Width="32" Height="32" StrokeThickness="0.1" Foreground="{StaticResource TangoGrayBrush}" /> - <TextBlock Margin="10 0 0 0" VerticalAlignment="Center"> + <StackPanel Orientation="Horizontal" Margin="60 0 0 0"> + <touch:TouchIcon Icon="AlertCircleOutline" Width="32" Height="32" StrokeThickness="0.1" Foreground="{StaticResource TangoGrayBrush}" /> + <TextBlock Margin="10 0 0 0" VerticalAlignment="Center"> You can use the color fine tuning tool to adjust the colors. - </TextBlock> + </TextBlock> + </StackPanel> </StackPanel> </StackPanel> - </StackPanel> - </touch:TouchExpander> - - <touch:TouchExpander x:Name="expander_fine_tuning" Margin="0 20 0 120" Padding="20 15" IsExpanded="{Binding IsFineTuneExpanded,Mode=TwoWay}" Visibility="{Binding Job.ColorSpace,Converter={StaticResource ColorSpaceToVisibilityConverter}}"> - <touch:TouchExpander.Header> - <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0 0 20 0"> - <Image Source="../Images/JobView/color-fine-tuning.png" Width="39" /> - <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Color Fine Tuning</TextBlock> - </StackPanel> - </touch:TouchExpander.Header> - - <StackPanel Margin="60 20 0 0"> - - <ContentControl> - <ContentControl.Style> - <Style TargetType="ContentControl"> - <Setter Property="Content"> - <Setter.Value> - <StackPanel> - <TextBlock>Select the colors you want to fine tune.</TextBlock> + </touch:TouchExpander> + </touch:TouchVirtualizedContentControl> - <StackPanel HorizontalAlignment="Center" Margin="0 40 0 0"> - <TextBlock Foreground="{StaticResource TangoGrayTextBrush}" HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">Defined Colors</TextBlock> + <touch:TouchVirtualizedContentControl> + <touch:TouchExpander x:Name="expander_fine_tuning" Margin="0 20 0 120" Padding="20 15" IsExpanded="{Binding IsFineTuneExpanded,Mode=TwoWay}" Visibility="{Binding Job.ColorSpace,Converter={StaticResource ColorSpaceToVisibilityConverter}}"> + <touch:TouchExpander.Header> + <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="0 0 20 0"> + <Image Source="../Images/JobView/color-fine-tuning.png" Width="39" /> + <TextBlock FontWeight="Medium" Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoExpanderHeaderFontSize}">Color Fine Tuning</TextBlock> + </StackPanel> + </touch:TouchExpander.Header> - <ItemsControl Margin="0 40 0 0" ItemsSource="{Binding FineTuneItems}"> - <ItemsControl.ItemTemplate> - <DataTemplate> - <DockPanel> - <touch:TouchCheckBox DockPanel.Dock="Left" IsChecked="{Binding IsSelected}" Margin="0 0 20 0" /> - <touch:TouchImageButton DockPanel.Dock="Right" Image="{StaticResource Image_Color_Picker}" Width="80" Height="80" Padding="15" CornerRadius="100" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.InvokeFineTuningPaletteCommand}" CommandParameter="{Binding}"></touch:TouchImageButton> - <touch:TouchFlatListBox ItemsSource="{Binding Suggestions}" SelectedItem="{Binding SelectedSuggestion}" IsEnabled="False"> - <touch:TouchFlatListBox.ItemsPanel> - <ItemsPanelTemplate> - <UniformGrid Columns="{Binding Suggestions.Count}" Margin="0 20"></UniformGrid> - </ItemsPanelTemplate> - </touch:TouchFlatListBox.ItemsPanel> - <touch:TouchFlatListBox.ItemTemplate> - <DataTemplate> - <Ellipse Width="70" Height="70" Fill="{Binding Brush}" Margin="30 0"> - <Ellipse.Style> - <Style TargetType="Ellipse"> - <Setter Property="RenderTransformOrigin" Value="0.5,0.5"></Setter> - <Setter Property="RenderTransform"> - <Setter.Value> - <ScaleTransform ScaleX="1" ScaleY="1" /> - </Setter.Value> - </Setter> - <Setter Property="Effect"> - <Setter.Value> - <DropShadowEffect Color="{StaticResource TangoDropShadowColor}" ShadowDepth="10" Direction="10" BlurRadius="15" Opacity="0" /> - </Setter.Value> - </Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected}" Value="True"> - <DataTrigger.EnterActions> - <BeginStoryboard> - <Storyboard> - <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="1.2" Duration="00:00:0.2" /> - <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="1.2" Duration="00:00:0.2" /> - <DoubleAnimation Storyboard.TargetProperty="Effect.Opacity" To="1" Duration="00:00:0.2" /> - </Storyboard> - </BeginStoryboard> - </DataTrigger.EnterActions> - <DataTrigger.ExitActions> - <BeginStoryboard> - <Storyboard> - <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="1" Duration="00:00:0.2" /> - <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="1" Duration="00:00:0.2" /> - <DoubleAnimation Storyboard.TargetProperty="Effect.Opacity" To="0" Duration="00:00:0.2" /> - </Storyboard> - </BeginStoryboard> - </DataTrigger.ExitActions> - </DataTrigger> - </Style.Triggers> - </Style> - </Ellipse.Style> - </Ellipse> - </DataTemplate> - </touch:TouchFlatListBox.ItemTemplate> - </touch:TouchFlatListBox> - </DockPanel> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> - </StackPanel> + <StackPanel Margin="60 20 0 0"> - <DockPanel LastChildFill="False" Margin="0 80 0 0"> - <touch:TouchButton Command="{Binding ResetFineTuningCommand}" DockPanel.Dock="Left" Padding="40 10" Margin="-30 0 0 0" Style="{StaticResource TangoFlatButton}" Foreground="{StaticResource TangoPrimaryAccentBrush}">Reset</touch:TouchButton> + <ContentControl> + <ContentControl.Style> + <Style TargetType="ContentControl"> + <Setter Property="Content"> + <Setter.Value> + <StackPanel> + <TextBlock>Select the colors you want to fine tune.</TextBlock> - <touch:TouchButton Margin="0 0 0 15" DockPanel.Dock="Right" Height="54" Padding="0" Width="184" CornerRadius="30" BlurRadius="20" HorizontalAlignment="Right" Command="{Binding StartFineTuningCommand}" IsEnabled="{Binding MachineProvider.MachineOperator.CanPrint}"> - START - </touch:TouchButton> - </DockPanel> - </StackPanel> - </Setter.Value> - </Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding Job.JobFineTuningStatus}" Value="{x:Static enumerations:FineTuningStatuses.PendingApproval}"> - <Setter Property="Content"> - <Setter.Value> - <StackPanel Margin="0 20 0 0"> - <StackPanel Orientation="Horizontal"> - <Grid> - <Ellipse Stroke="{StaticResource TangoDarkForegroundBrush}" StrokeThickness="2" Width="42" Height="42"></Ellipse> - <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="20" FontWeight="Bold">1</TextBlock> - </Grid> - <TextBlock Margin="20 0 0 0" VerticalAlignment="Center">Select the best variation for each color:</TextBlock> - </StackPanel> + <StackPanel HorizontalAlignment="Center" Margin="0 40 0 0"> + <TextBlock Foreground="{StaticResource TangoGrayTextBrush}" HorizontalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}">Defined Colors</TextBlock> - <ItemsControl Margin="65 40 120 0" ItemsSource="{Binding ApprovalFineTuneItems}" AlternationCount="1000"> + <ItemsControl Margin="0 40 0 0" ItemsSource="{Binding FineTuneItems}"> <ItemsControl.ItemTemplate> <DataTemplate> <DockPanel> - <TextBlock Margin="0 0 20 0" VerticalAlignment="Center"> - <Run>Color</Run> - <Run>#</Run><Run Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(ItemsControl.AlternationIndex),Mode=OneWay,Converter={StaticResource MathOperatorConverter},ConverterParameter='+1'}"></Run> - </TextBlock> - <touch:TouchFlatListBox ItemsSource="{Binding Suggestions}" SelectedItem="{Binding SelectedSuggestion}"> + <touch:TouchCheckBox DockPanel.Dock="Left" IsChecked="{Binding IsSelected}" Margin="0 0 20 0" /> + <touch:TouchImageButton DockPanel.Dock="Right" Image="{StaticResource Image_Color_Picker}" Width="80" Height="80" Padding="15" CornerRadius="100" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.InvokeFineTuningPaletteCommand}" CommandParameter="{Binding}"></touch:TouchImageButton> + <touch:TouchFlatListBox ItemsSource="{Binding Suggestions}" SelectedItem="{Binding SelectedSuggestion}" IsEnabled="False"> <touch:TouchFlatListBox.ItemsPanel> <ItemsPanelTemplate> <UniformGrid Columns="{Binding Suggestions.Count}" Margin="0 20"></UniformGrid> @@ -1041,69 +965,157 @@ </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> + </StackPanel> - <StackPanel Orientation="Horizontal" Margin="0 40 0 0"> - <Grid> - <Ellipse Stroke="{StaticResource TangoDarkForegroundBrush}" StrokeThickness="2" Width="42" Height="42"></Ellipse> - <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="20" FontWeight="Bold">2</TextBlock> - </Grid> - <TextBlock Margin="20 0 0 0" VerticalAlignment="Center">How to continue</TextBlock> - </StackPanel> + <DockPanel LastChildFill="False" Margin="0 80 0 0"> + <touch:TouchButton Command="{Binding ResetFineTuningCommand}" DockPanel.Dock="Left" Padding="40 10" Margin="-30 0 0 0" Style="{StaticResource TangoFlatButton}" Foreground="{StaticResource TangoPrimaryAccentBrush}">Reset</touch:TouchButton> - <UniformGrid Columns="2" Width="530" HorizontalAlignment="Left" Margin="0 40 0 20"> - <StackPanel HorizontalAlignment="Left"> - <touch:TouchButton Style="{StaticResource TangoHollowButton}" Width="180" Height="50" Command="{Binding ApproveFineTuningCommand}"> - <StackPanel Orientation="Horizontal"> - <touch:TouchIcon Icon="Check"></touch:TouchIcon> - <TextBlock Margin="10 0 0 0">DONE</TextBlock> - </StackPanel> - </touch:TouchButton> - - <TextBlock Margin="0 15 0 0" TextAlignment="Center">All colors are approved</TextBlock> + <touch:TouchButton Margin="0 0 0 15" DockPanel.Dock="Right" Height="54" Padding="0" Width="184" CornerRadius="30" BlurRadius="20" HorizontalAlignment="Right" Command="{Binding StartFineTuningCommand}" IsEnabled="{Binding MachineProvider.MachineOperator.CanPrint}"> + START + </touch:TouchButton> + </DockPanel> + </StackPanel> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding Job.JobFineTuningStatus}" Value="{x:Static enumerations:FineTuningStatuses.PendingApproval}"> + <Setter Property="Content"> + <Setter.Value> + <StackPanel Margin="0 20 0 0"> + <StackPanel Orientation="Horizontal"> + <Grid> + <Ellipse Stroke="{StaticResource TangoDarkForegroundBrush}" StrokeThickness="2" Width="42" Height="42"></Ellipse> + <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="20" FontWeight="Bold">1</TextBlock> + </Grid> + <TextBlock Margin="20 0 0 0" VerticalAlignment="Center">Select the best variation for each color:</TextBlock> </StackPanel> - <StackPanel HorizontalAlignment="Right"> - <touch:TouchButton Style="{StaticResource TangoHollowButton}" Width="180" Height="50" Command="{Binding RepeatFineTuningCommand}"> - <StackPanel Orientation="Horizontal"> - <touch:TouchIcon Icon="Repeat"></touch:TouchIcon> - <TextBlock Margin="10 0 0 0">REPEAT</TextBlock> - </StackPanel> - </touch:TouchButton> + <ItemsControl Margin="65 40 120 0" ItemsSource="{Binding ApprovalFineTuneItems}" AlternationCount="1000"> + <ItemsControl.ItemTemplate> + <DataTemplate> + <DockPanel> + <TextBlock Margin="0 0 20 0" VerticalAlignment="Center"> + <Run>Color</Run> + <Run>#</Run><Run Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=(ItemsControl.AlternationIndex),Mode=OneWay,Converter={StaticResource MathOperatorConverter},ConverterParameter='+1'}"></Run> + </TextBlock> + <touch:TouchFlatListBox ItemsSource="{Binding Suggestions}" SelectedItem="{Binding SelectedSuggestion}"> + <touch:TouchFlatListBox.ItemsPanel> + <ItemsPanelTemplate> + <UniformGrid Columns="{Binding Suggestions.Count}" Margin="0 20"></UniformGrid> + </ItemsPanelTemplate> + </touch:TouchFlatListBox.ItemsPanel> + <touch:TouchFlatListBox.ItemTemplate> + <DataTemplate> + <Ellipse Width="70" Height="70" Fill="{Binding Brush}" Margin="30 0"> + <Ellipse.Style> + <Style TargetType="Ellipse"> + <Setter Property="RenderTransformOrigin" Value="0.5,0.5"></Setter> + <Setter Property="RenderTransform"> + <Setter.Value> + <ScaleTransform ScaleX="1" ScaleY="1" /> + </Setter.Value> + </Setter> + <Setter Property="Effect"> + <Setter.Value> + <DropShadowEffect Color="{StaticResource TangoDropShadowColor}" ShadowDepth="10" Direction="10" BlurRadius="15" Opacity="0" /> + </Setter.Value> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected}" Value="True"> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="1.2" Duration="00:00:0.2" /> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="1.2" Duration="00:00:0.2" /> + <DoubleAnimation Storyboard.TargetProperty="Effect.Opacity" To="1" Duration="00:00:0.2" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleX" To="1" Duration="00:00:0.2" /> + <DoubleAnimation Storyboard.TargetProperty="RenderTransform.ScaleY" To="1" Duration="00:00:0.2" /> + <DoubleAnimation Storyboard.TargetProperty="Effect.Opacity" To="0" Duration="00:00:0.2" /> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </Ellipse.Style> + </Ellipse> + </DataTemplate> + </touch:TouchFlatListBox.ItemTemplate> + </touch:TouchFlatListBox> + </DockPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> - <TextBlock Margin="0 15 0 0" TextAlignment="Left" TextWrapping="Wrap" Width="170">Some color need more fine tuning</TextBlock> + <StackPanel Orientation="Horizontal" Margin="0 40 0 0"> + <Grid> + <Ellipse Stroke="{StaticResource TangoDarkForegroundBrush}" StrokeThickness="2" Width="42" Height="42"></Ellipse> + <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="20" FontWeight="Bold">2</TextBlock> + </Grid> + <TextBlock Margin="20 0 0 0" VerticalAlignment="Center">How to continue</TextBlock> </StackPanel> - </UniformGrid> - </StackPanel> - </Setter.Value> - </Setter> - </DataTrigger> - <DataTrigger Binding="{Binding Job.JobFineTuningStatus}" Value="{x:Static enumerations:FineTuningStatuses.Approved}"> - <Setter Property="Content"> - <Setter.Value> - <StackPanel Margin="0 40 80 40"> - <DockPanel LastChildFill="False"> - <TextBlock DockPanel.Dock="Left" VerticalAlignment="Center"> + <UniformGrid Columns="2" Width="530" HorizontalAlignment="Left" Margin="0 40 0 20"> + <StackPanel HorizontalAlignment="Left"> + <touch:TouchButton Style="{StaticResource TangoHollowButton}" Width="180" Height="50" Command="{Binding ApproveFineTuningCommand}"> + <StackPanel Orientation="Horizontal"> + <touch:TouchIcon Icon="Check"></touch:TouchIcon> + <TextBlock Margin="10 0 0 0">DONE</TextBlock> + </StackPanel> + </touch:TouchButton> + + <TextBlock Margin="0 15 0 0" TextAlignment="Center">All colors are approved</TextBlock> + </StackPanel> + + <StackPanel HorizontalAlignment="Right"> + <touch:TouchButton Style="{StaticResource TangoHollowButton}" Width="180" Height="50" Command="{Binding RepeatFineTuningCommand}"> + <StackPanel Orientation="Horizontal"> + <touch:TouchIcon Icon="Repeat"></touch:TouchIcon> + <TextBlock Margin="10 0 0 0">REPEAT</TextBlock> + </StackPanel> + </touch:TouchButton> + + <TextBlock Margin="0 15 0 0" TextAlignment="Left" TextWrapping="Wrap" Width="170">Some color need more fine tuning</TextBlock> + </StackPanel> + </UniformGrid> + </StackPanel> + </Setter.Value> + </Setter> + </DataTrigger> + + <DataTrigger Binding="{Binding Job.JobFineTuningStatus}" Value="{x:Static enumerations:FineTuningStatuses.Approved}"> + <Setter Property="Content"> + <Setter.Value> + <StackPanel Margin="0 40 80 40"> + <DockPanel LastChildFill="False"> + <TextBlock DockPanel.Dock="Left" VerticalAlignment="Center"> <Run>Colors Approved:</Run> <Run Text="{Binding Job.FineTuningApproveDate,Converter={StaticResource DateTimeUTCToShortDateConverter},TargetNullValue=''}"></Run> - </TextBlock> - <touch:TouchButton DockPanel.Dock="Right" HorizontalAlignment="Right" Style="{StaticResource TangoHollowButton}" Width="220" Height="50" Command="{Binding RepeatFineTuningCommand}"> - <StackPanel Orientation="Horizontal"> - <touch:TouchIcon Icon="Plus"></touch:TouchIcon> - <TextBlock Margin="10 0 0 0">REPEAT FINE TUNING</TextBlock> - </StackPanel> - </touch:TouchButton> - </DockPanel> - </StackPanel> - </Setter.Value> - </Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </ContentControl.Style> - </ContentControl> - </StackPanel> - </touch:TouchExpander> + </TextBlock> + <touch:TouchButton DockPanel.Dock="Right" HorizontalAlignment="Right" Style="{StaticResource TangoHollowButton}" Width="220" Height="50" Command="{Binding RepeatFineTuningCommand}"> + <StackPanel Orientation="Horizontal"> + <touch:TouchIcon Icon="Plus"></touch:TouchIcon> + <TextBlock Margin="10 0 0 0">REPEAT FINE TUNING</TextBlock> + </StackPanel> + </touch:TouchButton> + </DockPanel> + </StackPanel> + </Setter.Value> + </Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </ContentControl.Style> + </ContentControl> + </StackPanel> + </touch:TouchExpander> + </touch:TouchVirtualizedContentControl> </StackPanel> </StackPanel> </touch:LightTouchScrollViewer> 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 475437cf3..5b9c234f0 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 @@ -2,6 +2,7 @@ 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:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Tango.PPC.Jobs.Views" xmlns:dragAndDrop="clr-namespace:Tango.DragAndDrop;assembly=Tango.DragAndDrop" @@ -32,6 +33,7 @@ <sharedConverters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter" /> <sharedConverters:EnumToItemsSourceConverter x:Key="EnumToItemsSourceConverter" /> <converters:JobsCategoryToVisibilityConverter x:Key="JobsCategoryToVisibilityConverter" /> + <converters:JobsCategoryToOpacityConverter x:Key="JobsCategoryToOpacityConverter" /> </ResourceDictionary> </UserControl.Resources> @@ -172,7 +174,7 @@ <Grid Grid.Row="1" x:Name="moveGrid"> <touch:TouchLoadingPanel IsLoading="{Binding IsLoadingJobs}" Visibility="{Binding SelectedCategory,Converter={StaticResource JobsCategoryToVisibilityConverter},ConverterParameter='Draft'}"> - <touch:LightTouchDataGrid AnimateSorting="False" RenderOptions.EdgeMode="Unspecified" Style="{StaticResource TangoJobsGrid}" x:Name="dataGridJobs" SelectedItems="{Binding SelectedJobs}" IsMultiSelecting="{Binding IsMultiSelecting,Mode=TwoWay}" OnDragAndDropCommand="{Binding JobDragedDroppedCommand}" ItemsSource="{Binding DraftJobsCollectionView}" ItemSelectedCommand="{Binding JobSelectedCommand}" Margin="10"> + <touch:LightTouchDataGrid CollectionFilter="{Binding CollectionFilter}" AnimateSorting="False" RenderOptions.EdgeMode="Unspecified" Style="{StaticResource TangoJobsGrid}" x:Name="dataGridJobs" SelectedItems="{Binding SelectedJobs}" IsMultiSelecting="{Binding IsMultiSelecting,Mode=TwoWay}" OnDragAndDropCommand="{Binding JobDragedDroppedCommand}" ItemsSource="{Binding DraftJobsCollectionView}" ItemSelectedCommand="{Binding JobSelectedCommand}" Margin="10"> <touch:LightTouchDataGrid.Columns> <touch:LightTouchDataGridColumn Width="90"> <touch:LightTouchDataGridColumn.Header> @@ -212,28 +214,28 @@ <touch:LightTouchDataGridColumn Width="1*" Header="Name" SortMember="Name" HorizontalContentAlignment="Left"> <touch:LightTouchDataGridColumn.CellTemplate> <DataTemplate> - <TextBlock IsHitTestVisible="False" Text="{Binding Name}"></TextBlock> + <controls:FastTextBlock IsHitTestVisible="False" Text="{Binding Name,IsAsync=True}"></controls:FastTextBlock> </DataTemplate> </touch:LightTouchDataGridColumn.CellTemplate> </touch:LightTouchDataGridColumn> <touch:LightTouchDataGridColumn Width="117" Header="Length (m)" SortMember="Length"> <touch:LightTouchDataGridColumn.CellTemplate> <DataTemplate> - <TextBlock IsHitTestVisible="False" Text="{Binding Length,StringFormat=0.0}"></TextBlock> + <controls:FastTextBlock IsHitTestVisible="False" Text="{Binding Length,StringFormat=0.0,IsAsync=True}"></controls:FastTextBlock> </DataTemplate> </touch:LightTouchDataGridColumn.CellTemplate> </touch:LightTouchDataGridColumn> <touch:LightTouchDataGridColumn Header="Colors" SortMember="Segments.Count" Width="85"> <touch:LightTouchDataGridColumn.CellTemplate> <DataTemplate> - <Image Stretch="Fill" IsHitTestVisible="False" Source="{Binding Converter={StaticResource JobToPieImageConverter},ConverterParameter='25,25'}" Width="25" Height="25" HorizontalAlignment="Left"></Image> + <Image Stretch="Fill" IsHitTestVisible="False" Source="{Binding Converter={StaticResource JobToPieImageConverter},ConverterParameter='25,25',IsAsync=True}" Width="25" Height="25" HorizontalAlignment="Left"></Image> </DataTemplate> </touch:LightTouchDataGridColumn.CellTemplate> </touch:LightTouchDataGridColumn> <touch:LightTouchDataGridColumn Width="100" Header="Updated" SortMember="LastUpdated"> <touch:LightTouchDataGridColumn.CellTemplate> <DataTemplate> - <TextBlock IsHitTestVisible="False" Text="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateConverter}}"></TextBlock> + <controls:FastTextBlock IsHitTestVisible="False" Text="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateConverter},IsAsync=True}"></controls:FastTextBlock> </DataTemplate> </touch:LightTouchDataGridColumn.CellTemplate> </touch:LightTouchDataGridColumn> @@ -284,7 +286,7 @@ </touch:TouchLoadingPanel> <touch:TouchLoadingPanel IsLoading="{Binding IsLoadingJobs}" Visibility="{Binding SelectedCategory,Converter={StaticResource JobsCategoryToVisibilityConverter},ConverterParameter='History'}"> - <touch:LightTouchDataGrid AnimateSorting="False" EnableDragAndDrop="False" RenderOptions.EdgeMode="Unspecified" x:Name="dataGridJobsHistory" Style="{StaticResource TangoJobsGrid}" SelectedItems="{Binding SelectedJobs}" IsMultiSelecting="{Binding IsMultiSelecting,Mode=TwoWay}" ItemsSource="{Binding HistoryJobsCollectionView}" ItemSelectedCommand="{Binding JobSelectedCommand}" Margin="10"> + <touch:LightTouchDataGrid CollectionFilter="{Binding CollectionFilter}" AnimateSorting="False" EnableDragAndDrop="False" RenderOptions.EdgeMode="Unspecified" x:Name="dataGridJobsHistory" Style="{StaticResource TangoJobsGrid}" SelectedItems="{Binding SelectedJobs}" IsMultiSelecting="{Binding IsMultiSelecting,Mode=TwoWay}" ItemsSource="{Binding HistoryJobsCollectionView}" ItemSelectedCommand="{Binding JobSelectedCommand}" Margin="10"> <touch:LightTouchDataGrid.Columns> <touch:LightTouchDataGridColumn Width="50"> <touch:LightTouchDataGridColumn.Header> @@ -312,35 +314,35 @@ <touch:LightTouchDataGridColumn Width="100" Header="Status" SortMember="JobStatus"> <touch:LightTouchDataGridColumn.CellTemplate> <DataTemplate> - <TextBlock IsHitTestVisible="False" Text="{Binding JobStatus,Converter={StaticResource EnumToDescriptionConverter}}"></TextBlock> + <controls:FastTextBlock IsHitTestVisible="False" Text="{Binding JobStatus,Converter={StaticResource EnumToDescriptionConverter},IsAsync=True}"></controls:FastTextBlock> </DataTemplate> </touch:LightTouchDataGridColumn.CellTemplate> </touch:LightTouchDataGridColumn> <touch:LightTouchDataGridColumn Width="1*" Header="Name" SortMember="Name" HorizontalContentAlignment="Left"> <touch:LightTouchDataGridColumn.CellTemplate> <DataTemplate> - <TextBlock IsHitTestVisible="False" Text="{Binding Name}"></TextBlock> + <controls:FastTextBlock IsHitTestVisible="False" Text="{Binding Name,IsAsync=True}"></controls:FastTextBlock> </DataTemplate> </touch:LightTouchDataGridColumn.CellTemplate> </touch:LightTouchDataGridColumn> <touch:LightTouchDataGridColumn Width="117" Header="Length (m)" SortMember="Length"> <touch:LightTouchDataGridColumn.CellTemplate> <DataTemplate> - <TextBlock IsHitTestVisible="False" Text="{Binding Length,StringFormat=0.0}"></TextBlock> + <controls:FastTextBlock IsHitTestVisible="False" Text="{Binding Length,StringFormat=0.0,IsAsync=True}"></controls:FastTextBlock> </DataTemplate> </touch:LightTouchDataGridColumn.CellTemplate> </touch:LightTouchDataGridColumn> <touch:LightTouchDataGridColumn Header="Colors" SortMember="Segments.Count" Width="85"> <touch:LightTouchDataGridColumn.CellTemplate> <DataTemplate> - <Image Stretch="Fill" IsHitTestVisible="False" Source="{Binding Converter={StaticResource JobToPieImageConverter},ConverterParameter='25,25'}" Width="25" Height="25" HorizontalAlignment="Left"></Image> + <Image Stretch="Fill" IsHitTestVisible="False" Source="{Binding Converter={StaticResource JobToPieImageConverter},ConverterParameter='25,25',IsAsync=True}" Width="25" Height="25" HorizontalAlignment="Left"></Image> </DataTemplate> </touch:LightTouchDataGridColumn.CellTemplate> </touch:LightTouchDataGridColumn> <touch:LightTouchDataGridColumn Width="100" Header="Updated" SortMember="LastUpdated"> <touch:LightTouchDataGridColumn.CellTemplate> <DataTemplate> - <TextBlock IsHitTestVisible="False" Text="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateConverter}}"></TextBlock> + <controls:FastTextBlock IsHitTestVisible="False" Text="{Binding LastUpdated,Converter={StaticResource DateTimeUTCToShortDateConverter},IsAsync=True}"></controls:FastTextBlock> </DataTemplate> </touch:LightTouchDataGridColumn.CellTemplate> </touch:LightTouchDataGridColumn> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml.cs index d8ef4056c..ceac18e38 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml.cs @@ -12,29 +12,45 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using Tango.Core.DI; +using Tango.PPC.Jobs.ViewContracts; namespace Tango.PPC.Jobs.Views { /// <summary> /// Interaction logic for JobsView.xaml /// </summary> - public partial class JobsView : UserControl + public partial class JobsView : UserControl, IJobsView { public JobsView() { InitializeComponent(); + TangoIOC.Default.Register<IJobsView>(this); } - private async void TouchNavigationLinks_SelectionChanged(object sender, SelectionChangedEventArgs e) + private void TouchNavigationLinks_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (dataGridJobs != null) { - await Task.Delay(200); + //await Task.Delay(200); - dataGridJobs.LayoutRows(false); + //dataGridJobs.LayoutRows(false); + //dataGridJobs.ScrollViewer.ScrollToTop(); + + //dataGridJobsHistory.LayoutRows(false); + //dataGridJobsHistory.ScrollViewer.ScrollToTop(); + } + } + + public void ScrollToTop() + { + if (dataGridJobs != null && dataGridJobs.ScrollViewer != null) + { dataGridJobs.ScrollViewer.ScrollToTop(); + } - dataGridJobsHistory.LayoutRows(false); + if (dataGridJobsHistory != null && dataGridJobsHistory.ScrollViewer != null) + { dataGridJobsHistory.ScrollViewer.ScrollToTop(); } } 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 index 06cd0661d..23d471138 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Storage/ViewModels/MainViewVM.cs @@ -135,6 +135,7 @@ namespace Tango.PPC.Storage.ViewModels { if (IsVisible) { + _allow_exit = true; await NotificationProvider.ShowError("Storage device disconnected."); await NavigationManager.NavigateBack(); CurrentPath = null; diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs index 5e3394ad6..3814fae20 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Properties/AssemblyInfo.cs @@ -8,4 +8,4 @@ using System.Windows; // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("Tango PPC Application")] -[assembly: AssemblyVersion("1.0.30.0")] +[assembly: AssemblyVersion("1.0.31.0")] diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest index efc5f8179..d72e75011 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest @@ -16,7 +16,7 @@ Remove this element if your application requires this virtualization for backwards compatibility. --> - <!--<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />--> + <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> </requestedPrivileges> </security> </trustInfo> diff --git a/Software/Visual_Studio/TEMP/Tango.Graphics2D/App.config b/Software/Visual_Studio/TEMP/Tango.Graphics2D/App.config new file mode 100644 index 000000000..731f6de6c --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Graphics2D/App.config @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8" ?> +<configuration> + <startup> + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" /> + </startup> +</configuration>
\ No newline at end of file diff --git a/Software/Visual_Studio/TEMP/Tango.Graphics2D/App.xaml b/Software/Visual_Studio/TEMP/Tango.Graphics2D/App.xaml new file mode 100644 index 000000000..798f62fd1 --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Graphics2D/App.xaml @@ -0,0 +1,9 @@ +<Application x:Class="Tango.Graphics2D.App" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="clr-namespace:Tango.Graphics2D" + StartupUri="MainWindow.xaml"> + <Application.Resources> + + </Application.Resources> +</Application> diff --git a/Software/Visual_Studio/TEMP/Tango.Graphics2D/App.xaml.cs b/Software/Visual_Studio/TEMP/Tango.Graphics2D/App.xaml.cs new file mode 100644 index 000000000..588297e93 --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Graphics2D/App.xaml.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Data; +using System.Linq; +using System.Threading.Tasks; +using System.Windows; + +namespace Tango.Graphics2D +{ + /// <summary> + /// Interaction logic for App.xaml + /// </summary> + public partial class App : Application + { + } +} diff --git a/Software/Visual_Studio/TEMP/Tango.Graphics2D/Drawing2DCanvas.cs b/Software/Visual_Studio/TEMP/Tango.Graphics2D/Drawing2DCanvas.cs new file mode 100644 index 000000000..5693e132d --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Graphics2D/Drawing2DCanvas.cs @@ -0,0 +1,36 @@ +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.Shapes; + +namespace Tango.Graphics2D +{ + public class Drawing2DCanvas : Drawing2DHost + { + protected override Point GetElementLocation(FrameworkElement element) + { + return GetElementCanvasLocation(element); + } + + private Point GetElementCanvasLocation(UIElement element) + { + var location = new Point(Canvas.GetLeft(element), Canvas.GetTop(element)); + + if (double.IsNaN(location.X)) + { + location.X = 0; + } + + if (double.IsNaN(location.Y)) + { + location.Y = 0; + } + + return location; + } + } +} diff --git a/Software/Visual_Studio/TEMP/Tango.Graphics2D/Drawing2DContext.cs b/Software/Visual_Studio/TEMP/Tango.Graphics2D/Drawing2DContext.cs new file mode 100644 index 000000000..fead16dba --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Graphics2D/Drawing2DContext.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media; + +namespace Tango.Graphics2D +{ + public class Drawing2DContext : IDisposable + { + public DrawingVisual Visual { get; private set; } + + public DrawingContext Context { get; private set; } + + public Drawing2DContext() + { + Visual = new DrawingVisual(); + Context = Visual.RenderOpen(); + } + + public void Dispose() + { + Context.Close(); + } + } +} diff --git a/Software/Visual_Studio/TEMP/Tango.Graphics2D/Drawing2DFrame.cs b/Software/Visual_Studio/TEMP/Tango.Graphics2D/Drawing2DFrame.cs new file mode 100644 index 000000000..0c8e393a1 --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Graphics2D/Drawing2DFrame.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; + +namespace Tango.Graphics2D +{ + public class Drawing2DFrame : Drawing2DHost + { + protected override Point GetElementLocation(FrameworkElement element) + { + if (element.HorizontalAlignment == HorizontalAlignment.Left) + { + if (element.VerticalAlignment == VerticalAlignment.Top) + { + return new Point(element.Margin.Left, element.Margin.Top); + } + else if (element.VerticalAlignment == VerticalAlignment.Bottom) + { + return new Point(element.Margin.Left, ActualHeight - element.Height - element.Margin.Bottom); + } + else + { + return new Point(element.Margin.Left, (ActualHeight / 2) - (element.Height / 2) + element.Margin.Top - element.Margin.Bottom); + } + } + else if (element.HorizontalAlignment == HorizontalAlignment.Right) + { + if (element.VerticalAlignment == VerticalAlignment.Top) + { + return new Point(ActualWidth - element.Width - element.Margin.Right, element.Margin.Top); + } + else if (element.VerticalAlignment == VerticalAlignment.Bottom) + { + return new Point(ActualWidth - element.Width - element.Margin.Right, ActualHeight - element.Height - element.Margin.Bottom); + } + else + { + return new Point(ActualWidth - element.Width - element.Margin.Right, (ActualHeight / 2) - (element.Height / 2) + element.Margin.Top - element.Margin.Bottom); + } + } + else + { + if (element.VerticalAlignment == VerticalAlignment.Top) + { + return new Point((ActualWidth / 2) - (element.Width / 2) + element.Margin.Left - element.Margin.Right, element.Margin.Top); + } + else if (element.VerticalAlignment == VerticalAlignment.Bottom) + { + return new Point((ActualWidth / 2) - (element.Width / 2) + element.Margin.Left - element.Margin.Right, ActualHeight - element.Height - element.Margin.Bottom); + } + else + { + return new Point((ActualWidth / 2) - (element.Width / 2) + element.Margin.Left - element.Margin.Right, (ActualHeight / 2) - (element.Height / 2) + element.Margin.Top - element.Margin.Bottom); + } + } + } + } +} diff --git a/Software/Visual_Studio/TEMP/Tango.Graphics2D/Drawing2DHost.cs b/Software/Visual_Studio/TEMP/Tango.Graphics2D/Drawing2DHost.cs new file mode 100644 index 000000000..965f7ea97 --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Graphics2D/Drawing2DHost.cs @@ -0,0 +1,271 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.ComponentModel; +using System.Globalization; +using System.Linq; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Documents; +using System.Windows.Markup; +using System.Windows.Media; +using System.Windows.Shapes; + +namespace Tango.Graphics2D +{ + [ContentProperty(nameof(Elements))] + public abstract class Drawing2DHost : FrameworkElement + { + private readonly VisualCollection _children; + + public ObservableCollection<FrameworkElement> Elements + { + get { return (ObservableCollection<FrameworkElement>)GetValue(ElementsProperty); } + set { SetValue(ElementsProperty, value); } + } + public static readonly DependencyProperty ElementsProperty = + DependencyProperty.Register("Elements", typeof(ObservableCollection<FrameworkElement>), typeof(Drawing2DHost), new PropertyMetadata(null, (d, e) => (d as Drawing2DHost).OnElementsChanged())); + + private void OnElementsChanged() + { + if (Elements != null) + { + Elements.CollectionChanged += Elements_CollectionChanged; + } + } + + private void Elements_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) + { + if (!DesignMode) + { + foreach (var element in e.NewItems) + { + (element as FrameworkElement).DataContext = DataContext; + } + } + } + + public Brush Foreground + { + get { return (Brush)this.GetValue(ForegroundProperty); } + set { this.SetValue(ForegroundProperty, value); } + } + public static readonly DependencyProperty ForegroundProperty = + TextBlock.ForegroundProperty.AddOwner(typeof(Drawing2DHost)); + + public Drawing2DHost() + { + Elements = new ObservableCollection<FrameworkElement>(); + _children = new VisualCollection(this); + Loaded += Drawing2DHost_Loaded; + } + + private void Drawing2DHost_Loaded(object sender, RoutedEventArgs e) + { + DrawElements(); + var size = OnMeasure(); + + if (double.IsNaN(Width)) + { + Width = size.Width; + } + + if (double.IsNaN(Height)) + { + Height = size.Height; + } + } + + private void DrawElements() + { + foreach (var element in Elements) + { + DrawElement(element); + } + } + + private void DrawElement(FrameworkElement element) + { + DrawingVisual visual = null; + + if (element is TextBlock) + { + visual = DrawTextBlock(element as TextBlock); + } + else if (element is Rectangle) + { + visual = DrawRectangle(element as Rectangle); + } + else if (element is Ellipse) + { + visual = DrawEllipse(element as Ellipse); + } + else if (element is Border) + { + visual = DrawBorder(element as Border); + } + + visual.Opacity = element.Opacity; + + AddVisual(visual); + } + + private DrawingVisual DrawTextBlock(TextBlock textBlock) + { + using (Drawing2DContext d2 = new Drawing2DContext()) + { + var x = d2.Context; + + double width = 0; + double height = 0; + + List<Tuple<FormattedText, double>> runs = new List<Tuple<FormattedText, double>>(); + + foreach (var run in textBlock.Inlines.OfType<Run>()) + { + var typeface = new Typeface( + run.FontFamily, + run.FontStyle, + run.FontWeight, + run.FontStretch); + + var formattedText = new FormattedText(run.Text, + CultureInfo.GetCultureInfo("en-us"), + run.FlowDirection, + typeface, + run.FontSize, + run.Foreground); + + formattedText.MaxTextWidth = ActualWidth; + + double w = formattedText.WidthIncludingTrailingWhitespace; + + runs.Add(new Tuple<FormattedText, double>(formattedText, w)); + + width += w; + height = Math.Max(formattedText.Height, height); + } + + textBlock.Width = width; + textBlock.Height = height; + + var location = GetElementLocation(textBlock); + + double position_x = location.X; + + foreach (var run in runs) + { + x.DrawText(run.Item1, new Point(position_x, location.Y)); + position_x += run.Item2; + } + + return d2.Visual; + } + } + + private DrawingVisual DrawRectangle(Rectangle rectangle) + { + using (Drawing2DContext d2 = new Drawing2DContext()) + { + var x = d2.Context; + + var location = GetElementLocation(rectangle); + + Pen pen = null; + + if (rectangle.Stroke != null) + { + pen = new Pen(rectangle.Stroke, rectangle.StrokeThickness); + pen.DashCap = rectangle.StrokeDashCap; + //TODO: add some stroke features... + } + + x.DrawRectangle(rectangle.Fill, pen, new Rect(location.X, location.Y, rectangle.Width, rectangle.Height)); + + return d2.Visual; + } + } + + private DrawingVisual DrawEllipse(Ellipse ellipse) + { + using (Drawing2DContext d2 = new Drawing2DContext()) + { + var x = d2.Context; + + var location = GetElementLocation(ellipse); + + Pen pen = null; + + if (ellipse.Stroke != null) + { + pen = new Pen(ellipse.Stroke, ellipse.StrokeThickness); + pen.DashCap = ellipse.StrokeDashCap; + //TODO: add some stroke features... + } + + x.DrawEllipse(ellipse.Fill, pen, new Point(location.X + ellipse.Width / 2, location.Y + ellipse.Height / 2), ellipse.Width / 2, ellipse.Height / 2); + + return d2.Visual; + } + } + + private DrawingVisual DrawBorder(Border border) + { + using (Drawing2DContext d2 = new Drawing2DContext()) + { + if (double.IsNaN(border.Width)) + { + border.Width = ActualWidth; + } + if (double.IsNaN(border.Height)) + { + border.Height = ActualHeight; + } + + var x = d2.Context; + + var location = GetElementLocation(border); + + Pen pen = null; + + if (border.BorderBrush != null) + { + pen = new Pen(border.BorderBrush, border.BorderThickness.Top); + } + + x.DrawRoundedRectangle(border.Background, pen, new Rect(location.X, location.Y, border.Width, border.Height), border.CornerRadius.TopLeft, border.CornerRadius.BottomRight); + + return d2.Visual; + } + } + + protected virtual Size OnMeasure() + { + return new Size(double.NaN, double.NaN); + } + + protected abstract Point GetElementLocation(FrameworkElement element); + + private void AddVisual(DrawingVisual visual) + { + _children.Add(visual); + } + + protected override int VisualChildrenCount => _children != null ? _children.Count : 0; + + protected override Visual GetVisualChild(int index) + { + if (index < 0 || index >= _children.Count) + { + throw new ArgumentOutOfRangeException(); + } + + return _children[index]; + } + + public bool DesignMode + { + get { return (DesignerProperties.GetIsInDesignMode(new DependencyObject())); } + } + } +} diff --git a/Software/Visual_Studio/TEMP/Tango.Graphics2D/Drawing2DStackPanel.cs b/Software/Visual_Studio/TEMP/Tango.Graphics2D/Drawing2DStackPanel.cs new file mode 100644 index 000000000..4f39435e4 --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Graphics2D/Drawing2DStackPanel.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; + +namespace Tango.Graphics2D +{ + public class Drawing2DStackPanel : Drawing2DHost + { + private double _currentPosition = 0; + private double _maxPosition = 0; + + public Orientation Orientation + { + get { return (Orientation)GetValue(OrientationProperty); } + set { SetValue(OrientationProperty, value); } + } + public static readonly DependencyProperty OrientationProperty = + DependencyProperty.Register("Orientation", typeof(Orientation), typeof(Drawing2DStackPanel), new PropertyMetadata(Orientation.Vertical)); + + protected override Point GetElementLocation(FrameworkElement element) + { + if (Orientation == Orientation.Vertical) + { + _currentPosition += element.Margin.Top; + + Point location = new Point(0, 0); + + if (element.HorizontalAlignment == HorizontalAlignment.Left) + { + location = new Point(element.Margin.Left, _currentPosition); + } + else if (element.HorizontalAlignment == HorizontalAlignment.Right) + { + location = new Point(ActualWidth - element.Width - element.Margin.Right, _currentPosition); + } + else + { + location = new Point((ActualWidth / 2) - (element.Width / 2) + element.Margin.Left - element.Margin.Right, _currentPosition); + } + + _currentPosition += (element.Height + element.Margin.Bottom); + + _maxPosition = Math.Max(_maxPosition, element.Width); + + return location; + } + else + { + _currentPosition += element.Margin.Left; + + Point location = new Point(0, 0); + + if (element.VerticalAlignment == VerticalAlignment.Top) + { + location = new Point(_currentPosition, element.Margin.Top); + } + else if (element.VerticalAlignment == VerticalAlignment.Bottom) + { + location = new Point(_currentPosition, ActualHeight - element.Height - element.Margin.Bottom); + } + else + { + location = new Point(_currentPosition, (ActualHeight / 2) - (element.Height / 2) + element.Margin.Top - element.Margin.Bottom); + } + + _currentPosition += (element.Width + element.Margin.Right); + + _maxPosition = Math.Max(_maxPosition, element.Height); + + return location; + } + } + + protected override Size OnMeasure() + { + if (Orientation == Orientation.Vertical) + { + return new Size(HorizontalAlignment != HorizontalAlignment.Stretch ? _maxPosition : double.NaN, _currentPosition); + } + else + { + return new Size(_currentPosition, _maxPosition); + } + } + } +} diff --git a/Software/Visual_Studio/TEMP/Tango.Graphics2D/MainWindow.xaml b/Software/Visual_Studio/TEMP/Tango.Graphics2D/MainWindow.xaml new file mode 100644 index 000000000..c530ae62c --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Graphics2D/MainWindow.xaml @@ -0,0 +1,55 @@ +<Window x:Class="Tango.Graphics2D.MainWindow" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:local="clr-namespace:Tango.Graphics2D" + mc:Ignorable="d" + Title="MainWindow" Height="500" Width="800" DataContext="{Binding RelativeSource={RelativeSource Mode=Self}}"> + + <Window.Resources> + <SolidColorBrush x:Key="RRR" Color="Blue"></SolidColorBrush> + </Window.Resources> + <Grid> + <!--<ListBox ItemsSource="{Binding Persons}" VirtualizingPanel.IsVirtualizing="False" ScrollViewer.CanContentScroll="False"> + <ListBox.ItemTemplate> + <DataTemplate> + <local:Drawing2DCanvas Height="50" x:Name="host"> + <Rectangle Width="30" Height="30"> + <Rectangle.Fill> + <SolidColorBrush Color="{Binding Color}" /> + </Rectangle.Fill> + </Rectangle> + <TextBlock Canvas.Left="40" Text="{Binding Age}"></TextBlock> + </local:Drawing2DCanvas> + </DataTemplate> + </ListBox.ItemTemplate> + </ListBox>--> + + <StackPanel> + <local:Drawing2DStackPanel VerticalAlignment="Top"> + <TextBlock HorizontalAlignment="Left" Margin="0 20 0 0"> + <Run>Top</Run> + <Run FontWeight="Bold" FontStyle="Italic">Left</Run> + </TextBlock> + <TextBlock Text="Center Center" HorizontalAlignment="Center" Margin="0 20 0 0"></TextBlock> + <TextBlock Text="Right Bottom" HorizontalAlignment="Right" Margin="0 20 0 0"></TextBlock> + </local:Drawing2DStackPanel> + <local:Drawing2DStackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0 100 0 0" Height="100"> + <TextBlock VerticalAlignment="Top">Left Top</TextBlock> + <TextBlock Margin="100 0 0 0" VerticalAlignment="Center">Center Center</TextBlock> + <TextBlock Margin="100 0 0 0" VerticalAlignment="Bottom">Right Bottom</TextBlock> + <Rectangle Margin="100 0 0 0" Fill="Red" Width="100" Height="100" Stroke="Black" StrokeThickness="2"></Rectangle> + <Ellipse Margin="20 0 0 0" Fill="Blue" Width="100" Height="100"></Ellipse> + </local:Drawing2DStackPanel> + + <Grid Width="200" Height="100" Margin="0 10 0 0"> + <local:Drawing2DFrame> + <Border Background="Gainsboro" BorderBrush="DimGray" BorderThickness="1" CornerRadius="5"/> + <TextBlock Text="Roy Ben Shabat" Opacity="0.5" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10"></TextBlock> + </local:Drawing2DFrame> + </Grid> + </StackPanel> + + </Grid> +</Window> diff --git a/Software/Visual_Studio/TEMP/Tango.Graphics2D/MainWindow.xaml.cs b/Software/Visual_Studio/TEMP/Tango.Graphics2D/MainWindow.xaml.cs new file mode 100644 index 000000000..7f4c5a3cb --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Graphics2D/MainWindow.xaml.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +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.Graphics2D +{ + /// <summary> + /// Interaction logic for MainWindow.xaml + /// </summary> + public partial class MainWindow : Window + { + public ObservableCollection<Person> Persons + { + get { return (ObservableCollection<Person>)GetValue(PersonsProperty); } + set { SetValue(PersonsProperty, value); } + } + public static readonly DependencyProperty PersonsProperty = + DependencyProperty.Register("Persons", typeof(ObservableCollection<Person>), typeof(MainWindow), new PropertyMetadata(null)); + + public MainWindow() + { + InitializeComponent(); + Persons = new ObservableCollection<Person>(); + + for (int i = 0; i < 1000; i++) + { + Persons.Add(new Person() + { + Name = "Roy Ben Shabat " + (i + 1), + Age = i, + }); + } + } + } +}
\ No newline at end of file diff --git a/Software/Visual_Studio/TEMP/Tango.Graphics2D/Person.cs b/Software/Visual_Studio/TEMP/Tango.Graphics2D/Person.cs new file mode 100644 index 000000000..db309f569 --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Graphics2D/Person.cs @@ -0,0 +1,25 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Media; + +namespace Tango.Graphics2D +{ + public class Person + { + private static Random _rnd = new Random(); + + public String Name { get; set; } + + public int Age { get; set; } + + public Color Color { get; set; } + + public Person() + { + Color = Color.FromRgb((byte)_rnd.Next(0, 255), (byte)_rnd.Next(0, 255), (byte)_rnd.Next(0, 255)); + } + } +} diff --git a/Software/Visual_Studio/TEMP/Tango.Graphics2D/Properties/AssemblyInfo.cs b/Software/Visual_Studio/TEMP/Tango.Graphics2D/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..023a574da --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Graphics2D/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +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.Graphics2D")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Tango.Graphics2D")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +//In order to begin building localizable applications, set +//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file +//inside a <PropertyGroup>. For example, if you are using US english +//in your source files, set the <UICulture> to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[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) +)] + + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Software/Visual_Studio/TEMP/Tango.Graphics2D/Properties/Resources.Designer.cs b/Software/Visual_Studio/TEMP/Tango.Graphics2D/Properties/Resources.Designer.cs new file mode 100644 index 000000000..8df260fd6 --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Graphics2D/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// <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.Graphics2D.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.Graphics2D.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/TEMP/Tango.Graphics2D/Properties/Resources.resx b/Software/Visual_Studio/TEMP/Tango.Graphics2D/Properties/Resources.resx new file mode 100644 index 000000000..af7dbebba --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Graphics2D/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/TEMP/Tango.Graphics2D/Properties/Settings.Designer.cs b/Software/Visual_Studio/TEMP/Tango.Graphics2D/Properties/Settings.Designer.cs new file mode 100644 index 000000000..1569b7305 --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Graphics2D/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.Graphics2D.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/TEMP/Tango.Graphics2D/Properties/Settings.settings b/Software/Visual_Studio/TEMP/Tango.Graphics2D/Properties/Settings.settings new file mode 100644 index 000000000..033d7a5e9 --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Graphics2D/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/TEMP/Tango.Graphics2D/Tango.Graphics2D.csproj b/Software/Visual_Studio/TEMP/Tango.Graphics2D/Tango.Graphics2D.csproj new file mode 100644 index 000000000..2a4dd9026 --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Graphics2D/Tango.Graphics2D.csproj @@ -0,0 +1,104 @@ +<?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>{AF62A4F6-E609-485D-9D4F-30708FC3C63A}</ProjectGuid> + <OutputType>WinExe</OutputType> + <RootNamespace>Tango.Graphics2D</RootNamespace> + <AssemblyName>Tango.Graphics2D</AssemblyName> + <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion> + <FileAlignment>512</FileAlignment> + <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> + <WarningLevel>4</WarningLevel> + <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects> + <Deterministic>true</Deterministic> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <PlatformTarget>AnyCPU</PlatformTarget> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\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> + <ApplicationDefinition Include="App.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </ApplicationDefinition> + <Page Include="MainWindow.xaml"> + <Generator>MSBuild:Compile</Generator> + <SubType>Designer</SubType> + </Page> + <Compile Include="App.xaml.cs"> + <DependentUpon>App.xaml</DependentUpon> + <SubType>Code</SubType> + </Compile> + <Compile Include="Drawing2DCanvas.cs" /> + <Compile Include="Drawing2DContext.cs" /> + <Compile Include="Drawing2DFrame.cs" /> + <Compile Include="Drawing2DHost.cs" /> + <Compile Include="Drawing2DStackPanel.cs" /> + <Compile Include="MainWindow.xaml.cs"> + <DependentUpon>MainWindow.xaml</DependentUpon> + <SubType>Code</SubType> + </Compile> + </ItemGroup> + <ItemGroup> + <Compile Include="Person.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> + <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> + <None Include="App.config" /> + </ItemGroup> + <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> +</Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/TEMP/Tango.Graphics2D/Tango.Graphics2D.sln b/Software/Visual_Studio/TEMP/Tango.Graphics2D/Tango.Graphics2D.sln new file mode 100644 index 000000000..af4f392de --- /dev/null +++ b/Software/Visual_Studio/TEMP/Tango.Graphics2D/Tango.Graphics2D.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.645 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tango.Graphics2D", "Tango.Graphics2D.csproj", "{AF62A4F6-E609-485D-9D4F-30708FC3C63A}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {AF62A4F6-E609-485D-9D4F-30708FC3C63A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AF62A4F6-E609-485D-9D4F-30708FC3C63A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AF62A4F6-E609-485D-9D4F-30708FC3C63A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AF62A4F6-E609-485D-9D4F-30708FC3C63A}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {28520B53-7D86-409C-8162-682C6364E5CC} + EndGlobalSection +EndGlobal diff --git a/Software/Visual_Studio/Tango.Touch/Components/DefaultCollectionFilter.cs b/Software/Visual_Studio/Tango.Touch/Components/DefaultCollectionFilter.cs new file mode 100644 index 000000000..f01763931 --- /dev/null +++ b/Software/Visual_Studio/Tango.Touch/Components/DefaultCollectionFilter.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Touch.Components +{ + public class DefaultCollectionFilter : ICollectionFilter + { + private Predicate<object> _predicate; + + public event EventHandler FilterChanged; + + public void RaiseFilterChanged() + { + FilterChanged?.Invoke(this, new EventArgs()); + } + + public bool Filter(object item) + { + return _predicate(item); + } + + public void RegisterFilter(Predicate<object> predicate) + { + _predicate = predicate; + } + } +} diff --git a/Software/Visual_Studio/Tango.Touch/Components/ICollectionFilter.cs b/Software/Visual_Studio/Tango.Touch/Components/ICollectionFilter.cs new file mode 100644 index 000000000..fecb00055 --- /dev/null +++ b/Software/Visual_Studio/Tango.Touch/Components/ICollectionFilter.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.Touch.Components +{ + public interface ICollectionFilter + { + event EventHandler FilterChanged; + + void RaiseFilterChanged(); + + bool Filter(Object item); + + void RegisterFilter(Predicate<Object> predicate); + } +} diff --git a/Software/Visual_Studio/Tango.Touch/Controls/LightTouchDataGrid.cs b/Software/Visual_Studio/Tango.Touch/Controls/LightTouchDataGrid.cs index 1be3103e9..60ef8a49e 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/LightTouchDataGrid.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/LightTouchDataGrid.cs @@ -35,6 +35,10 @@ namespace Tango.Touch.Controls public event EventHandler SelectionChanged; + public event EventHandler SortingChanged; + + public event EventHandler FilterChanged; + #endregion #region Properties @@ -149,6 +153,17 @@ namespace Tango.Touch.Controls public static readonly DependencyProperty SelectedItemProperty = DependencyProperty.Register("SelectedItem", typeof(Object), typeof(LightTouchDataGrid), new FrameworkPropertyMetadata(null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, (d, e) => (d as LightTouchDataGrid).OnSelectedItemChanged())); + /// <summary> + /// Gets or sets the collection filter. + /// </summary> + public ICollectionFilter CollectionFilter + { + get { return (ICollectionFilter)GetValue(CollectionFilterProperty); } + set { SetValue(CollectionFilterProperty, value); } + } + public static readonly DependencyProperty CollectionFilterProperty = + DependencyProperty.Register("CollectionFilter", typeof(ICollectionFilter), typeof(LightTouchDataGrid), new PropertyMetadata(null, (d, e) => (d as LightTouchDataGrid).OnCollectionFilterChanged())); + #endregion #region Commands @@ -421,6 +436,8 @@ namespace Tango.Touch.Controls } LayoutRows(true); + + SortingChanged?.Invoke(this, new EventArgs()); } #endregion @@ -446,6 +463,12 @@ namespace Tango.Touch.Controls } } + private void CollectionFilter_FilterChanged(object sender, EventArgs e) + { + LayoutRows(false); + FilterChanged?.Invoke(this, new EventArgs()); + } + #endregion #region Private Methods @@ -484,6 +507,15 @@ namespace Tango.Touch.Controls SelectionChanged?.Invoke(this, new EventArgs()); } + private void OnCollectionFilterChanged() + { + if (CollectionFilter != null) + { + CollectionFilter.FilterChanged -= CollectionFilter_FilterChanged; + CollectionFilter.FilterChanged += CollectionFilter_FilterChanged; + } + } + #endregion #region Public Methods @@ -517,51 +549,64 @@ namespace Tango.Touch.Controls for (int i = 0; i < ordered.Count; i++) { ContentPresenter contentPresenter = ordered[i]; + LightTouchDataGridRow row = contentPresenter.FindChild<LightTouchDataGridRow>(); + + bool display = true; - if (AnimateSorting && allowAnimation) + if (CollectionFilter != null && row != null) { - if (double.IsNaN(Canvas.GetTop(contentPresenter))) + row.Visibility = CollectionFilter.Filter(row.DataContext) ? Visibility.Visible : Visibility.Collapsed; + display = row.Visibility == Visibility.Visible; + } + + if (display) + { + if (AnimateSorting && allowAnimation) { - Canvas.SetTop(contentPresenter, current_top); - Canvas.SetLeft(contentPresenter, 0); + if (double.IsNaN(Canvas.GetTop(contentPresenter))) + { + Canvas.SetTop(contentPresenter, current_top); + Canvas.SetLeft(contentPresenter, 0); + } + else + { + int duration = _rnd.Next(200, 500); + + DoubleAnimation aniY = new DoubleAnimation(); + aniY.To = current_top; + aniY.Duration = TimeSpan.FromMilliseconds(duration); + contentPresenter.BeginAnimation(Canvas.TopProperty, aniY); + + DoubleAnimation aniX = new DoubleAnimation(); + aniX.FillBehavior = FillBehavior.Stop; + aniX.To = _rnd.Next(-20, 20); + aniX.AutoReverse = true; + aniX.Duration = TimeSpan.FromMilliseconds(duration / 2); + contentPresenter.BeginAnimation(Canvas.LeftProperty, aniX, HandoffBehavior.SnapshotAndReplace); + } } else { - int duration = _rnd.Next(200, 500); - - DoubleAnimation aniY = new DoubleAnimation(); - aniY.To = current_top; - aniY.Duration = TimeSpan.FromMilliseconds(duration); - contentPresenter.BeginAnimation(Canvas.TopProperty, aniY); + if (AnimateSorting) + { + contentPresenter.BeginAnimation(Canvas.TopProperty, null); + } - DoubleAnimation aniX = new DoubleAnimation(); - aniX.FillBehavior = FillBehavior.Stop; - aniX.To = _rnd.Next(-20, 20); - aniX.AutoReverse = true; - aniX.Duration = TimeSpan.FromMilliseconds(duration / 2); - contentPresenter.BeginAnimation(Canvas.LeftProperty, aniX, HandoffBehavior.SnapshotAndReplace); + Canvas.SetTop(contentPresenter, current_top); + Canvas.SetLeft(contentPresenter, 0); } - } - else - { - if (AnimateSorting) + + if (row != null) { - contentPresenter.BeginAnimation(Canvas.TopProperty, null); + current_top += (row.Margin.Top + row.ActualHeight + row.Margin.Bottom); } - Canvas.SetTop(contentPresenter, current_top); - Canvas.SetLeft(contentPresenter, 0); - } - - current_top += (ordered[i].Margin.Top + ordered[i].ActualHeight + ordered[i].Margin.Bottom); - - LightTouchDataGridRow row = contentPresenter.FindChild<LightTouchDataGridRow>(); - - if (row != null && row.Tag == null) - { - row.RegisterForPreviewMouseOrTouchUp(OnRowMouseTouchUp); - row.RegisterForPreviewMouseOrTouchDown(OnRowMouseTouchDown); - row.Tag = 1; + if (row != null && row.Tag == null) + { + row.RegisterForPreviewMouseOrTouchUp(OnRowMouseTouchUp); + row.RegisterForPreviewMouseOrTouchDown(OnRowMouseTouchDown); + row.Tag = 1; + } } } diff --git a/Software/Visual_Studio/Tango.Touch/Controls/LightTouchDataGrid.xaml b/Software/Visual_Studio/Tango.Touch/Controls/LightTouchDataGrid.xaml index 515b4c06f..591cbb549 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/LightTouchDataGrid.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/LightTouchDataGrid.xaml @@ -60,27 +60,29 @@ <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type local:LightTouchDataGridRow}"> - <Grid> - <Border Background="{TemplateBinding Background}" + <local:TouchVirtualizedContentControl DataGrid="{Binding RelativeSource={RelativeSource AncestorType=local:LightTouchDataGrid}}"> + <Grid> + <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="{TemplateBinding CornerRadius}" Padding="{TemplateBinding Padding}"> - <ContentPresenter Content="{TemplateBinding Content}" /> - </Border> - <ContentControl x:Name="mask" IsHitTestVisible="False" Content="{Binding}" ContentTemplate="{TemplateBinding SelectedMaskTemplate}"> - <ContentControl.Style> - <Style TargetType="ContentControl"> - <Setter Property="Visibility" Value="Hidden"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=local:LightTouchDataGridRow},Path=IsSelected}" Value="True"> - <Setter Property="Visibility" Value="Visible"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </ContentControl.Style> - </ContentControl> - </Grid> + <ContentPresenter Content="{TemplateBinding Content}" /> + </Border> + <ContentControl x:Name="mask" IsHitTestVisible="False" Content="{Binding}" ContentTemplate="{TemplateBinding SelectedMaskTemplate}"> + <ContentControl.Style> + <Style TargetType="ContentControl"> + <Setter Property="Visibility" Value="Hidden"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=local:LightTouchDataGridRow},Path=IsSelected}" Value="True"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </ContentControl.Style> + </ContentControl> + </Grid> + </local:TouchVirtualizedContentControl> </ControlTemplate> </Setter.Value> </Setter> diff --git a/Software/Visual_Studio/Tango.Touch/Controls/LightTouchScrollViewer.cs b/Software/Visual_Studio/Tango.Touch/Controls/LightTouchScrollViewer.cs index 76486d929..38dc2e125 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/LightTouchScrollViewer.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/LightTouchScrollViewer.cs @@ -65,6 +65,15 @@ namespace Tango.Touch.Controls public static readonly DependencyProperty InternalMarginProperty = DependencyProperty.Register("InternalMargin", typeof(Thickness), typeof(LightTouchScrollViewer), new PropertyMetadata(default(Thickness), (d, e) => (d as LightTouchScrollViewer).RaiseScrollEvent())); + public Border GetViewportBorder() + { + return _border_viewport; + } + + public Grid GetContentGrid() + { + return _grid_content; + } /// <summary> /// Gets or sets the scroll bar margins. diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchVirtualizedContentControl.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchVirtualizedContentControl.cs index 02240ecc8..72bb7dd06 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchVirtualizedContentControl.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchVirtualizedContentControl.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -7,6 +8,7 @@ using System.Windows; using System.Windows.Controls; using System.Windows.Markup; using System.Windows.Shapes; +using System.Windows.Threading; using Tango.Core.Threading; namespace Tango.Touch.Controls @@ -28,6 +30,22 @@ namespace Tango.Touch.Controls public static readonly DependencyProperty ContentProperty = DependencyProperty.Register("Content", typeof(UIElement), typeof(TouchVirtualizedContentControl), new PropertyMetadata(null)); + public bool CanMovePosition + { + get { return (bool)GetValue(CanMovePositionProperty); } + set { SetValue(CanMovePositionProperty, value); } + } + public static readonly DependencyProperty CanMovePositionProperty = + DependencyProperty.Register("CanMovePosition", typeof(bool), typeof(TouchVirtualizedContentControl), new PropertyMetadata(false)); + + public LightTouchDataGrid DataGrid + { + get { return (LightTouchDataGrid)GetValue(DataGridProperty); } + set { SetValue(DataGridProperty, value); } + } + public static readonly DependencyProperty DataGridProperty = + DependencyProperty.Register("DataGrid", typeof(LightTouchDataGrid), typeof(TouchVirtualizedContentControl), new PropertyMetadata(null)); + static TouchVirtualizedContentControl() { DefaultStyleKeyProperty.OverrideMetadata(typeof(TouchVirtualizedContentControl), new FrameworkPropertyMetadata(typeof(TouchVirtualizedContentControl))); @@ -35,7 +53,7 @@ namespace Tango.Touch.Controls public TouchVirtualizedContentControl() { - _updateTimer = new ActionTimer(TimeSpan.FromMilliseconds(200)); + _updateTimer = new ActionTimer(TimeSpan.FromMilliseconds(100)); Loaded += TouchVirtualizedContentControl_Loaded; } @@ -50,50 +68,88 @@ namespace Tango.Touch.Controls _scrollViewer = this.FindAncestor<LightTouchScrollViewer>(); _scrollViewer.Scrolling += _scrollViewer_Scrolling; - _location = this.TranslatePoint(new Point(0, 0), _scrollViewer); + if (DataGrid != null) + { + DataGrid.SortingChanged += DataGrid_SortingChanged; + DataGrid.FilterChanged += DataGrid_FilterChanged; + } - ApplyOptimization(); + _location = this.TranslatePoint(new Point(0, 0), _scrollViewer.GetContentGrid()); + + _scrollViewer.GetContentGrid().SizeChanged += TouchVirtualizedContentControl_SizeChanged; + + ApplyVirtualization(); _loaded = true; } + private void DataGrid_FilterChanged(object sender, EventArgs e) + { + InvalidateVirtualization(); + } + + private void DataGrid_SortingChanged(object sender, EventArgs e) + { + InvalidateVirtualization(); + } + + private void TouchVirtualizedContentControl_SizeChanged(object sender, SizeChangedEventArgs e) + { + InvalidateVirtualization(); + } + private void _scrollViewer_Scrolling(object sender, DoubleValueChangedEventArgs e) { if (_loaded) { - //_updateTimer.ResetReplace(() => - //{ - // Dispatcher.BeginInvoke(new Action(() => - // { - ApplyOptimization(); - // })); - //}); + ApplyVirtualization(); } } - private void ApplyOptimization() + private void InvalidateVirtualization() + { + _updateTimer.ResetReplace(() => + { + Dispatcher.BeginInvoke(new Action(() => + { + _location = this.TranslatePoint(new Point(0, 0), _scrollViewer.GetContentGrid()); + ApplyVirtualization(); + })); + }); + } + + private void ApplyVirtualization() { - //var _border_viewport = _scrollViewer.GetViewportBorder(); + var _border_viewport = _scrollViewer.GetViewportBorder(); - //if (_border_viewport.IsAncestorOf(this)) - //{ - // //Point relativeLocation = this.TranslatePoint(new Point(0, 0), _border_viewport); - // //Rect bounds = this.TransformToAncestor(_border_viewport).TransformBounds(new Rect(0.0, 0.0, this.ActualWidth, this.ActualHeight)); - // //Rect rect = new Rect(0.0, 0.0, _border_viewport.ActualWidth, _border_viewport.ActualHeight); - // if (_location.Y > _scrollViewer.GetScrollPosition() && _location.Y < _scrollViewer.GetScrollPosition() + _border_viewport.ActualHeight) - // { - // if (_innerBorder.Visibility == Visibility.Hidden) - // { - // _innerBorder.Visibility = Visibility.Visible; - // } - // } - // else - // { - // if (_innerBorder.Visibility == Visibility.Visible) - // { - // _innerBorder.Visibility = Visibility.Hidden; - // } - // } - //} + if (CanMovePosition) + { + _location = this.TranslatePoint(new Point(0, 0), _scrollViewer.GetContentGrid()); + } + + Rect bounds = new Rect(_location.X, _location.Y, ActualWidth, ActualHeight); + Rect rect = new Rect(0.0, _scrollViewer.GetScrollPosition(), _border_viewport.ActualWidth, _border_viewport.ActualHeight); + if (bounds.IntersectsWith(rect)) + { + if (_innerBorder.Visibility == Visibility.Hidden) + { + //Debug.WriteLine("Visible"); + Dispatcher.BeginInvoke(new Action(() => + { + _innerBorder.Visibility = Visibility.Visible; + }), DispatcherPriority.Background); + } + } + else + { + if (_innerBorder.Visibility == Visibility.Visible) + { + Dispatcher.BeginInvoke(new Action(() => + { + //Debug.WriteLine("Hidden"); + _innerBorder.Visibility = Visibility.Hidden; + }), DispatcherPriority.Background); + } + } } } } diff --git a/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj b/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj index 7600d4c14..287a299fb 100644 --- a/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj +++ b/Software/Visual_Studio/Tango.Touch/Tango.Touch.csproj @@ -59,6 +59,8 @@ <Compile Include="..\Versioning\GlobalVersionInfo.cs"> <Link>GlobalVersionInfo.cs</Link> </Compile> + <Compile Include="Components\DefaultCollectionFilter.cs" /> + <Compile Include="Components\ICollectionFilter.cs" /> <Compile Include="Components\SharedResourceDictionary.cs" /> <Compile Include="Controls\AutoCompleteProvider.cs" /> <Compile Include="Controls\DoubleValueChangedEventArgs.cs" /> @@ -391,7 +393,7 @@ <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 |
