aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/PPC
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-03-04 21:34:15 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-03-04 21:34:15 +0200
commit9ff3a5b95ae353fab5b29b75a786a6ae8964ba1b (patch)
treed53c9b2e2f1a8bdcd91671dbed0eaadb24d133b7 /Software/Visual_Studio/PPC
parentfc8f4f7a358640f8f6495397f822320f87018d04 (diff)
downloadTango-9ff3a5b95ae353fab5b29b75a786a6ae8964ba1b.tar.gz
Tango-9ff3a5b95ae353fab5b29b75a786a6ae8964ba1b.zip
Improvements to PPC !!
Diffstat (limited to 'Software/Visual_Studio/PPC')
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobViewVM.cs16
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/ViewModels/JobsViewVM.cs62
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobView.xaml2
-rw-r--r--Software/Visual_Studio/PPC/Modules/Tango.PPC.Jobs/Views/JobsView.xaml18
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Images/logo.pngbin31115 -> 14211 bytes
-rw-r--r--Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml4
6 files changed, 91 insertions, 11 deletions
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 042272960..f0cf87079 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
@@ -486,6 +486,22 @@ namespace Tango.PPC.Jobs.ViewModels
{
LogManager.Log("Saving job...");
+ if (!String.IsNullOrWhiteSpace(CustomersFilter))
+ {
+ if (!Customers.Exists(x => x.Name == CustomersFilter))
+ {
+ var newCustomer = new Customer()
+ {
+ OrganizationGuid = MachineProvider.Machine.OrganizationGuid,
+ Name = CustomersFilter,
+ };
+
+ _db.Customers.Add(newCustomer);
+
+ Job.Customer = newCustomer;
+ }
+ }
+
await _db.SaveChangesAsync();
RaiseMessage(new JobSavedMessage() { Job = Job });
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 30f444a6f..d29323412 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
@@ -127,6 +127,7 @@ namespace Tango.PPC.Jobs.ViewModels
_selectedCategoryIndex = value;
RaisePropertyChangedAuto();
RaisePropertyChanged(nameof(SelectedCategory));
+ Filter = null;
}
}
@@ -138,10 +139,24 @@ namespace Tango.PPC.Jobs.ViewModels
get { return (JobsCategory)SelectedCategoryIndex; }
set
{
- SelectedCategoryIndex = value.ToInt32();
+ if (SelectedCategoryIndex != value.ToInt32())
+ {
+ SelectedCategoryIndex = value.ToInt32();
+ Filter = null;
+ }
}
}
+ private String _filter;
+ /// <summary>
+ /// Gets or sets the search filter.
+ /// </summary>
+ public String Filter
+ {
+ get { return _filter; }
+ set { _filter = value; RaisePropertyChangedAuto(); OnFilterChanged(); }
+ }
+
#endregion
#region Commands
@@ -284,19 +299,43 @@ namespace Tango.PPC.Jobs.ViewModels
_db = ObservablesContext.CreateDefault();
- var jobs = new JobsCollectionBuilder(_db).Set(x => x.MachineGuid == MachineProvider.Machine.Guid).WithSegments().WithBrushStops().Build();
+ var jobs = new JobsCollectionBuilder(_db).Set(x => x.MachineGuid == MachineProvider.Machine.Guid).WithSegments().WithBrushStops().WithCustomer().Build();
InvokeUI(() =>
{
Jobs = jobs;
DraftJobsCollectionView = new ListCollectionView(Jobs);
DraftJobsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Job.LastUpdated), ListSortDirection.Descending));
- DraftJobsCollectionView.Filter = new Predicate<object>(x => (x as Job).JobStatus == JobStatuses.Draft);
+ 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)));
+ }
+ });
HistoryJobsCollectionView = new ListCollectionView(Jobs);
HistoryJobsCollectionView.SortDescriptions.Add(new SortDescription(nameof(Job.LastUpdated), ListSortDirection.Descending));
- HistoryJobsCollectionView.Filter = new Predicate<object>(x => (x as Job).JobStatus != JobStatuses.Draft);
+ 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)));
+ }
+ });
IsLoadingJobs = false;
LogManager.Log("Machine jobs loaded!");
@@ -485,6 +524,21 @@ namespace Tango.PPC.Jobs.ViewModels
}
}
+ /// <summary>
+ /// Called when the search filter has been changed
+ /// </summary>
+ private void OnFilterChanged()
+ {
+ if (SelectedCategory == JobsCategory.Draft)
+ {
+ DraftJobsCollectionView.Refresh();
+ }
+ else if (SelectedCategory == JobsCategory.History)
+ {
+ HistoryJobsCollectionView.Refresh();
+ }
+ }
+
#endregion
#region Message Handling
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 5cefce5c2..b6dcad145 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
@@ -388,7 +388,7 @@
<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 Text="{Binding CustomersFilter}" ItemsSource="{Binding Customers}" SelectedItem="{Binding Job.Customer}" DisplayMemberPath="Name" AutoCompleteProvider="{Binding CustomersAutoCompleteProvider}" KeyboardMode="AlphaNumeric" KeyboardAction="Next" KeyboardContainer="{Binding ElementName=Container}" />
+ <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" />
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 b02de80fc..01d0c86a2 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
@@ -112,10 +112,20 @@
</touch:TouchIconButton>
</StackPanel>
- <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>
+ <DockPanel>
+ <touch:TouchNavigationLinks DockPanel.Dock="Left" 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 VerticalAlignment="Center" HorizontalAlignment="Left" Margin="0 5 0 0">
+ <DockPanel>
+ <Rectangle Margin="0 0 20 0" HorizontalAlignment="Center" VerticalAlignment="Bottom" Stroke="{StaticResource TangoGrayBrush}" StrokeThickness="1" Height="25"></Rectangle>
+ <touch:TouchIcon DockPanel.Dock="Left" Foreground="{StaticResource TangoGrayBrush}" Width="20" Height="20" VerticalAlignment="Bottom" Icon="Magnify" />
+ <touch:TouchTextBox Margin="5 0 0 0" Width="300" Text="{Binding Filter,Mode=TwoWay}" Watermark="find name, customer..."></touch:TouchTextBox>
+ </DockPanel>
+ </Grid>
+ </DockPanel>
<Grid Grid.Row="1" x:Name="moveGrid">
<touch:TouchLoadingPanel IsLoading="{Binding IsLoadingJobs}" Visibility="{Binding SelectedCategory,Converter={StaticResource JobsCategoryToVisibilityConverter},ConverterParameter='Draft'}">
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/logo.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/logo.png
index 9c9eb4abf..b49838e37 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/logo.png
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/logo.png
Binary files differ
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml
index 0a6919fbf..2743e5126 100644
--- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml
+++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutView.xaml
@@ -29,7 +29,7 @@
<DockPanel LastChildFill="False" Background="{StaticResource TangoPrimaryBackgroundBrush}">
<StackPanel MinWidth="300" DockPanel.Dock="Top">
<Border BorderBrush="{StaticResource TangoDividerBrush}" BorderThickness="0 0 0 1">
- <Grid Background="{StaticResource TangoMidBackgroundBrush}">
+ <Grid>
<Image Source="/Images/logo.png" Stretch="Uniform" Margin="20 50 50 50"></Image>
<touch:TouchToggleButton Style="{StaticResource TangoTouchToggleButtonHamburger}"
VerticalAlignment="Top"
@@ -50,7 +50,7 @@
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border Visibility="{Binding DockToBottom,Converter={StaticResource BooleanToVisibilityInverseConverter}}">
- <Border BorderBrush="{StaticResource TangoDividerBrush}" BorderThickness="0 1 0 0" Visibility="{Binding IsVisibleInMenu,Converter={StaticResource BooleanToVisibilityConverter}}">
+ <Border BorderBrush="{StaticResource TangoGrayBrush}" BorderThickness="0 1 0 0" Visibility="{Binding IsVisibleInMenu,Converter={StaticResource BooleanToVisibilityConverter}}">
<touch:TouchButton Margin="0 0 0 0" Padding="30" Foreground="{StaticResource TangoDarkForegroundBrush}" Style="{StaticResource TangoFlatButton}" FontSize="{StaticResource TangoHeaderFontSize}" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.ModuleNavigationCommand}" CommandParameter="{Binding Name}">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left">
<Image VerticalAlignment="Center" Source="{Binding Image}" Width="48" Height="48"></Image>