diff options
| author | Avi Levkovich <avi@twine-s.com> | 2020-08-12 14:06:48 +0300 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2020-08-12 14:06:48 +0300 |
| commit | 31d4e06c66496a6604e4a878a0258874eeee7a9a (patch) | |
| tree | eba2b4d9d3458166308fc45ae2ea2c944b192b02 /Software/Visual_Studio/MachineStudio/Modules | |
| parent | e2c527adfc31e1a0f0b9585178a9535159a45593 (diff) | |
| download | Tango-31d4e06c66496a6604e4a878a0258874eeee7a9a.tar.gz Tango-31d4e06c66496a6604e4a878a0258874eeee7a9a.zip | |
merge
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules')
6 files changed, 130 insertions, 14 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Converters/CollectionConverter .cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Converters/CollectionConverter .cs index 4cea7f69f..2d9a3cfd9 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Converters/CollectionConverter .cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Converters/CollectionConverter .cs @@ -19,9 +19,13 @@ namespace Tango.MachineStudio.Statistics.Converters foreach(var val in colection) { string visibleText = val.ToString(); - if (val is bool) + if(val is bool && parameter is string) { - visibleText = (bool)val== true ? "Yes" : "No"; + string[] tokens = (parameter as string).Split(','); + if(tokens.Count() > 1) + { + visibleText = (bool)val == true ? tokens[1] : tokens[0]; + } } text.Append(visibleText); text.Append("/"); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Converters/HeadCleaningConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Converters/HeadCleaningConverter.cs new file mode 100644 index 000000000..478a1deba --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Converters/HeadCleaningConverter.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace Tango.MachineStudio.Statistics.Converters +{ + public class HeadCleaningConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + return (bool)value ? "Only" : "Exclude"; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Tango.MachineStudio.Statistics.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Tango.MachineStudio.Statistics.csproj index 4ce0ea87d..23b7c594c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Tango.MachineStudio.Statistics.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Tango.MachineStudio.Statistics.csproj @@ -78,6 +78,7 @@ <ItemGroup> <Compile Include="Converters\CollectionConverter .cs" /> <Compile Include="Converters\DateTimeToStringFormatConverter.cs" /> + <Compile Include="Converters\HeadCleaningConverter.cs" /> <Compile Include="Converters\JobLengthConverter.cs" /> <Compile Include="Converters\LiquidQuantityToFormatStringConverter.cs" /> <Compile Include="Converters\LiquidTypeToColorConverter.cs" /> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/JobRunsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/JobRunsViewVM.cs index 05eb9ef8d..0ecb12ba7 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/JobRunsViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/ViewModels/JobRunsViewVM.cs @@ -175,6 +175,19 @@ namespace Tango.MachineStudio.Statistics.ViewModels } } + private SelectedObjectCollection<bool> _isHeadCleaningSelection; + + public SelectedObjectCollection<bool> IsHeadCleaningSelection + { + get { return _isHeadCleaningSelection; } + set + { + _isHeadCleaningSelection = value; + RaisePropertyChangedAuto(); + } + } + + /// <summary> /// Gets or sets the JobRuns providers. /// </summary> @@ -256,6 +269,18 @@ namespace Tango.MachineStudio.Statistics.ViewModels }); IsGradientSelection.SelectionChanged -= (x, y) => RaisePropertyChanged(nameof(IsGradientSelection)); IsGradientSelection.SelectionChanged += (x, y) => RaisePropertyChanged(nameof(IsGradientSelection)); + + IsHeadCleaningSelection = new SelectedObjectCollection<bool>(new ObservableCollection<bool>() + { + true, + false + }, new ObservableCollection<bool>() + { + true, + false + }); + IsHeadCleaningSelection.SelectionChanged -= (x, y) => RaisePropertyChanged(nameof(IsHeadCleaningSelection)); + IsHeadCleaningSelection.SelectionChanged += (x, y) => RaisePropertyChanged(nameof(IsHeadCleaningSelection)); JobsProvider = new SuggestionProvider((filter) => { try @@ -359,7 +384,8 @@ namespace Tango.MachineStudio.Statistics.ViewModels x.BlackQuantity, x.TransparentQuantity, x.LubricantQuantity, - x.CleanerQuantity + x.CleanerQuantity, + x.IsHeadCleaning }); var machineIDs = new HashSet<string>(SelectedMachines.SynchedSource.ToList().Select(p => p.Guid)); if (machineIDs.Count > 0) @@ -381,6 +407,12 @@ namespace Tango.MachineStudio.Statistics.ViewModels { db_JobRuns = db_JobRuns.Where(x => isGradientArr.Contains(x.IsGradient)); } + bool[] isHeadCleaningArr = IsHeadCleaningSelection.SynchedSource.Select(x => (bool)x).ToArray(); + if(isHeadCleaningArr.Length > 0) + { + db_JobRuns = db_JobRuns.Where(x => isHeadCleaningArr.Contains(x.IsHeadCleaning)); + } + List<String> rmlGuids = SelectedThreads.SynchedSource.Select(y => y.Guid).ToList(); if (rmlGuids != null && rmlGuids.Count > 0) { @@ -421,7 +453,8 @@ namespace Tango.MachineStudio.Statistics.ViewModels BlackQuantity = x.BlackQuantity, TransparentQuantity = x.TransparentQuantity, LubricantQuantity = x.LubricantQuantity, - CleanerQuantity = x.CleanerQuantity + CleanerQuantity = x.CleanerQuantity, + IsHeadCleaning = x.IsHeadCleaning }).ToList(); var modelList = runs.Select(x => new JobRunModel() diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml index 9e92aabc2..9e4a9603e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml @@ -33,6 +33,7 @@ <localConverters:NanoLiterToLiterFormatConverter x:Key="NanoLiterToLiterFormatConverter"/> <localConverters:LiquidQuantityToFormatStringConverter x:Key="LiquidQuantityToFormatStringConverter"/> <localConverters:TooltipLiquidQuantityFormatConverter x:Key="TooltipLiquidQuantityFormatConverter"/> + <localConverters:HeadCleaningConverter x:Key="HeadCleaningConverter"/> <ResourceDictionary x:Key="SelectAllTextBoxResource"> <Style TargetType="TextBox"> @@ -87,6 +88,14 @@ </CheckBox> </DataTemplate> + <DataTemplate x:Key="PopupIsHeadHeatingDataTemplate"> + <CheckBox VerticalAlignment="Center" FontSize="11" DockPanel.Dock="Left" IsChecked="{Binding IsSelected}"> + <CheckBox.Content> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" Text="{Binding Data, Converter={StaticResource HeadCleaningConverter}}"/> + </CheckBox.Content> + </CheckBox> + </DataTemplate> + <Style x:Key="{x:Type ToolTip}" TargetType="{x:Type ToolTip}" BasedOn="{StaticResource MaterialDesignToolTip}"> <Setter Property="Background" Value="{StaticResource Logging.Background}" /> @@ -164,7 +173,7 @@ </ToggleButton> </StackPanel> - <StackPanel Margin="50 10 0 0" HorizontalAlignment="Center"> + <StackPanel Margin="30 10 0 0" HorizontalAlignment="Center"> <TextBlock FontSize="11">Start Date:</TextBlock> <DatePicker x:Name="startdatePicker" SelectedDateChanged="StartDatePicker_SelectedDateChanged" Margin="0 5 0 0" materialDesign:HintAssist.Hint="Pick start date" Width="130" VerticalAlignment="Center" FontSize="11" > <DatePicker.SelectedDate> @@ -176,7 +185,7 @@ </DatePicker.SelectedDate> </DatePicker> </StackPanel> - <StackPanel Margin="50 10 0 0" HorizontalAlignment="Center"> + <StackPanel Margin="30 10 0 0" HorizontalAlignment="Center"> <TextBlock FontSize="11">End Date:</TextBlock> <DatePicker x:Name="endDatePicker" Margin="0 5 0 0" materialDesign:HintAssist.Hint="Pick end date" Width="130" VerticalAlignment="Center" FontSize="11" SelectedDateChanged="EndDatePicker_SelectedDateChanged"> <DatePicker.SelectedDate> @@ -204,7 +213,7 @@ </autoComplete:AutoCompleteTextBox.ItemTemplate> </autoComplete:AutoCompleteTextBox> </StackPanel> - <StackPanel Margin="50 10 0 0" Orientation="Vertical" HorizontalAlignment="Center"> + <StackPanel Margin="30 10 0 0" Orientation="Vertical" HorizontalAlignment="Center"> <TextBlock Text="Source:" VerticalAlignment="Center" FontSize="11"></TextBlock> <ToggleButton Width="130" Height="24" Margin="0 10 0 0" x:Name="selectJobRunSources" HorizontalAlignment="Left" FontSize="16" VerticalAlignment="Center"> <ToggleButton.Template> @@ -232,7 +241,7 @@ </ToggleButton.Template> </ToggleButton> </StackPanel> - <StackPanel Margin="50 10 0 0" Orientation="Vertical" HorizontalAlignment="Center"> + <StackPanel Margin="30 10 0 0" Orientation="Vertical" HorizontalAlignment="Center"> <TextBlock Text="Gradient:" VerticalAlignment="Center" FontSize="11"></TextBlock> <ToggleButton Height="24" Width="130" Margin="0 10 0 0" x:Name="selectIsGradient" HorizontalAlignment="Left" FontSize="16" VerticalAlignment="Center"> <ToggleButton.Template> @@ -244,7 +253,7 @@ <materialDesign:PackIcon Width="16" Height="16" Kind="ChevronDown" VerticalAlignment="Center" Foreground="{StaticResource MainWindow.Foreground}" HorizontalAlignment="Right"/> </Button> <TextBlock VerticalAlignment="Center" Foreground="{StaticResource MainWindow.Foreground}" FontSize="11" Margin="5 0 2 0"> - <Run Text="{Binding IsGradientSelection.SynchedSource, Converter={StaticResource CollectionConverter}}"></Run> + <Run Text="{Binding IsGradientSelection.SynchedSource, Converter={StaticResource CollectionConverter}, ConverterParameter='No, Yes'}"></Run> </TextBlock> </DockPanel> </Border> @@ -262,7 +271,7 @@ </ToggleButton.Template> </ToggleButton> </StackPanel> - <StackPanel Margin="40 10 0 0" Orientation="Vertical" HorizontalAlignment="Center"> + <StackPanel Margin="30 10 0 0" Orientation="Vertical" HorizontalAlignment="Center"> <TextBlock Text="Length:" VerticalAlignment="Center" FontSize="11"></TextBlock> <Border BorderThickness="1" CornerRadius="3" BorderBrush="{StaticResource borderBrush}" Margin="0 10 0 0" Height="24" Padding="10 0"> <StackPanel Orientation="Horizontal"> @@ -275,7 +284,7 @@ </StackPanel> </Border> </StackPanel> - <StackPanel Margin="40 10 0 0" Orientation="Vertical" HorizontalAlignment="Center"> + <StackPanel Margin="30 10 0 0" Orientation="Vertical" HorizontalAlignment="Center"> <TextBlock Text="Status:" VerticalAlignment="Center" FontSize="11"></TextBlock> <ToggleButton Height="24" Width="170" Margin="0 10 0 0" x:Name="selectJobRunStatus" HorizontalAlignment="Left" FontSize="16" VerticalAlignment="Center"> <ToggleButton.Template> @@ -302,9 +311,9 @@ </ToggleButton.Template> </ToggleButton> </StackPanel> - <StackPanel Margin="40 10 0 0" Orientation="Vertical" HorizontalAlignment="Center"> + <StackPanel Margin="30 10 0 0" Orientation="Vertical" HorizontalAlignment="Center"> <TextBlock Text="Threads:" VerticalAlignment="Center" FontSize="11"></TextBlock> - <ToggleButton Width="140" Margin="0 10 0 0" x:Name="selectThreadsButton" HorizontalAlignment="Left" FontSize="16" VerticalAlignment="Center"> + <ToggleButton Width="100" Margin="0 10 0 0" x:Name="selectThreadsButton" HorizontalAlignment="Left" FontSize="16" VerticalAlignment="Center"> <ToggleButton.Template> <ControlTemplate> <Grid> @@ -344,9 +353,49 @@ </ToggleButton.Template> </ToggleButton> </StackPanel> + <StackPanel Margin="30 10 0 0" Orientation="Vertical" HorizontalAlignment="Center"> + <TextBlock Text="HeadCleaning:" VerticalAlignment="Center" FontSize="11"></TextBlock> + <ToggleButton Height="24" Width="120" Margin="0 10 0 0" x:Name="isHeadCleaningToggleButton" HorizontalAlignment="Left" FontSize="16" VerticalAlignment="Center"> + <ToggleButton.Template> + <ControlTemplate> + <Grid> + <Border CornerRadius="3" BorderBrush="{StaticResource borderBrush}" BorderThickness="1" TextElement.Foreground="Black" > + <DockPanel> + <Button x:Name="IsHeadCleaningButton" Width="18" Padding="0" Height="16" DockPanel.Dock="Right" BorderBrush="{x:Null}" HorizontalAlignment="Left" Click="IsHeadCleaningButton_Click" Style="{StaticResource MaterialDesignFlatButton}" Foreground="{StaticResource MainWindow.Foreground}"> + <materialDesign:PackIcon Width="16" Height="16" Kind="ChevronDown" VerticalAlignment="Center" Foreground="{StaticResource MainWindow.Foreground}" HorizontalAlignment="Right"/> + </Button> + <TextBlock VerticalAlignment="Center" Foreground="{StaticResource MainWindow.Foreground}" FontSize="11" Margin="5 0 2 0"> + <TextBlock.Style> + <Style TargetType="{x:Type TextBlock}"> + <Setter Property="Text" Value="{Binding IsHeadCleaningSelection.SynchedSource, Converter={StaticResource CollectionConverter}, ConverterParameter='Exclude, Only'}"> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding IsHeadCleaningSelection.SynchedSource.Count}" Value="2"> + <Setter Property="Text" Value="Include"/> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + </DockPanel> + </Border> + <Popup AllowsTransparency="True" StaysOpen="False" IsOpen="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=IsChecked }"> + <Border Padding="3" CornerRadius="0 0 3 3" MinWidth="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=Width}" Margin="5" Background="{StaticResource TransparentBackgroundBrush200}" BorderBrush="{StaticResource AutoCompleteTextBox.Popup.BorderBrush}"> + <Border.Effect> + <DropShadowEffect Opacity="0.2" /> + </Border.Effect> + <ItemsControl ItemsSource="{Binding IsHeadCleaningSelection}" Foreground="{StaticResource MainWindow.Foreground}" ItemTemplate="{StaticResource PopupIsHeadHeatingDataTemplate}"/> + + </Border> + </Popup> + </Grid> + </ControlTemplate> + </ToggleButton.Template> + </ToggleButton> + </StackPanel> </StackPanel> </Grid> - <Button Grid.Column="1" HorizontalAlignment="Right" Command="{Binding LoadJobRunsCommand}" Margin="0 0 10 0" Padding="70 15" Height="Auto" VerticalAlignment="Center" Content="ANALYZE"> + <Button Grid.Column="1" HorizontalAlignment="Right" Command="{Binding LoadJobRunsCommand}" Margin="0 0 10 0" Padding="30 15" Height="Auto" VerticalAlignment="Center" Content="ANALYZE"> <Button.Style> <Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}"> <Setter Property="IsEnabled" Value="False"/> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml.cs index bd5d88c3b..9bfed23e3 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml.cs @@ -68,6 +68,12 @@ namespace Tango.MachineStudio.Statistics.Views e.Handled = true; } + private void IsHeadCleaningButton_Click(object sender, RoutedEventArgs e) + { + isHeadCleaningToggleButton.IsChecked = true; + e.Handled = true; + } + private void DataGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) { DataGrid dataGrid = sender as DataGrid; |
