aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-12-25 18:23:36 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-12-25 18:23:36 +0200
commitd3657451afb8e4ca8dde67164d65cba853335a71 (patch)
treeea7a5a31df33fc18371008b4e2a157e5d9d5f019 /Software/Visual_Studio
parentaf48e6f711ecdeae4c3a921656531e61703b70b0 (diff)
downloadTango-d3657451afb8e4ca8dde67164d65cba853335a71.tar.gz
Tango-d3657451afb8e4ca8dde67164d65cba853335a71.zip
A lot of work on PPC UI & logic changes !
Diffstat (limited to 'Software/Visual_Studio')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Converters/JobCollectionToCategoryCountConverter.cs39
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Converters/JobsCategoryToVisibilityConverter.cs28
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/color_approved_small.pngbin0 -> 1560 bytes
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/color_approved_small_gray.pngbin0 -> 1371 bytes
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/sample_approved_small.pngbin0 -> 1559 bytes
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/sample_approved_small_gray.pngbin0 -> 1414 bytes
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Tango.PPC.Jobs.csproj10
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs84
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml127
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml.cs8
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs3
-rw-r--r--Software/Visual_Studio/Tango.BL/Attributes/JobStatusAttribute.cs25
-rw-r--r--Software/Visual_Studio/Tango.BL/EntitiesExtensions/Job.cs26
-rw-r--r--Software/Visual_Studio/Tango.BL/Enumerations/JobCategories.cs19
-rw-r--r--Software/Visual_Studio/Tango.BL/Enumerations/JobStatuses.cs4
-rw-r--r--Software/Visual_Studio/Tango.BL/Tango.BL.csproj5
-rw-r--r--Software/Visual_Studio/Tango.Touch/Controls/LightTouchDataGrid.xaml2
17 files changed, 207 insertions, 173 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Converters/JobCollectionToCategoryCountConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Converters/JobCollectionToCategoryCountConverter.cs
deleted file mode 100644
index 4f91866b9..000000000
--- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Converters/JobCollectionToCategoryCountConverter.cs
+++ /dev/null
@@ -1,39 +0,0 @@
-using System;
-using System.Collections;
-using System.Collections.Generic;
-using System.Globalization;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Data;
-using Tango.BL.Entities;
-using Tango.BL.Enumerations;
-
-namespace Tango.PPC.Jobs.Converters
-{
- /// <summary>
- /// Filters the job collection by the specified <see cref="JobCategories"/>.
- /// </summary>
- /// <seealso cref="System.Windows.Data.IMultiValueConverter" />
- public class JobCollectionToCategoryCountConverter : IMultiValueConverter
- {
- public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
- {
- IList<Job> jobs = values[0] as IList<Job>;
-
- JobCategories category = (JobCategories)values[1];
-
- if (jobs != null)
- {
- return jobs.Where(x => x.JobCategories.Contains(category)).Count().ToString();
- }
-
- return "0";
- }
-
- public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
-}
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Converters/JobsCategoryToVisibilityConverter.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Converters/JobsCategoryToVisibilityConverter.cs
new file mode 100644
index 000000000..e602a99fc
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Converters/JobsCategoryToVisibilityConverter.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Data;
+using static Tango.PPC.Jobs.ViewModels.JobsViewVM;
+
+namespace Tango.PPC.Jobs.Converters
+{
+ public class JobsCategoryToVisibilityConverter : 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) ? Visibility.Visible : Visibility.Collapsed;
+ }
+
+ 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/Images/color_approved_small.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/color_approved_small.png
new file mode 100644
index 000000000..e29b5fb67
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/color_approved_small.png
Binary files differ
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/color_approved_small_gray.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/color_approved_small_gray.png
new file mode 100644
index 000000000..828379648
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/color_approved_small_gray.png
Binary files differ
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/sample_approved_small.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/sample_approved_small.png
new file mode 100644
index 000000000..6e4e56fe0
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/sample_approved_small.png
Binary files differ
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/sample_approved_small_gray.png b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/sample_approved_small_gray.png
new file mode 100644
index 000000000..edf3bf0dd
--- /dev/null
+++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Images/sample_approved_small_gray.png
Binary files differ
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 242fbee53..6830f2ec5 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
@@ -156,8 +156,8 @@
<Compile Include="Controls\TwineCatalogViewer.xaml.cs">
<DependentUpon>TwineCatalogViewer.xaml</DependentUpon>
</Compile>
- <Compile Include="Converters\JobCollectionToCategoryCountConverter.cs" />
<Compile Include="Converters\JobProgressToPositionConverter.cs" />
+ <Compile Include="Converters\JobsCategoryToVisibilityConverter.cs" />
<Compile Include="Converters\JobToPieImageConverter.cs" />
<Compile Include="Converters\JobTypeToImageConverter.cs" />
<Compile Include="Dialogs\AdvancedColorCorrectionView.xaml.cs">
@@ -383,6 +383,14 @@
<ItemGroup>
<Resource Include="Images\spool_replace.png" />
</ItemGroup>
+ <ItemGroup>
+ <Resource Include="Images\color_approved_small.png" />
+ <Resource Include="Images\sample_approved_small.png" />
+ </ItemGroup>
+ <ItemGroup>
+ <Resource Include="Images\color_approved_small_gray.png" />
+ <Resource Include="Images\sample_approved_small_gray.png" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<ProjectExtensions>
<VisualStudio>
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 03644bdee..32e8a16be 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
@@ -39,6 +39,12 @@ namespace Tango.PPC.Jobs.ViewModels
{
private ObservablesContext _db; //Holds the db context for the job list.
+ public enum JobsCategory
+ {
+ Draft,
+ History
+ }
+
#region Properties
private ObservableCollection<Job> _jobs;
@@ -51,16 +57,30 @@ namespace Tango.PPC.Jobs.ViewModels
set { _jobs = value; RaisePropertyChangedAuto(); }
}
- private ICollectionView _jobsCollectionView;
+ private ICollectionView _draftJobsCollectionView;
/// <summary>
/// Gets or sets the jobs collection view.
/// </summary>
- public ICollectionView JobsCollectionView
+ public ICollectionView DraftJobsCollectionView
{
- get { return _jobsCollectionView; }
+ get { return _draftJobsCollectionView; }
set
{
- _jobsCollectionView = value;
+ _draftJobsCollectionView = value;
+ RaisePropertyChangedAuto();
+ }
+ }
+
+ private ICollectionView _historyJobsCollectionView;
+ /// <summary>
+ /// Gets or sets the jobs collection view.
+ /// </summary>
+ public ICollectionView HistoryJobsCollectionView
+ {
+ get { return _historyJobsCollectionView; }
+ set
+ {
+ _historyJobsCollectionView = value;
RaisePropertyChangedAuto();
}
}
@@ -95,17 +115,30 @@ namespace Tango.PPC.Jobs.ViewModels
set { _isMultiSelecting = value; RaisePropertyChangedAuto(); }
}
- private JobCategories _filterCategory;
+ private int _selectedCategoryIndex;
/// <summary>
- /// Gets or sets the filter category.
+ /// Gets or sets the index of the selected category.
/// </summary>
- public JobCategories FilterCategory
+ public int SelectedCategoryIndex
{
- get { return _filterCategory; }
+ get { return _selectedCategoryIndex; }
set
{
- _filterCategory = value; RaisePropertyChangedAuto();
- FilterJobCategory(value);
+ _selectedCategoryIndex = value;
+ RaisePropertyChangedAuto();
+ RaisePropertyChanged(nameof(SelectedCategory));
+ }
+ }
+
+ /// <summary>
+ /// Gets or sets the selected category.
+ /// </summary>
+ public JobsCategory SelectedCategory
+ {
+ get { return (JobsCategory)SelectedCategoryIndex; }
+ set
+ {
+ SelectedCategoryIndex = value.ToInt32();
}
}
@@ -208,7 +241,7 @@ namespace Tango.PPC.Jobs.ViewModels
job.JobIndex = index++;
}
- JobsCollectionView.Refresh();
+ DraftJobsCollectionView.Refresh();
}
#endregion
@@ -256,9 +289,15 @@ namespace Tango.PPC.Jobs.ViewModels
InvokeUI(() =>
{
Jobs = jobs;
- JobsCollectionView = CollectionViewSource.GetDefaultView(Jobs);
- JobsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Job.LastUpdated), ListSortDirection.Descending));
- FilterJobCategory(FilterCategory);
+ DraftJobsCollectionView = new ListCollectionView(Jobs);
+ DraftJobsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Job.LastUpdated), ListSortDirection.Ascending));
+ DraftJobsCollectionView.Filter = new Predicate<object>(x => (x as Job).JobStatus == JobStatuses.Draft);
+
+
+ HistoryJobsCollectionView = new ListCollectionView(Jobs);
+ HistoryJobsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Job.LastUpdated), ListSortDirection.Ascending));
+ HistoryJobsCollectionView.Filter = new Predicate<object>(x => (x as Job).JobStatus != JobStatuses.Draft);
+
IsLoadingJobs = false;
LogManager.Log("Machine jobs loaded!");
onCompleted?.Invoke();
@@ -282,18 +321,6 @@ namespace Tango.PPC.Jobs.ViewModels
}
/// <summary>
- /// Filters the jobs list by the specified <see cref="JobCategories">job category</see>.
- /// </summary>
- /// <param name="jobCategory">The job category.</param>
- public void FilterJobCategory(JobCategories jobCategory)
- {
- JobsCollectionView.Filter = (job) =>
- {
- return (job as Job).JobCategories.Contains(jobCategory);
- };
- }
-
- /// <summary>
/// Adds a new job.
/// </summary>
private async void AddNewJob()
@@ -359,6 +386,11 @@ namespace Tango.PPC.Jobs.ViewModels
job.RmlGuid = machine.DefaultRml != null ? machine.DefaultRmlGuid : Adapter.Rmls.FirstOrDefault().Guid;
job.WindingMethodGuid = Adapter.WindingMethods.FirstOrDefault().Guid;
job.SpoolTypeGuid = machine.DefaultSpoolType != null ? machine.DefaultSpoolTypeGuid : Adapter.SpoolTypes.FirstOrDefault().Guid;
+
+ if (Jobs.Count > 0)
+ {
+ job.JobIndex = Jobs.Max(x => x.JobIndex) + 1;
+ }
job.AddSolidSegment(machine.DefaultSegmentLength > 0 ? machine.DefaultSegmentLength : 10);
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 89feb8dc3..b02de80fc 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
@@ -31,7 +31,7 @@
<sharedConverters:DateTimeUTCToShortDateConverter x:Key="DateTimeUTCToShortDateConverter" />
<sharedConverters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter" />
<sharedConverters:EnumToItemsSourceConverter x:Key="EnumToItemsSourceConverter" />
- <converters:JobCollectionToCategoryCountConverter x:Key="JobCollectionToCategoryCountConverter" />
+ <converters:JobsCategoryToVisibilityConverter x:Key="JobsCategoryToVisibilityConverter" />
</ResourceDictionary>
</UserControl.Resources>
@@ -112,43 +112,47 @@
</touch:TouchIconButton>
</StackPanel>
- <touch:TouchNavigationLinks SelectionChanged="TouchNavigationLinks_SelectionChanged" 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}">
- <touch:TouchNavigationLinks.ItemTemplate>
- <DataTemplate>
- <TextBlock>
- <Run Text="{Binding DisplayName,Mode=OneWay}"></Run>
- <Run>(</Run><Run>
- <Run.Text>
- <MultiBinding Converter="{StaticResource JobCollectionToCategoryCountConverter}">
- <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.Jobs" />
- <Binding Path="Value" Mode="OneWay"></Binding>
- <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.Jobs.Count" Mode="OneWay" />
- </MultiBinding>
- </Run.Text>
- </Run><Run>)</Run>
- </TextBlock>
- </DataTemplate>
- </touch:TouchNavigationLinks.ItemTemplate>
+ <touch:TouchNavigationLinks x:Name="navigationLinks" SelectionChanged="TouchNavigationLinks_SelectionChanged" SelectedIndex="{Binding SelectedCategoryIndex,Mode=TwoWay}" IsEnabled="{Binding IsMultiSelecting,Converter={StaticResource BooleanInverseConverter}}" VerticalAlignment="Bottom" Margin="20" FontSize="{StaticResource TangoNavigationLinksFontSize}">
+ <TextBlock>DRAFT</TextBlock>
+ <TextBlock>HISTORY</TextBlock>
</touch:TouchNavigationLinks>
<Grid Grid.Row="1" x:Name="moveGrid">
- <touch:TouchLoadingPanel IsLoading="{Binding IsLoadingJobs}">
- <touch:LightTouchDataGrid RenderOptions.EdgeMode="Unspecified" Style="{StaticResource TangoJobsGrid}" x:Name="dataGridJobs" SelectedItems="{Binding SelectedJobs}" IsMultiSelecting="{Binding IsMultiSelecting,Mode=TwoWay}" OnDragAndDropCommand="{Binding JobDragedDroppedCommand}" ItemsSource="{Binding JobsCollectionView}" ItemSelectedCommand="{Binding JobSelectedCommand}" Margin="10">
+ <touch: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.Columns>
- <touch:LightTouchDataGridColumn Width="50">
+ <touch:LightTouchDataGridColumn Width="90">
<touch:LightTouchDataGridColumn.Header>
<Image Source="../Images/warning.png" Width="24" />
</touch:LightTouchDataGridColumn.Header>
<touch:LightTouchDataGridColumn.CellTemplate>
<DataTemplate>
- <Image Source="../Images/Job Issues/cyan.png" Width="38" />
- </DataTemplate>
- </touch:LightTouchDataGridColumn.CellTemplate>
- </touch:LightTouchDataGridColumn>
- <touch:LightTouchDataGridColumn Width="100" Header="Status" SortMember="JobStatus">
- <touch:LightTouchDataGridColumn.CellTemplate>
- <DataTemplate>
- <TextBlock IsHitTestVisible="False" Text="{Binding JobStatus,Converter={StaticResource EnumToDescriptionConverter}}"></TextBlock>
+ <Grid Margin="5 0 0 0" Width="40" Height="40">
+ <Image HorizontalAlignment="Left" VerticalAlignment="Top" Width="20">
+ <Image.Style>
+ <Style TargetType="Image">
+ <Setter Property="Source" Value="../Images/sample_approved_small_gray.png"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding JobSampleDyeStatus}" Value="Approved">
+ <Setter Property="Source" Value="../Images/sample_approved_small.png"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Image.Style>
+ </Image>
+ <Image HorizontalAlignment="Right" VerticalAlignment="Bottom" Width="20">
+ <Image.Style>
+ <Style TargetType="Image">
+ <Setter Property="Source" Value="../Images/color_approved_small_gray.png"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding JobFineTuningStatus}" Value="Approved">
+ <Setter Property="Source" Value="../Images/color_approved_small.png"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Image.Style>
+ </Image>
+ </Grid>
</DataTemplate>
</touch:LightTouchDataGridColumn.CellTemplate>
</touch:LightTouchDataGridColumn>
@@ -225,6 +229,71 @@
</touch:LightTouchDataGrid.Columns>
</touch:LightTouchDataGrid>
</touch:TouchLoadingPanel>
+
+ <touch:TouchLoadingPanel IsLoading="{Binding IsLoadingJobs}">
+ <touch:LightTouchDataGrid AnimateSorting="False" RenderOptions.EdgeMode="Unspecified" x:Name="dataGridJobsHistory" Visibility="{Binding SelectedCategory,Converter={StaticResource JobsCategoryToVisibilityConverter},ConverterParameter='History'}" 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>
+ <Image Source="../Images/warning.png" Width="24" />
+ </touch:LightTouchDataGridColumn.Header>
+ <touch:LightTouchDataGridColumn.CellTemplate>
+ <DataTemplate>
+ <touch:TouchIcon Width="26">
+ <touch:TouchIcon.Style>
+ <Style TargetType="touch:TouchIcon">
+ <Setter Property="Icon" Value="Check"></Setter>
+ <Setter Property="Foreground" Value="{StaticResource TangoSuccessBrush}"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding JobStatus}" Value="Disrupted">
+ <Setter Property="Icon" Value="AlertCircleOutline"></Setter>
+ <Setter Property="Foreground" Value="{StaticResource TangoWarningBrush}"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </touch:TouchIcon.Style>
+ </touch:TouchIcon>
+ </DataTemplate>
+ </touch:LightTouchDataGridColumn.CellTemplate>
+ </touch:LightTouchDataGridColumn>
+ <touch:LightTouchDataGridColumn Width="100" Header="Status" SortMember="JobStatus">
+ <touch:LightTouchDataGridColumn.CellTemplate>
+ <DataTemplate>
+ <TextBlock IsHitTestVisible="False" Text="{Binding JobStatus,Converter={StaticResource EnumToDescriptionConverter}}"></TextBlock>
+ </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>
+ </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>
+ </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>
+ </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>
+ </DataTemplate>
+ </touch:LightTouchDataGridColumn.CellTemplate>
+ </touch:LightTouchDataGridColumn>
+ </touch:LightTouchDataGrid.Columns>
+ </touch:LightTouchDataGrid>
+ </touch:TouchLoadingPanel>
</Grid>
</Grid>
</Grid>
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 efd4ec64e..d8ef4056c 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
@@ -25,11 +25,17 @@ namespace Tango.PPC.Jobs.Views
InitializeComponent();
}
- private void TouchNavigationLinks_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ private async void TouchNavigationLinks_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (dataGridJobs != null)
{
+ await Task.Delay(200);
+
+ dataGridJobs.LayoutRows(false);
dataGridJobs.ScrollViewer.ScrollToTop();
+
+ dataGridJobsHistory.LayoutRows(false);
+ dataGridJobsHistory.ScrollViewer.ScrollToTop();
}
}
}
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs
index 347701c6e..d6770ed45 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Printing/DefaultPrintingManager.cs
@@ -69,8 +69,7 @@ namespace Tango.PPC.UI.Printing
{
try
{
-
- job.JobStatus = BL.Enumerations.JobStatuses.Disrupted;
+ //No change in status !
await context.SaveChangesAsync();
RaiseJobSaved(job);
}
diff --git a/Software/Visual_Studio/Tango.BL/Attributes/JobStatusAttribute.cs b/Software/Visual_Studio/Tango.BL/Attributes/JobStatusAttribute.cs
deleted file mode 100644
index 71256b414..000000000
--- a/Software/Visual_Studio/Tango.BL/Attributes/JobStatusAttribute.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Tango.BL.Enumerations;
-
-namespace Tango.BL.Attributes
-{
- [AttributeUsage(AttributeTargets.Field)]
- public class JobStatusAttribute : Attribute
- {
- public List<JobCategories> Categories { get; set; }
-
- public JobStatusAttribute()
- {
- Categories = new List<JobCategories>();
- }
-
- public JobStatusAttribute(params JobCategories[] categories)
- {
- Categories = categories.ToList();
- }
- }
-}
diff --git a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Job.cs b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Job.cs
index 6ae2f1daf..b819ccf28 100644
--- a/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Job.cs
+++ b/Software/Visual_Studio/Tango.BL/EntitiesExtensions/Job.cs
@@ -10,7 +10,6 @@ using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media.Imaging;
-using Tango.BL.Attributes;
using Tango.BL.Builders;
using Tango.BL.Enumerations;
using Tango.Core;
@@ -89,28 +88,7 @@ namespace Tango.BL.Entities
public JobStatuses JobStatus
{
get { return (JobStatuses)Status; }
- set { Status = value.ToInt32(); RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(JobCategories)); }
- }
-
- /// <summary>
- /// Gets the collection of <see cref="JobCategories">job categories</see> which is generated by the <see cref="JobStatus"/>.
- /// </summary>
- [NotMapped]
- [JsonIgnore]
- public List<JobCategories> JobCategories
- {
- get
- {
- try
- {
- return typeof(JobStatuses).GetField(JobStatus.ToString()).GetCustomAttribute<JobStatusAttribute>().Categories;
- }
- catch
- {
- //LogManager.Log(ex, LogCategory.Warning);
- return new List<JobCategories>() { Enumerations.JobCategories.Draft };
- }
- }
+ set { Status = value.ToInt32(); RaisePropertyChangedAuto(); }
}
/// <summary>
@@ -336,10 +314,10 @@ namespace Tango.BL.Entities
cloned.LastRun = null;
cloned.ColorSpace = ColorSpace;
cloned.Customer = Customer;
- cloned.LastRun = null;
cloned.Rml = Rml;
cloned.SpoolType = SpoolType;
cloned.WindingMethod = WindingMethod;
+ cloned.JobStatus = JobStatuses.Draft;
cloned.Segments = Segments.Select(x => x.Clone(cloned)).ToSynchronizedObservableCollection();
foreach (var segment in cloned.Segments)
diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/JobCategories.cs b/Software/Visual_Studio/Tango.BL/Enumerations/JobCategories.cs
deleted file mode 100644
index db5c8c15a..000000000
--- a/Software/Visual_Studio/Tango.BL/Enumerations/JobCategories.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.BL.Enumerations
-{
- public enum JobCategories
- {
- [Description("DRAFT")]
- Draft,
- [Description("COMPLETED")]
- Completed,
- [Description("DISRUPTED")]
- Disrupted,
- }
-}
diff --git a/Software/Visual_Studio/Tango.BL/Enumerations/JobStatuses.cs b/Software/Visual_Studio/Tango.BL/Enumerations/JobStatuses.cs
index 9857f664e..546ecca67 100644
--- a/Software/Visual_Studio/Tango.BL/Enumerations/JobStatuses.cs
+++ b/Software/Visual_Studio/Tango.BL/Enumerations/JobStatuses.cs
@@ -4,24 +4,20 @@ using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-using Tango.BL.Attributes;
namespace Tango.BL.Enumerations
{
public enum JobStatuses
{
//Draft
- [JobStatus(JobCategories.Draft)]
[Description("Draft")]
Draft,
//Completed
- [JobStatus(JobCategories.Completed)]
[Description("Completed")]
Completed,
//Disrupted
- [JobStatus(JobCategories.Disrupted)]
[Description("Disrupted")]
Disrupted,
}
diff --git a/Software/Visual_Studio/Tango.BL/Tango.BL.csproj b/Software/Visual_Studio/Tango.BL/Tango.BL.csproj
index 1d2d60604..e5f187de6 100644
--- a/Software/Visual_Studio/Tango.BL/Tango.BL.csproj
+++ b/Software/Visual_Studio/Tango.BL/Tango.BL.csproj
@@ -81,7 +81,6 @@
<Compile Include="..\Versioning\GlobalVersionInfo.cs">
<Link>GlobalVersionInfo.cs</Link>
</Compile>
- <Compile Include="Attributes\JobStatusAttribute.cs" />
<Compile Include="Builders\ConfigurationBuilder.cs" />
<Compile Include="Builders\EntityBuilderBase.cs" />
<Compile Include="Builders\EntityCollectionBuilderBase.cs" />
@@ -155,7 +154,6 @@
<Compile Include="Enumerations\HardwareWinderTypes.cs" />
<Compile Include="Enumerations\HtmlPages.cs" />
<Compile Include="Enumerations\Ios.cs" />
- <Compile Include="Enumerations\JobCategories.cs" />
<Compile Include="Enumerations\JobDesignations.cs" />
<Compile Include="Enumerations\JobRunStatus.cs" />
<Compile Include="Enumerations\JobStatuses.cs" />
@@ -340,6 +338,9 @@
<Name>Tango.Settings</Name>
</ProjectReference>
</ItemGroup>
+ <ItemGroup>
+ <Folder Include="Attributes\" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\System.Data.SQLite.Core.1.0.108.0\build\net46\System.Data.SQLite.Core.targets" Condition="Exists('..\packages\System.Data.SQLite.Core.1.0.108.0\build\net46\System.Data.SQLite.Core.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
diff --git a/Software/Visual_Studio/Tango.Touch/Controls/LightTouchDataGrid.xaml b/Software/Visual_Studio/Tango.Touch/Controls/LightTouchDataGrid.xaml
index b8a3bd7a6..7e5b986e9 100644
--- a/Software/Visual_Studio/Tango.Touch/Controls/LightTouchDataGrid.xaml
+++ b/Software/Visual_Studio/Tango.Touch/Controls/LightTouchDataGrid.xaml
@@ -221,7 +221,7 @@
</ItemsControl.ItemsPanel>
<ItemsControl.ItemContainerStyle>
<Style TargetType="FrameworkElement">
- <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource AncestorType=local:LightTouchDataGrid},Path=ActualWidth}"></Setter>
+ <Setter Property="Width" Value="{Binding RelativeSource={RelativeSource AncestorType=Canvas},Path=ActualWidth}"></Setter>
</Style>
</ItemsControl.ItemContainerStyle>
<ItemsControl.ItemTemplate>