diff options
| author | Avi Levkovich <avi@twine-s.com> | 2018-06-27 13:35:45 +0300 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2018-06-27 13:35:45 +0300 |
| commit | ec02fe9b944cdabf2fce23c91ae16bf2f1383276 (patch) | |
| tree | 113fdfde4af1dd06b7ce194b10311ebb4794609e /Software/Visual_Studio/PPC/Modules | |
| parent | 06e3b34d1908077694625e122e85aae7f3483a62 (diff) | |
| parent | bd438b5192763ad6a9b56af2f4fad3b7b071ce90 (diff) | |
| download | Tango-ec02fe9b944cdabf2fce23c91ae16bf2f1383276.tar.gz Tango-ec02fe9b944cdabf2fce23c91ae16bf2f1383276.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules')
8 files changed, 551 insertions, 110 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml new file mode 100644 index 000000000..c674b57fe --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml @@ -0,0 +1,84 @@ +<UserControl x:Class="Tango.PPC.Jobs.Controls.JobSummeryViewer" + xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:d="http://schemas.microsoft.com/expression/blend/2008" + xmlns:entities="clr-namespace:Tango.BL.Entities;assembly=Tango.BL" + xmlns:local="clr-namespace:Tango.PPC.Jobs.Controls" + mc:Ignorable="d" + d:DesignHeight="60" d:DesignWidth="500" Height="38" d:DataContext="{d:DesignInstance Type=entities:Job, IsDesignTimeCreatable=False}"> + + <Grid> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="1*" /> + </Grid.RowDefinitions> + + <ItemsControl ClipToBounds="False" ItemsSource="{Binding EffectiveSegments}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel Orientation="Horizontal" ClipToBounds="False"></StackPanel> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <Grid> + <Grid.Width> + <MultiBinding Converter="{StaticResource SegmentLengthToWidthConverter}"> + <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext"></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.Length"></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=ItemsControl}" Path="ActualWidth"></Binding> + <Binding Path="Length"></Binding> + </MultiBinding> + </Grid.Width> + + <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoSmallFontSize}"> + <Run Text="{Binding Length,Mode=OneWay,StringFormat=N0}"></Run><Run Text="m"></Run> + </TextBlock> + </Grid> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + + <Border Grid.Row="1" x:Name="brush_border" ClipToBounds="False" CornerRadius="10" Margin="0 5 0 0"> + <Border.Clip> + <RectangleGeometry RadiusX="10" RadiusY="10"> + <RectangleGeometry.Rect> + <MultiBinding Converter="{StaticResource WidthHeightToRectConverter}"> + <Binding ElementName="brush_border" Path="ActualWidth" /> + <Binding ElementName="brush_border" Path="ActualHeight" /> + </MultiBinding> + </RectangleGeometry.Rect> + </RectangleGeometry> + </Border.Clip> + <Grid> + <ItemsControl ClipToBounds="False" ItemsSource="{Binding EffectiveSegments}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel Orientation="Horizontal" ClipToBounds="False"></StackPanel> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <Grid> + <Grid.Width> + <MultiBinding Converter="{StaticResource SegmentLengthToWidthConverter}"> + <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext"></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.Length"></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=ItemsControl}" Path="ActualWidth"></Binding> + <Binding Path="Length"></Binding> + </MultiBinding> + </Grid.Width> + <Rectangle Fill="{Binding SegmentBrush}"></Rectangle> + </Grid> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + + <Rectangle Stroke="{StaticResource TangoGrayBrush}" StrokeThickness="1" StrokeDashArray="5 5 5 5" RadiusX="10" RadiusY="10" /> + </Grid> + </Border> + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml.cs new file mode 100644 index 000000000..0b3ad620e --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Controls/JobSummeryViewer.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.PPC.Jobs.Controls +{ + /// <summary> + /// Interaction logic for JobSummeryViewer.xaml + /// </summary> + public partial class JobSummeryViewer : UserControl + { + public JobSummeryViewer() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/JobView/settings.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/JobView/settings.png Binary files differnew file mode 100644 index 000000000..d7b224819 --- /dev/null +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/JobView/settings.png 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 ee26a0148..e83e1e29b 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 @@ -68,6 +68,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Controls\JobSummeryViewer.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Views\JobsView.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -89,6 +93,9 @@ <Compile Include="..\..\..\Versioning\PPC.cs"> <Link>PPC.cs</Link> </Compile> + <Compile Include="Controls\JobSummeryViewer.xaml.cs"> + <DependentUpon>JobSummeryViewer.xaml</DependentUpon> + </Compile> <Compile Include="Converters\JobCollectionToCategoryCountConverter.cs" /> <Compile Include="Converters\JobToPieImageConverter.cs" /> <Compile Include="JobsModule.cs" /> @@ -215,5 +222,8 @@ <ItemGroup> <Resource Include="Images\JobView\job-summary.png" /> </ItemGroup> + <ItemGroup> + <Resource Include="Images\JobView\settings.png" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs index a9ac604e6..7ecc74c10 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs @@ -11,6 +11,7 @@ using System.Data.Entity; using Tango.Core.Commands; using System.Windows; using Tango.Touch.Controls; +using System.Windows.Media; namespace Tango.PPC.Jobs.ViewModels { @@ -22,6 +23,8 @@ namespace Tango.PPC.Jobs.ViewModels { private ObservablesContext _db; + #region Properties + private Job _job; /// <summary> /// Gets or sets the selected job. @@ -87,31 +90,85 @@ namespace Tango.PPC.Jobs.ViewModels /// </summary> public AutoCompleteProvider<Customer> CustomersAutoCompleteProvider { get; set; } + #endregion + + #region Commands + /// <summary> /// Gets or sets the add solid segment command. /// </summary> public RelayCommand AddSolidSegmentCommand { get; set; } /// <summary> + /// Gets or sets the add gradient segment command. + /// </summary> + public RelayCommand AddGradientSegmentCommand { get; set; } + + /// <summary> + /// Gets or sets the add brush stop command. + /// </summary> + public RelayCommand<Segment> AddBrushStopCommand { get; set; } + + #endregion + + #region Constructors + + /// <summary> /// Initializes a new instance of the <see cref="JobViewVM"/> class. /// </summary> public JobViewVM() { RegisterForMessage<JobSelectedMessage>(HandleJobSelectedMessage); - AddSolidSegmentCommand = new RelayCommand(AddSolidSegment); CustomersAutoCompleteProvider = new AutoCompleteProvider<Customer>((customer, filter) => { - return customer.Name.ToLower().StartsWith(filter.ToLower()); + return customer.Name.ToLower().StartsWith(filter != null ? filter.ToLower() : String.Empty); }); + + //Initialize Commands + AddSolidSegmentCommand = new RelayCommand(() => AddSolidSegment()); + AddBrushStopCommand = new RelayCommand<Segment>(AddBrushStop); + AddGradientSegmentCommand = new RelayCommand(() => AddGradientSegment()); } - private void AddSolidSegment() + #endregion + + #region Segments Management + + /// <summary> + /// Adds a new solid segment. + /// </summary> + private Segment AddSolidSegment() { - MessageBox.Show("SOLID"); + return Job.AddSolidSegment(); } /// <summary> + /// Adds a new gradient segment. + /// </summary> + private Segment AddGradientSegment() + { + return Job.AddGradientSegment(); + } + + #endregion + + #region Brush Stops Management + + /// <summary> + /// Adds a new brush stop to the specified segment. + /// </summary> + /// <param name="segment">The segment.</param> + private void AddBrushStop(Segment segment) + { + segment.AddBrushStop(); + } + + #endregion + + #region Job Selection Message + + /// <summary> /// Handles the job selected message. /// </summary> /// <param name="message">The message.</param> @@ -130,6 +187,10 @@ namespace Tango.PPC.Jobs.ViewModels Customers = _db.Customers.Where(x => x.OrganizationGuid == Job.Machine.Organization.Guid).ToList(); } + #endregion + + #region IPPC ViewModel Overrides + /// <summary> /// Called when the application has been started. /// </summary> @@ -155,5 +216,7 @@ namespace Tango.PPC.Jobs.ViewModels { return NotificationProvider.ShowQuestion("Are you sure you want to exit this job?"); } + + #endregion } } 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 6ac0ee108..1234ed032 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 @@ -26,7 +26,7 @@ namespace Tango.PPC.Jobs.ViewModels /// <seealso cref="Tango.PPC.Common.PPCViewModel" /> public class JobsViewVM : PPCViewModel { - private ObservablesContext _jobsContext; //Holds the db context for the job list. + private ObservablesContext _db; //Holds the db context for the job list. #region Properties @@ -117,6 +117,21 @@ namespace Tango.PPC.Jobs.ViewModels /// </summary> public RelayCommand ClearSelectionCommand { get; set; } + /// <summary> + /// Gets or sets the add job command. + /// </summary> + public RelayCommand AddJobCommand { get; set; } + + /// <summary> + /// Gets or sets the delete jobs command. + /// </summary> + public RelayCommand DeleteJobsCommand { get; set; } + + /// <summary> + /// Gets or sets the clone jobs command. + /// </summary> + public RelayCommand CloneJobsCommand { get; set; } + #endregion #region Constructors @@ -139,6 +154,9 @@ namespace Tango.PPC.Jobs.ViewModels }); ClearSelectionCommand = new RelayCommand(ClearSelection); + AddJobCommand = new RelayCommand(AddNewJob); + DeleteJobsCommand = new RelayCommand(() => DeleteJobs(SelectedJobs)); + CloneJobsCommand = new RelayCommand(() => CloneJobs(SelectedJobs)); } #endregion @@ -196,18 +214,18 @@ namespace Tango.PPC.Jobs.ViewModels Thread.Sleep(500); - if (_jobsContext != null) + if (_db != null) { - _jobsContext.Dispose(); + _db.Dispose(); } - _jobsContext = ObservablesContext.CreateDefault(); + _db = ObservablesContext.CreateDefault(); - var jobs = _jobsContext.Jobs.Where(x => x.Machine.Guid == ApplicationManager.Machine.Guid).ToObservableCollection(); + var jobs = _db.Jobs.Where(x => x.Machine.Guid == ApplicationManager.Machine.Guid).ToObservableCollection(); InvokeUI(() => { - Jobs = _jobsContext.Jobs.Where(x => x.Machine.Guid == ApplicationManager.Machine.Guid).ToObservableCollection(); + Jobs = _db.Jobs.Where(x => x.Machine.Guid == ApplicationManager.Machine.Guid).ToObservableCollection(); JobsCollectionView = CollectionViewSource.GetDefaultView(Jobs); JobsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Job.LastUpdated), ListSortDirection.Descending)); FilterJobCategory(FilterCategory); @@ -221,7 +239,7 @@ namespace Tango.PPC.Jobs.ViewModels /// </summary> public void ClearSelection() { - var a = SelectedJobs; + SelectedJobs.Clear(); IsMultiSelecting = false; } @@ -237,6 +255,84 @@ namespace Tango.PPC.Jobs.ViewModels }; } + /// <summary> + /// Adds a new job. + /// </summary> + private async void AddNewJob() + { + Job job = new Job(); + job.Name = "untitled"; + job.CreationDate = DateTime.UtcNow; + job.JobStatus = JobStatuses.Draft; + job.JobType = JobTypes.Sewing; + job.ColorSpaceGuid = Adapter.ColorSpaces.FirstOrDefault().Guid; + job.MachineGuid = ApplicationManager.Machine.Guid; + job.UserGuid = AuthenticationProvider.CurrentUser.Guid; + job.RmlGuid = Adapter.Rmls.FirstOrDefault().Guid; + job.WindingMethodGuid = Adapter.WindingMethods.FirstOrDefault().Guid; + job.SpoolTypeGuid = Adapter.SpoolTypes.FirstOrDefault().Guid; + + job.AddSolidSegment(); + + _db.Jobs.Add(job); + + await _db.SaveChangesAsync(); + + Jobs.Add(job); + + RaiseMessage(new JobSelectedMessage() { Job = job }); + + await Task.Delay(200); + await NavigationManager.NavigateTo<JobsModule>(nameof(JobView)); + } + + /// <summary> + /// Deletes the specified jobs from db. + /// </summary> + /// <param name="jobs">The jobs.</param> + private async void DeleteJobs(ObservableCollection<Job> jobs) + { + if (await NotificationProvider.ShowQuestion("Are you sure you want to delete the selected jobs")) + { + foreach (var job in jobs) + { + await job.DeleteCascadeAsync(_db); + Jobs.Remove(job); + } + + await _db.SaveChangesAsync(); + ClearSelection(); + } + } + + /// <summary> + /// Clones the specified jobs. + /// </summary> + /// <param name="jobs">The jobs.</param> + private async void CloneJobs(ObservableCollection<Job> jobs) + { + int index = Jobs.Max(x => x.JobIndex); + + List<Job> clonedJobs = new List<Job>(); + + foreach (var job in SelectedJobs) + { + var cloned = job.Clone(); + cloned.JobIndex = ++index; + _db.Jobs.Add(cloned); + clonedJobs.Add(cloned); + } + + await _db.SaveChangesAsync(); + + foreach (var job in clonedJobs) + { + Jobs.Add(job); + } + + ClearSelection(); + } + #endregion #region Override Methods 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 d66005016..4400a7a6e 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 @@ -11,9 +11,10 @@ xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:entities="clr-namespace:Tango.BL.Entities;assembly=Tango.BL" + xmlns:localControls="clr-namespace:Tango.PPC.Jobs.Controls" xmlns:local="clr-namespace:Tango.PPC.Jobs.Views" mc:Ignorable="d" - d:DesignHeight="1280" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:JobViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.JobViewVM}"> + d:DesignHeight="2000" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:JobViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.JobViewVM}"> <UserControl.Resources> <Style TargetType="FrameworkElement" x:Key="Level1Container"> @@ -26,7 +27,30 @@ <Setter Property="Margin" Value="80 40 60 0"></Setter> </Style> - <converters:SegmentToBrushConverter x:Key="SegmentToBrushConverter" /> + <DataTemplate x:Key="RGB_Template" DataType="{x:Type entities:BrushStop}"> + <UniformGrid Rows="1" Columns="3"> + <touch:TouchNumericTextBox Margin="2 0" HorizontalContentAlignment="Center" Value="{Binding Red}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" Maximum="255" /> + <touch:TouchNumericTextBox Margin="2 0" HorizontalContentAlignment="Center" Value="{Binding Green}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" Maximum="255" /> + <touch:TouchNumericTextBox Margin="2 0" HorizontalContentAlignment="Center" Value="{Binding Blue}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" Maximum="255" /> + </UniformGrid> + </DataTemplate> + + <DataTemplate x:Key="CMYK_Template" DataType="{x:Type entities:BrushStop}"> + <UniformGrid Rows="1" Columns="4"> + <touch:TouchNumericTextBox Margin="2 0" HorizontalContentAlignment="Center" Value="{Binding Cyan,Converter={StaticResource OneToPercentConverter}}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Maximum="100" StringFormat="0" /> + <touch:TouchNumericTextBox Margin="2 0" HorizontalContentAlignment="Center" Value="{Binding Magenta,Converter={StaticResource OneToPercentConverter}}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Maximum="100" StringFormat="0" /> + <touch:TouchNumericTextBox Margin="2 0" HorizontalContentAlignment="Center" Value="{Binding Yellow,Converter={StaticResource OneToPercentConverter}}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Maximum="100" StringFormat="0" /> + <touch:TouchNumericTextBox Margin="2 0" HorizontalContentAlignment="Center" Value="{Binding Black,Converter={StaticResource OneToPercentConverter}}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Maximum="100" StringFormat="0" /> + </UniformGrid> + </DataTemplate> + + <DataTemplate x:Key="LAB_Template" DataType="{x:Type entities:BrushStop}"> + <UniformGrid Rows="1" Columns="3"> + <touch:TouchNumericTextBox Margin="2 0" HorizontalContentAlignment="Center" Value="{Binding L}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Minimum="0" Maximum="100" StringFormat="0.00" /> + <touch:TouchNumericTextBox Margin="2 0" HorizontalContentAlignment="Center" Value="{Binding A}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Minimum="-128" Maximum="128" StringFormat="0.00" /> + <touch:TouchNumericTextBox Margin="2 0" HorizontalContentAlignment="Center" Value="{Binding B}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" HasDecimalPoint="True" Minimum="-128" Maximum="128" StringFormat="0.00" /> + </UniformGrid> + </DataTemplate> </UserControl.Resources> <Grid Background="{StaticResource TangoMidBackgroundBrush}"> @@ -129,80 +153,187 @@ <ItemsControl.ItemTemplate> <DataTemplate> <Border Margin="0 0 0 15" CornerRadius="8" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="1" BorderBrush="{StaticResource TangoGrayBrush}"> - <Border.Style> - <Style TargetType="Border"> - <Setter Property="Height" Value="163"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding ElementName=toggle_small_list,Path=IsChecked}" Value="True"> - <Setter Property="Height" Value="74"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </Border.Style> <Border.Effect> <DropShadowEffect Opacity="0.5" Color="{StaticResource TangoDropShadowColor}" BlurRadius="10" ShadowDepth="15" /> </Border.Effect> - - <DockPanel> - <Border DockPanel.Dock="Left" CornerRadius="8 0 0 8" Background="{Binding SegmentBrush}"> - <Border.Style> - <Style TargetType="Border"> - <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight}"></Setter> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="Auto" /> + </Grid.RowDefinitions> + <DockPanel> + <DockPanel.Style> + <Style TargetType="DockPanel"> + <Setter Property="Height" Value="163"></Setter> <Style.Triggers> <DataTrigger Binding="{Binding ElementName=toggle_small_list,Path=IsChecked}" Value="True"> - <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight,Converter={StaticResource MathOperatorConverter},ConverterParameter='*2'}"></Setter> + <Setter Property="Height" Value="74"></Setter> </DataTrigger> </Style.Triggers> </Style> - </Border.Style> - </Border> + </DockPanel.Style> + <Border DockPanel.Dock="Left" Background="{Binding SegmentBrush}"> + <Border.Style> + <Style TargetType="Border"> + <Setter Property="CornerRadius" Value="8 0 0 8"></Setter> + <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight}"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding ElementName=toggle_small_list,Path=IsChecked}" Value="True"> + <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource Self},Path=ActualHeight,Converter={StaticResource MathOperatorConverter},ConverterParameter='*2'}"></Setter> + </DataTrigger> + <MultiDataTrigger> + <MultiDataTrigger.Conditions> + <Condition Binding="{Binding Converter={StaticResource IsSegmentGradientConverter}}" Value="True"></Condition> + <Condition Binding="{Binding ElementName=toggle_large_list,Path=IsChecked}" 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"> - <TextBlock DockPanel.Dock="Top" FontSize="{StaticResource TangoTitleFontSize}"> + <Grid> + <DockPanel Margin="30 0" VerticalAlignment="Center"> + <TextBlock DockPanel.Dock="Top" FontSize="{StaticResource TangoTitleFontSize}"> <Run>Segment #</Run> <Run Text="{Binding SegmentIndex,Mode=OneWay}"></Run> - </TextBlock> + </TextBlock> + + <StackPanel Margin="0 30 0 0" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="300" Visibility="{Binding ElementName=toggle_large_list,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter}}"> + <DockPanel LastChildFill="False"> + <DockPanel.Style> + <Style TargetType="DockPanel"> + <Setter Property="Visibility" Value="Visible"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding Converter={StaticResource IsSegmentGradientConverter}}" Value="True"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </DockPanel.Style> + <TextBlock VerticalAlignment="Center" DockPanel.Dock="Left" Text="Color code:"></TextBlock> + + <Grid DockPanel.Dock="Right" DataContext="{Binding BrushStops[0]}"> + <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" Value="{x:Null}"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.Job.ColorSpace.Name}" Value="RGB"> + <Setter Property="ContentTemplate" Value="{StaticResource RGB_Template}" /> + </DataTrigger> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.Job.ColorSpace.Name}" Value="CMYK"> + <Setter Property="ContentTemplate" Value="{StaticResource CMYK_Template}" /> + </DataTrigger> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.Job.ColorSpace.Name}" Value="LAB"> + <Setter Property="ContentTemplate" Value="{StaticResource LAB_Template}" /> + </DataTrigger> + </Style.Triggers> + </Style> + </ContentControl.Style> + </ContentControl> + </Grid> + </DockPanel> + <DockPanel LastChildFill="False" Margin="0 20 0 0"> + <TextBlock VerticalAlignment="Center" DockPanel.Dock="Left" Text="Length (m):"></TextBlock> + <touch:TouchNumericTextBox Width="180" DockPanel.Dock="Right" Value="{Binding Length}" StringFormat="0.0" AutoCalculateJogStep="False" HasDecimalPoint="True" Maximum="100000" KeyboardContainer="{Binding ElementName=Container}" /> + </DockPanel> + </StackPanel> + </DockPanel> + + <TextBlock Visibility="{Binding ElementName=toggle_small_list,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter}}" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0 0 50 0" Text="{Binding Length,StringFormat={}{0:N1} m}"></TextBlock> + </Grid> + </DockPanel> + + <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}}" Value="True"></Condition> + <Condition Binding="{Binding ElementName=toggle_large_list,Path=IsChecked}" Value="True"></Condition> + </MultiDataTrigger.Conditions> + + <Setter Property="Visibility" Value="Visible"></Setter> + </MultiDataTrigger> + </Style.Triggers> + </Style> + </Border.Style> + + <StackPanel> + <ItemsControl ItemsSource="{Binding BrushStops}"> + <ItemsControl.ItemTemplate> + <DataTemplate> + <Grid Margin="50 20 140 20"> + <StackPanel> + <StackPanel Orientation="Horizontal"> + <Border Width="48" Height="48" CornerRadius="5" BorderThickness="1" BorderBrush="{StaticResource TangoGrayBrush}"> + <Border.Background> + <SolidColorBrush Color="{Binding Color}"></SolidColorBrush> + </Border.Background> + </Border> + + <TextBlock Margin="30 0 0 0" FontSize="{StaticResource TangoTitleFontSize}"> + <Run>#</Run><Run Text="{Binding Segment.SegmentIndex}"></Run><Run>.</Run><Run Text="{Binding StopIndex}"></Run> + </TextBlock> + </StackPanel> + + <DockPanel LastChildFill="False" Margin="0 20 0 0"> + <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"> + <Setter Property="ContentTemplate" Value="{x:Null}"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.Job.ColorSpace.Name}" Value="RGB"> + <Setter Property="ContentTemplate" Value="{StaticResource RGB_Template}" /> + </DataTrigger> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.Job.ColorSpace.Name}" Value="CMYK"> + <Setter Property="ContentTemplate" Value="{StaticResource CMYK_Template}" /> + </DataTrigger> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.Job.ColorSpace.Name}" Value="LAB"> + <Setter Property="ContentTemplate" Value="{StaticResource LAB_Template}" /> + </DataTrigger> + </Style.Triggers> + </Style> + </ContentControl.Style> + </ContentControl> + </DockPanel> + + <DockPanel LastChildFill="False" Margin="0 20 0 0" IsEnabled="{Binding IsMiddle}"> + <TextBlock VerticalAlignment="Bottom" DockPanel.Dock="Left">Position (m):</TextBlock> + <Grid Margin="20 0 0 0" Width="300" DockPanel.Dock="Right"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="1*" /> + <ColumnDefinition Width="2*" /> + </Grid.ColumnDefinitions> - <StackPanel Margin="0 30 0 0" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="300" Visibility="{Binding ElementName=toggle_large_list,Path=IsChecked,Converter={StaticResource BooleanToVisibilityConverter}}"> - <DockPanel LastChildFill="False"> - <TextBlock VerticalAlignment="Center" DockPanel.Dock="Left" Text="Color code:"></TextBlock> + <touch:TouchNumericTextBox Value="{Binding OffsetMeters}" HasDecimalPoint="True" StringFormat="0.0" Maximum="{Binding Segment.Length}" KeyboardContainer="{Binding ElementName=Container}"></touch:TouchNumericTextBox> + <touch:TouchSlider Grid.Column="1" Height="30" Margin="10 0 0 -23" Maximum="{Binding Segment.Length}" Value="{Binding OffsetMeters}" /> + </Grid> + </DockPanel> + </StackPanel> + </Grid> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> - <Grid DockPanel.Dock="Right" DataContext="{Binding BrushStops[0]}"> - <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" Value="{x:Null}"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.Job.ColorSpace.Name}" Value="RGB"> - <Setter Property="ContentTemplate"> - <Setter.Value> - <DataTemplate> - <UniformGrid Rows="1" Columns="3"> - <touch:TouchTextBox Margin="2 0" HorizontalContentAlignment="Center" Text="{Binding Red,UpdateSourceTrigger=PropertyChanged}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" /> - <touch:TouchTextBox Margin="2 0" HorizontalContentAlignment="Center" Text="{Binding Green,UpdateSourceTrigger=PropertyChanged}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" /> - <touch:TouchTextBox Margin="2 0" HorizontalContentAlignment="Center" Text="{Binding Blue,UpdateSourceTrigger=PropertyChanged}" keyboard:KeyboardView.Container="{Binding ElementName=Container}" /> - </UniformGrid> - </DataTemplate> - </Setter.Value> - </Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </ContentControl.Style> - </ContentControl> + <touch:TouchButton Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},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> - </DockPanel> - <DockPanel LastChildFill="False" Margin="0 20 0 0"> - <TextBlock VerticalAlignment="Center" DockPanel.Dock="Left" Text="Length (m):"></TextBlock> - <touch:TouchTextBox Width="180" DockPanel.Dock="Right" Text="{Binding Length,StringFormat=0.0}" /> - </DockPanel> - </StackPanel> - </DockPanel> - <TextBlock HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0 0 50 0" Text="{Binding Length,StringFormat={}{0:N1} m}"></TextBlock> - </Grid> - </DockPanel> + <TextBlock VerticalAlignment="Center" Margin="20 0 0 0">ADD COLOR</TextBlock> + </StackPanel> + </touch:TouchButton> + </StackPanel> + </Border> + </Grid> </Border> </DataTemplate> </ItemsControl.ItemTemplate> @@ -215,7 +346,7 @@ <TextBlock Margin="10 0 0 0">SOLID SEGMENT</TextBlock> </StackPanel> </touch:TouchButton> - <touch:TouchButton FontWeight="Normal" RippleBrush="{StaticResource TangoRippleDarkBrush}" FontSize="{StaticResource TangoDefaultFontSize}" Margin="30 0 0 0" EnableDropShadow="False" Foreground="{StaticResource TangoPrimaryAccentBrush}" Padding="0 10" Width="200" CornerRadius="20" Background="Transparent" BorderThickness="2"> + <touch:TouchButton Command="{Binding AddGradientSegmentCommand}" FontWeight="Normal" RippleBrush="{StaticResource TangoRippleDarkBrush}" FontSize="{StaticResource TangoDefaultFontSize}" Margin="30 0 0 0" EnableDropShadow="False" Foreground="{StaticResource TangoPrimaryAccentBrush}" Padding="0 10" Width="200" CornerRadius="20" Background="Transparent" BorderThickness="2"> <touch:TouchButton.BorderBrush> <LinearGradientBrush> <GradientStop Offset="0" Color="{StaticResource TangoPrimaryAccentColor}" /> @@ -230,10 +361,19 @@ </touch:TouchButton> </StackPanel> - <StackPanel Style="{StaticResource Level2Container}"> - <StackPanel Margin="0 10 0 0"> - <touch:TouchCheckBox HorizontalAlignment="Left" IsChecked="{Binding Job.EnableInterSegment}">Include white gap between segments</touch:TouchCheckBox> - </StackPanel> + <StackPanel Style="{StaticResource Level2ContainerExtraMargin}"> + <DockPanel LastChildFill="False"> + <touch:TouchCheckBox DockPanel.Dock="Left" HorizontalAlignment="Left" IsChecked="{Binding Job.EnableInterSegment}">Include white gap between segments</touch:TouchCheckBox> + <StackPanel DockPanel.Dock="Right" Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0 0 5 0"> + <TextBlock Margin="0 3 0 0" Foreground="{StaticResource TangoGrayTextBrush}"> + <Run Text="Length (m):"></Run> + </TextBlock> + + <touch:TouchNumericTextBox Foreground="{StaticResource TangoGrayTextBrush}" Margin="5 0 0 0" Width="50" HorizontalContentAlignment="Center" Maximum="1000" Value="{Binding Job.InterSegmentLength}" KeyboardContainer="{Binding ElementName=Container}" StringFormat="0" FocusSelectionMode="SelectAll" /> + + <Image Margin="10 0 0 0" Source="../Images/JobView/settings.png" /> + </StackPanel> + </DockPanel> </StackPanel> <Rectangle Stroke="{StaticResource TangoDividerBrush}" Margin="0 30 0 0" /> @@ -255,12 +395,25 @@ </StackPanel> </Border> - <Border Style="{StaticResource TangoTouchBorder}" Margin="0 12 0 0" Padding="0 0 0 40"> + <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> + + <StackPanel Style="{StaticResource Level2ContainerExtraMargin}"> + <Grid> + <localControls:JobSummeryViewer DataContext="{Binding Job}" /> + </Grid> + + <Grid Margin="0 30 0 0"> + <TextBlock> + <Run Text="Job length (m):"></Run> + <Run Text="{Binding Job.Length,Mode=OneWay}"></Run> + </TextBlock> + </Grid> + </StackPanel> </StackPanel> </Border> @@ -300,9 +453,14 @@ <Rectangle Stroke="{StaticResource TangoDividerBrush}" StrokeThickness="1" VerticalAlignment="Top" /> <Border Padding="20 20"> <Grid> - <touch:TouchButton Height="54" Padding="0" Width="184" CornerRadius="30" BlurRadius="20" HorizontalAlignment="Right" Command="{Binding DyeCommand}"> - DYE - </touch:TouchButton> + <DockPanel> + <touch:TouchButton DockPanel.Dock="Right" Height="54" Padding="0" Width="184" CornerRadius="30" BlurRadius="20" HorizontalAlignment="Right" Command="{Binding DyeCommand}"> + DYE + </touch:TouchButton> + + <!--Add this in case you want to display job summery on bottom panel--> + <!--<localControls:JobSummeryViewer DataContext="{Binding Job}" Height="35" Margin="0 -20 30 0" />--> + </DockPanel> </Grid> </Border> </Grid> 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 20f3dc761..0ea6cff81 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 @@ -48,33 +48,37 @@ <RowDefinition Height="1*"/> </Grid.RowDefinitions> - <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top" Height="57" Margin="0 -28 30 0"> - <touch:TouchIconButton Background="{StaticResource TangoLowerAccentBrush}" Command="{Binding ClearSelectionCommand}" Visibility="{Binding IsMultiSelecting,Converter={StaticResource BooleanToVisibilityConverter}}" Margin="0 0 30 0" Padding="20" Icon="Undo"> - <touch:TouchIconButton.Style> - <Style TargetType="touch:TouchIconButton" BasedOn="{StaticResource TangoRoundTouchIconButton}"> - <Setter Property="IconAngle" Value="0"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding IsMultiSelecting}" Value="True"> - <DataTrigger.EnterActions> - <BeginStoryboard> - <Storyboard> - <DoubleAnimation Storyboard.TargetProperty="IconAngle" To="360" Duration="00:00:0.2"></DoubleAnimation> - </Storyboard> - </BeginStoryboard> - </DataTrigger.EnterActions> - <DataTrigger.ExitActions> - <BeginStoryboard> - <Storyboard> - <DoubleAnimation Storyboard.TargetProperty="IconAngle" To="0" Duration="00:00:00"></DoubleAnimation> - </Storyboard> - </BeginStoryboard> - </DataTrigger.ExitActions> - </DataTrigger> - </Style.Triggers> - </Style> - </touch:TouchIconButton.Style> - </touch:TouchIconButton> - <touch:TouchIconButton Visibility="{Binding IsMultiSelecting,Converter={StaticResource BooleanToVisibilityInverseConverter}}" Margin="0 0 30 0" Padding="20" Icon="Plus"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0 -28 30 0"> + <StackPanel Orientation="Horizontal" Height="58" Visibility="{Binding ElementName=dataGridJobs,Path=IsMultiSelecting,Converter={StaticResource BooleanToVisibilityConverter}}"> + <touch:TouchIconButton Command="{Binding ClearSelectionCommand}" Visibility="{Binding IsMultiSelecting,Converter={StaticResource BooleanToVisibilityConverter}}" Margin="0 0 30 0" Padding="20" Icon="Undo"> + <touch:TouchIconButton.Style> + <Style TargetType="touch:TouchIconButton" BasedOn="{StaticResource TangoRoundTouchIconButton}"> + <Setter Property="IconAngle" Value="0"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsMultiSelecting}" Value="True"> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="IconAngle" To="360" Duration="00:00:0.2"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation Storyboard.TargetProperty="IconAngle" To="0" Duration="00:00:00"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </touch:TouchIconButton.Style> + </touch:TouchIconButton> + <touch:TouchIconButton Command="{Binding CloneJobsCommand}" Margin="0 0 30 0" Padding="20" Icon="Copy" Style="{StaticResource TangoRoundTouchIconButton}"></touch:TouchIconButton> + <touch:TouchIconButton Command="{Binding DeleteJobsCommand}" Padding="20" Icon="TrashOutline" Style="{StaticResource TangoRoundTouchIconButton}"></touch:TouchIconButton> + </StackPanel> + <touch:TouchIconButton Command="{Binding AddJobCommand}" Visibility="{Binding IsMultiSelecting,Converter={StaticResource BooleanToVisibilityInverseConverter}}" Margin="0 -15 0 0" Padding="20" Height="80" Icon="Plus"> <touch:TouchIconButton.Style> <Style TargetType="touch:TouchIconButton" BasedOn="{StaticResource TangoRoundTouchIconButton}"> <Setter Property="IconAngle" Value="0"></Setter> @@ -99,8 +103,6 @@ </Style> </touch:TouchIconButton.Style> </touch:TouchIconButton> - <touch:TouchIconButton Margin="0 0 30 0" Padding="20" Icon="Copy" Style="{StaticResource TangoRoundTouchIconButton}"></touch:TouchIconButton> - <touch:TouchIconButton Padding="20" Icon="Refresh" Style="{StaticResource TangoRoundTouchIconButton}"></touch:TouchIconButton> </StackPanel> <touch:TouchNavigationLinks SelectedValue="{Binding FilterCategory}" SelectedValuePath="Value" ItemsSource="{Binding Source={x:Type enumerations:JobCategories},Converter={StaticResource EnumToItemsSourceConverter},Mode=OneTime}" IsEnabled="{Binding IsMultiSelecting,Converter={StaticResource BooleanInverseConverter}}" VerticalAlignment="Bottom" Margin="20" FontSize="{StaticResource TangoNavigationLinksFontSize}"> |
