diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2020-02-26 13:22:44 +0200 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2020-02-26 13:22:44 +0200 |
| commit | a64cfe8b7dec8417a3d380b55f4ae79c5459f49d (patch) | |
| tree | d40c32f55b65632b80031e64e03ae8d893ea1511 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics | |
| parent | e2fbc8e6047fef09681b994efe2ca1043d25ac9d (diff) | |
| download | Tango-a64cfe8b7dec8417a3d380b55f4ae79c5459f49d.tar.gz Tango-a64cfe8b7dec8417a3d380b55f4ae79c5459f49d.zip | |
Implementing JobRuns on Statistics module.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics')
8 files changed, 637 insertions, 197 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 new file mode 100644 index 000000000..4cea7f69f --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Converters/CollectionConverter .cs @@ -0,0 +1,44 @@ +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 CollectionConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if(value != null && value is System.Collections.IEnumerable) + { + var colection = value as System.Collections.IEnumerable; + var text = new StringBuilder(); + foreach(var val in colection) + { + string visibleText = val.ToString(); + if (val is bool) + { + visibleText = (bool)val== true ? "Yes" : "No"; + } + text.Append(visibleText); + text.Append("/"); + } + string str_text = text.ToString(); + if(str_text.Length > 1) + { + str_text = str_text.Remove(str_text.Length - 1); + } + return str_text; + } + return ""; + } + + 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/Converters/LiquidTypeToColorConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Converters/LiquidTypeToColorConverter.cs new file mode 100644 index 000000000..b36bf608e --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Converters/LiquidTypeToColorConverter.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; +using System.Windows.Media; +using Tango.BL; +using Tango.BL.Enumerations; + +namespace Tango.MachineStudio.Statistics.Converters +{ + public class LiquidTypeToColorConverter : IValueConverter + { + private static Dictionary<LiquidTypes,Color> liquidTypes; + + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + if (liquidTypes == null) + { + liquidTypes = new Dictionary<LiquidTypes, Color>(); + + foreach (var type in ObservablesStaticCollections.Instance.LiquidTypes.ToList()) + { + liquidTypes.Add(type.Type, type.LiquidTypeColor); + } + } + + if (value != null) + { + return liquidTypes[(LiquidTypes)value]; + } + + return value; + } + + 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/Models/JobRunModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/JobRunModel.cs index e269f761f..2bf3a42a4 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/JobRunModel.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/JobRunModel.cs @@ -19,8 +19,6 @@ namespace Tango.MachineStudio.Statistics.Models public TimeSpan? HeatingDuration { get; set; } - - public void Init() { if (JobRun.HeatingStartDate != null) diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/RmlModel.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/RmlModel.cs new file mode 100644 index 000000000..789779e42 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Models/RmlModel.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.Statistics.Models +{ + public class RmlModel + { + public string Guid { get; set; } + + public string Name { get; set; } + } +} 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 4b3535f83..fa62578a1 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 @@ -73,11 +73,14 @@ <Reference Include="PresentationFramework" /> </ItemGroup> <ItemGroup> + <Compile Include="Converters\CollectionConverter .cs" /> + <Compile Include="Converters\LiquidTypeToColorConverter.cs" /> <Compile Include="Converters\StringToBoolYesNoNullConverter.cs" /> <Compile Include="Converters\DateIsInListToBooleanConverter.cs" /> <Compile Include="Models\JobRunModel.cs" /> <Compile Include="Models\JobRunStatisticsModel.cs" /> <Compile Include="Models\LabeledSeriesCollection.cs" /> + <Compile Include="Models\RmlModel.cs" /> <Compile Include="Tooltips\PieChartTooltipControl.xaml.cs"> <DependentUpon>PieChartTooltipControl.xaml</DependentUpon> </Compile> @@ -148,6 +151,10 @@ <Resource Include="Images\statistics.png" /> </ItemGroup> <ItemGroup> + <ProjectReference Include="..\..\..\SideChains\Tango.AutoComplete\Tango.AutoComplete.csproj"> + <Project>{bb2abb74-ba58-4812-83aa-ec8171f42df4}</Project> + <Name>Tango.AutoComplete</Name> + </ProjectReference> <ProjectReference Include="..\..\..\Tango.BL\Tango.BL.csproj"> <Project>{f441feee-322a-4943-b566-110e12fd3b72}</Project> <Name>Tango.BL</Name> 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 f03e7f67d..5c80a9564 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 @@ -6,6 +6,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.BL; +using Tango.BL.Builders; using Tango.BL.Entities; using Tango.BL.Enumerations; using Tango.Core.Commands; @@ -14,6 +15,7 @@ using Tango.MachineStudio.Common.Notifications; using Tango.MachineStudio.Statistics.Models; using Tango.SharedUI; using Tango.SharedUI.Components; +using Tango.AutoComplete.Editors; namespace Tango.MachineStudio.Statistics.ViewModels { @@ -22,11 +24,13 @@ namespace Tango.MachineStudio.Statistics.ViewModels private INotificationProvider _notification; private List<Machine> _allMachines; private List<User> _allUsers; + private List<RmlModel> _rmlsModels; + private List<JobRun> _allJobRuns; #region Properties - private List<JobRunModel> _jobRuns; - public List<JobRunModel> JobRuns + private ObservableCollection<JobRunModel> _jobRuns; + public ObservableCollection<JobRunModel> JobRuns { get { return _jobRuns; } set @@ -72,51 +76,84 @@ namespace Tango.MachineStudio.Statistics.ViewModels set { _endSelectedDate = value; RaisePropertyChangedAuto(); } } - protected Double _length; - public Double Length + protected Double _lengthLowerValue; + public Double LengthLowerValue { - get { return _length; } + get { return _lengthLowerValue; } set { - _length = value; + _lengthLowerValue = value; RaisePropertyChangedAuto(); } } - private JobSource _jobRunSource; + protected Double _lengthUpperValue; + public Double LengthUpperValue + { + get { return _lengthUpperValue; } + set + { + _lengthUpperValue = value; + RaisePropertyChangedAuto(); + } + } - public JobSource JobRunSource + private SelectedObjectCollection<JobSource> _jobRunSelectedSources; + public SelectedObjectCollection<JobSource> JobRunSelectedSources { - get { return _jobRunSource; } - set { _jobRunSource = value; RaisePropertyChangedAuto(); } + get { return _jobRunSelectedSources; } + set { _jobRunSelectedSources = value; RaisePropertyChangedAuto(); } } - private JobRunStatus _jobRunStatus; + private SelectedObjectCollection<JobRunStatus> _jobRunSelectedStatuses; + public SelectedObjectCollection<JobRunStatus> JobRunSelectedStatuses + { + get { return _jobRunSelectedStatuses; } + set { _jobRunSelectedStatuses = value; RaisePropertyChangedAuto(); } + } - public JobRunStatus JobRunStatus + public SelectedObjectCollection<bool> _isGradientSelection; + public SelectedObjectCollection<bool> IsGradientSelection { - get { return _jobRunStatus; } - set { _jobRunStatus = value; RaisePropertyChangedAuto(); } + get { return _isGradientSelection; } + set + { + _isGradientSelection = value; + RaisePropertyChangedAuto(); + } } - - private bool? _isGradient; - public bool? IsGradient + private SelectedObjectCollection<RmlModel> _selectedThreads; + public SelectedObjectCollection<RmlModel> SelectedThreads { - get { return _isGradient; } - set { - _isGradient = value; - RaisePropertyChangedAuto(); } + get { return _selectedThreads; } + set + { + _selectedThreads = value; + RaisePropertyChangedAuto(); + } } - private string _jobName; + /// <summary> + /// Gets or sets the JobRuns providers. + /// </summary> + public ISuggestionProvider JobRunsProvider { get; set; } - public string JobName + private JobRun _jobRun; + public JobRun JobRun { - get { return _jobName; } - set { _jobName = value; } + get { return _jobRun; } + set { + _jobRun = value; + if (_jobRun != null) + { + SelectedJobName = _jobRun.JobName; + } + RaisePropertyChangedAuto(); } } + private string SelectedJobName { get; set; } + #endregion @@ -125,11 +162,68 @@ namespace Tango.MachineStudio.Statistics.ViewModels public JobRunsViewVM(INotificationProvider notificationProvider) { _notification = notificationProvider; - JobRuns = new List<JobRunModel>(); - LoadJobRunsCommand = new RelayCommand( GetJobRuns); + JobRuns = new ObservableCollection<JobRunModel>(); + LoadJobRunsCommand = new RelayCommand(async () => await LoadJobRuns(), ()=> IsFree); + LengthUpperValue = 5000.0; + LengthLowerValue = 0.0; + DateTime now = DateTime.Now; + StartSelectedDate = now.AddMonths(-1); + EndSelectedDate = now; + + JobRunSelectedSources = new SelectedObjectCollection<JobSource>(new ObservableCollection<JobSource>() + { + JobSource.Local, + JobSource.Remote + }, new ObservableCollection<JobSource>() + { + JobSource.Local, + JobSource.Remote + }); + JobRunSelectedSources.SelectionChanged -= (x, y) => RaisePropertyChanged(nameof(JobRunSelectedSources)); + JobRunSelectedSources.SelectionChanged += (x, y) => RaisePropertyChanged(nameof(JobRunSelectedSources)); + + JobRunSelectedStatuses = new SelectedObjectCollection<JobRunStatus>(new ObservableCollection<JobRunStatus>() + { + JobRunStatus.Aborted, + JobRunStatus.Completed, + JobRunStatus.Failed, + + }, new ObservableCollection<JobRunStatus>() + { + JobRunStatus.Aborted, + JobRunStatus.Completed, + JobRunStatus.Failed, + + }); + JobRunSelectedStatuses.SelectionChanged -= (x,y)=> RaisePropertyChanged(nameof(JobRunSelectedStatuses)); + JobRunSelectedStatuses.SelectionChanged += (x, y) => RaisePropertyChanged(nameof(JobRunSelectedStatuses)); + + IsGradientSelection = new SelectedObjectCollection<bool>(new ObservableCollection<bool> + { + true, + false + }, new ObservableCollection<bool> + { + true, + false + }); + IsGradientSelection.SelectionChanged -= (x, y) => RaisePropertyChanged(nameof(IsGradientSelection)); + IsGradientSelection.SelectionChanged += (x, y) => RaisePropertyChanged(nameof(IsGradientSelection)); + JobRunsProvider = new SuggestionProvider((filter) => + { + try + { + SelectedJobName = filter; + return _allJobRuns.Where(x => x.JobName != null && x.JobName.ToString().StartsWith(filter, StringComparison.CurrentCultureIgnoreCase)).ToList(); + } + catch + { + return null; + } + }); + } - public async void Init() { using (_notification.PushTaskItem("Loading job runs...")) @@ -140,9 +234,13 @@ namespace Tango.MachineStudio.Statistics.ViewModels using (var db = ObservablesContext.CreateDefault()) { + _allJobRuns = await db.JobRuns.ToListAsync(); ; _allMachines = await db.Machines.ToListAsync(); - _allUsers = await db.Users.ToListAsync(); + _allUsers = await db.Users.Include(x => x.Contact).ToListAsync(); + _rmlsModels = await db.Rmls.Select(x=> new RmlModel(){ Name = x.Name, Guid = x.Guid}).ToListAsync(); SelectedMachines = new SelectedObjectCollection<Machine>(_allMachines.ToObservableCollection(), new ObservableCollection<Machine>()); + SelectedThreads = new SelectedObjectCollection<RmlModel>(_rmlsModels.ToObservableCollection(), new ObservableCollection<RmlModel>()); + } } catch (Exception ex) @@ -155,12 +253,7 @@ namespace Tango.MachineStudio.Statistics.ViewModels } } } - - private async void GetJobRuns() - { - await LoadJobRuns(); - } - + private async Task LoadJobRuns() { using (_notification.PushTaskItem("Loading job runs...")) @@ -175,24 +268,25 @@ namespace Tango.MachineStudio.Statistics.ViewModels TimeSpan offsetTime = (EndSelectedDate.Date == DateTime.Now.Date) ? DateTime.Now.TimeOfDay : new TimeSpan(23, 59, 59); DateTime endUtc = EndSelectedDate.ToUniversalTime() + offsetTime; - var runs = await db.JobRuns.Select(x => new JobRunModel() + var runs = await new JobRunsBuilder(db).Set(x => x.ActualStartDate <= DbFunctions.TruncateTime(endUtc) && x.ActualStartDate >= DbFunctions.TruncateTime(startUtc.Date)) + .WithMachines(SelectedMachines.SynchedSource.ToList()) + .WithJobSource(JobRunSelectedSources.SynchedSource) + .WithJobStatus(JobRunSelectedStatuses.SynchedSource) + .WithGradient(IsGradientSelection.SynchedSource) + .Query(y => y.Where(x => (String.IsNullOrEmpty(SelectedJobName) || x.JobName.ToString().ToLower().StartsWith(SelectedJobName.ToLower())) + && ( x.JobLength < LengthUpperValue && x.JobLength >= LengthLowerValue) + )) + .BuildListAsync(); + + var modelList = runs.Select(x => new JobRunModel() { JobRun = x, Machine = _allMachines.FirstOrDefault(y => y.Guid == x.MachineGuid), User = _allUsers.SingleOrDefault(y => y.Guid == x.UserGuid), - }).ToListAsync(); + }).ToList(); - // .Query(y => y.Where - //(x => JobName == null || - //(x.JobName.ToString().ToLower().StartsWith(JobName) - //|| Length == null || (x.JobLength == Length) - //|| IsGradient == null || (x.IsGradient != null && x.IsGradient == IsGradient) - //|| ( x.JobRunSource == JobRunSource)))) - //.BuildAsync(); - - runs.ForEach(x => x.Init()); - - JobRuns = runs; + modelList.ForEach(x => x.Init()); + JobRuns = modelList.ToObservableCollection(); } } catch (Exception ex) @@ -205,5 +299,6 @@ namespace Tango.MachineStudio.Statistics.ViewModels } } } + } } 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 4667959b8..c89cd5819 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 @@ -7,17 +7,24 @@ xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:localConverters="clr-namespace:Tango.MachineStudio.Statistics.Converters" xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" + xmlns:autoComplete="clr-namespace:Tango.AutoComplete.Editors;assembly=Tango.AutoComplete" xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL" xmlns:local="clr-namespace:Tango.MachineStudio.Statistics.Views" mc:Ignorable="d" - d:DesignHeight="450" d:DesignWidth="1200"> + d:DesignHeight="450" d:DesignWidth="1800" Foreground="{StaticResource JobFieldForeground}"> <UserControl.Resources> <sharedConverters:BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" /> + <sharedConverters:BooleanToYesNoConverter x:Key="BooleanToYesNoConverter"/> <sharedConverters:EnumToDescriptionConverter x:Key="EnumToDescriptionConverter" /> + <sharedConverters:EnumToItemsSourceConverter x:Key="EnumToItemsSourceConverter" /> + <sharedConverters:TimeSpanToTwoDigitsTimeConverter x:Key="TimeSpanToTwoDigitsTimeConverter" /> <sharedConverters:DateTimeUTCToShortDateTimeConverter x:Key="DateTimeUTCToShortDateTimeConverter"/> + <sharedConverters:ColorToIntegerConverter x:Key="ColorToIntegerConverter" /> <localConverters:DateIsInListToBooleanConverter x:Key="DateIsInListToBooleanConverter"/> <localConverters:StringToBoolYesNoNullConverter x:Key="StringToBoolYesNoNullConverter"/> + <localConverters:LiquidTypeToColorConverter x:Key="LiquidTypeToColorConverter"/> + <localConverters:CollectionConverter x:Key="CollectionConverter"/> <ResourceDictionary x:Key="SelectAllTextBoxResource"> <Style TargetType="TextBox"> @@ -26,169 +33,304 @@ </Style> </ResourceDictionary> - <Style x:Key="CustomCalendarDayButtonStyle" TargetType="{x:Type CalendarDayButton}" BasedOn="{StaticResource MaterialDesignCalendarDayButton}"> - <Style.Triggers> - <DataTrigger Value="True"> - <DataTrigger.Binding> - <MultiBinding Converter="{StaticResource DateIsInListToBooleanConverter}"> - <Binding /> - <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.Dates" /> - <Binding RelativeSource="{RelativeSource AncestorType=DatePicker}" Path="IsDropDownOpen" ></Binding> - </MultiBinding> - </DataTrigger.Binding> - <Setter Property="Foreground" Value="{StaticResource AccentColorBrush}" /> - </DataTrigger> - </Style.Triggers> + <Style TargetType="{x:Type TextBlock}" x:Key="WrapText"> + <Setter Property="TextWrapping" Value="Wrap"/> </Style> - <Style x:Key="HighlightDatePickerStyle" TargetType="{x:Type Calendar}" BasedOn="{StaticResource {x:Type Calendar}}"> - <Setter Property="CalendarDayButtonStyle" Value="{StaticResource CustomCalendarDayButtonStyle}" /> - </Style> - - <ObjectDataProvider x:Key="JobSource" MethodName="GetValues" ObjectType="{x:Type sys:Enum}"> - <ObjectDataProvider.MethodParameters> - <x:Type TypeName="enumerations:JobSource"/> - </ObjectDataProvider.MethodParameters> - </ObjectDataProvider> - - <ObjectDataProvider x:Key="JobRunStatus" MethodName="GetValues" ObjectType="{x:Type sys:Enum}"> - <ObjectDataProvider.MethodParameters> - <x:Type TypeName="enumerations:JobRunStatus"/> - </ObjectDataProvider.MethodParameters> - </ObjectDataProvider> - </UserControl.Resources> - <Grid IsEnabled="{Binding IsFree}"> + <Grid IsEnabled="{Binding IsFree}" > <Grid.ColumnDefinitions> <ColumnDefinition Width="3*"/> <ColumnDefinition Width="1*"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> - <RowDefinition Height="100"/> + <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> - <materialDesign:Card Grid.Row="0" Background="{StaticResource WhiteBackgroundBrush}" Foreground="{StaticResource JobFieldForeground}" Width="Auto" Margin="10 10 0 0" > + <Grid Grid.Row="0" Background="{StaticResource WhiteBackgroundBrush}" Width="Auto" Margin="20 0 0 1" > + <Border Padding="14 14 12 14" BorderBrush="DimGray" BorderThickness="0" Background="{StaticResource Logging.Background}" HorizontalAlignment="Stretch" CornerRadius="2" > + <Border.Effect> + <DropShadowEffect ShadowDepth="4" BlurRadius="10" Opacity="0.5"/> + </Border.Effect> + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="*"/> + <ColumnDefinition Width="120"/> + </Grid.ColumnDefinitions> - <DockPanel> - <StackPanel Orientation="Horizontal" DockPanel.Dock="Left"> - <StackPanel Margin="30 5 0 20" Orientation="Vertical" > - <TextBlock DockPanel.Dock="Top" Text="Machine:" VerticalAlignment="Center" FontSize="10"></TextBlock> - <ToggleButton Width="200" Margin="0 10 0 0" x:Name="selectMachineButton" HorizontalAlignment="Left" FontSize="16" VerticalAlignment="Center"> - <ToggleButton.Template> - <ControlTemplate> - <Grid> - <Border CornerRadius="3" BorderBrush="{StaticResource borderBrush}" BorderThickness="1" TextElement.Foreground="Black" > - <DockPanel> - <Button Width="18" Padding="0" Height="16" DockPanel.Dock="Right" BorderBrush="{x:Null}" HorizontalAlignment="Left" Click="Button_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}"> - <Run Text=" Select Machines"></Run> - <Run>(</Run><Run Text="{Binding SelectedMachines.SynchedSource.Count,Mode=OneWay}"></Run><Run>)</Run> - </TextBlock> - </DockPanel> - </Border> - <Popup StaysOpen="False" IsOpen="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=IsChecked }" > - <Border Padding="5" Background="{DynamicResource ComboBox.Floating.Background}" BorderBrush="{StaticResource AutoCompleteTextBox.Popup.BorderBrush}"> - <ScrollViewer MaxHeight="600" Background="{DynamicResource ComboBox.Floating.Background}"> - <ItemsControl ItemsSource="{Binding SelectedMachines}" Foreground="{StaticResource MainWindow.Foreground}"> - <ItemsControl.ItemTemplate> - <DataTemplate> - <DockPanel Margin="2"> - <CheckBox VerticalAlignment="Center" DockPanel.Dock="Left" IsChecked="{Binding IsSelected}" /> - <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" Text="{Binding Data.SerialNumber}"></TextBlock> - </DockPanel> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> - </ScrollViewer> - </Border> - </Popup> - </Grid> - </ControlTemplate> - </ToggleButton.Template> - </ToggleButton> + <Grid > + <Grid.RowDefinitions> + <RowDefinition Height="1*"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + <StackPanel Orientation="Horizontal" Grid.Row="0"> + <StackPanel Margin="10 5 0 0" Orientation="Vertical" HorizontalAlignment="Center"> + <TextBlock Text="Machine:" VerticalAlignment="Center" FontSize="11"></TextBlock> + <ToggleButton Width="130" Margin="0 10 0 0" x:Name="selectMachineButton" HorizontalAlignment="Left" FontSize="16" VerticalAlignment="Center"> + <ToggleButton.Template> + <ControlTemplate> + <Grid> + <Border CornerRadius="3" BorderBrush="{StaticResource borderBrush}" BorderThickness="1" TextElement.Foreground="Black" Height="24"> + <DockPanel> + <Button x:Name="selectMachineButton" Width="18" Padding="0" Height="16" DockPanel.Dock="Right" BorderBrush="{x:Null}" HorizontalAlignment="Left" Click="Button_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"> + <TextBlock.Style> + <Style TargetType="{x:Type TextBlock}"> + <Setter Property="Text" Value="{Binding SelectedMachines.SynchedSource.Count, StringFormat={}Selected Machines({0})}"> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding SelectedMachines.SynchedSource.Count}" Value="0"> + <Setter Property="Text" Value="All machines"/> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + </DockPanel> + </Border> + <Popup StaysOpen="False" IsOpen="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=IsChecked }" Width="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=Width}" > + <Border Background="{StaticResource Logging.Background}" BorderBrush="{StaticResource AutoCompleteTextBox.Popup.BorderBrush}" CornerRadius="3" BorderThickness="0.5" Padding="2"> + <ScrollViewer MaxHeight="600" Background="{DynamicResource ComboBox.Floating.Background}"> + <ItemsControl ItemsSource="{Binding SelectedMachines}" Foreground="{StaticResource MainWindow.Foreground}"> + <ItemsControl.ItemTemplate> + <DataTemplate> + <CheckBox VerticalAlignment="Center" DockPanel.Dock="Left" IsChecked="{Binding IsSelected}" > + <CheckBox.Content> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" Text="{Binding Data.SerialNumber}" ToolTip="{Binding Data.SerialNumber}"></TextBlock> + </CheckBox.Content> + </CheckBox> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </ScrollViewer> + </Border> + </Popup> + </Grid> + </ControlTemplate> + </ToggleButton.Template> + </ToggleButton> + </StackPanel> - </StackPanel> - <Border Margin="30 10 0 20" Padding="5" BorderBrush="#38696969" BorderThickness="1" > - <StackPanel Orientation="Horizontal"> - <materialDesign:PackIcon Kind="Calendar" Width="24" Height="24" VerticalAlignment="Bottom" Margin="0 0 0 5" /> - <DatePicker x:Name="datePicker" DisplayDateStart="{Binding MinDate}" DisplayDateEnd="{Binding MaxDate}" CalendarStyle="{StaticResource HighlightDatePickerStyle}" SelectedDate="{Binding SelectedDate}" materialDesign:HintAssist.Hint="Pick Date" Margin="10 0 0 5" Width="100" VerticalAlignment="Bottom" FontSize="16"> - </DatePicker> - </StackPanel> - </Border> - <StackPanel Margin="30 5 20 20" Orientation="Vertical"> - <TextBlock Text="Job Name:" VerticalAlignment="Center" FontSize="10"></TextBlock> - <TextBox Text="{Binding JobName}" VerticalAlignment="Center" FontSize="16" Margin="0 5 0 0" Width="100"></TextBox> - </StackPanel> - <StackPanel Margin="30 5 20 0" Orientation="Vertical"> - <TextBlock Text="Source:" VerticalAlignment="Center" FontSize="10"></TextBlock> - <ComboBox Width="100" FontSize="14" Margin="0 5 0 0" ItemsSource="{Binding Source={StaticResource JobSource}}" SelectedItem="{Binding JobRunSource, UpdateSourceTrigger=PropertyChanged}"> - <ComboBox.ItemContainerStyle> - <Style TargetType="ComboBoxItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}"> - <Setter Property="Background" Value="{StaticResource WhiteBrush100}"></Setter> - </Style> - </ComboBox.ItemContainerStyle> - <ComboBox.ItemTemplate> - <DataTemplate> - <TextBlock Text="{Binding Converter={StaticResource EnumToDescriptionConverter}}"></TextBlock> - </DataTemplate> - </ComboBox.ItemTemplate> - </ComboBox> - </StackPanel> - <StackPanel Margin="30 5 20 0" Orientation="Vertical"> - <TextBlock Text="Gradient:" VerticalAlignment="Center" FontSize="10"></TextBlock> - <ComboBox Width="100" FontSize="14" Margin="0 5 0 0" SelectedItem="{Binding IsGradient, Converter={StaticResource StringToBoolYesNoNullConverter}, UpdateSourceTrigger=PropertyChanged, Mode=OneWayToSource}"> - <ComboBox.ItemContainerStyle> - <Style TargetType="ComboBoxItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}"> - <Setter Property="Background" Value="{StaticResource WhiteBrush100}"></Setter> - </Style> - </ComboBox.ItemContainerStyle> - <ComboBoxItem Content="Yes" /> - <ComboBoxItem Content="No" /> - <ComboBoxItem Content="Null" /> - </ComboBox> - </StackPanel> - <StackPanel Margin="30 5 20 0" Orientation="Vertical"> - <TextBlock Text="Length:" VerticalAlignment="Center" FontSize="10"></TextBlock> - <mahapps:NumericUpDown Width="100" Margin="0 8.5 0 0" x:Name="numLength" FontSize="21" HideUpDownButtons="True" HorizontalAlignment="Left" FontFamily="{StaticResource digital-7}" StringFormat="{}{0:N1} m" Minimum="0" Maximum="5000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0 0 0 1" BorderBrush="{StaticResource DimGrayBrush}" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding Length,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"> - <mahapps:NumericUpDown.Resources> - <StaticResource ResourceKey="SelectAllTextBoxResource"></StaticResource> - </mahapps:NumericUpDown.Resources> - </mahapps:NumericUpDown> - </StackPanel> - <StackPanel Margin="30 5 20 0" Orientation="Vertical"> - <TextBlock Text="Status:" VerticalAlignment="Center" FontSize="10"></TextBlock> - <ComboBox Width="100" FontSize="14" Margin="0 5 0 0" ItemsSource="{Binding Source={StaticResource JobRunStatus}}" SelectedItem="{Binding JobRunStatus, UpdateSourceTrigger=PropertyChanged}"> - <ComboBox.ItemContainerStyle> - <Style TargetType="ComboBoxItem" BasedOn="{StaticResource {x:Type ComboBoxItem}}"> - <Setter Property="Background" Value="{StaticResource WhiteBrush100}"></Setter> - </Style> - </ComboBox.ItemContainerStyle> - <ComboBox.ItemTemplate> - <DataTemplate> - <TextBlock Text="{Binding Converter={StaticResource EnumToDescriptionConverter}}"></TextBlock> - </DataTemplate> - </ComboBox.ItemTemplate> - </ComboBox> - </StackPanel> - - </StackPanel> - <Button HorizontalAlignment="Right" Command="{Binding LoadJobRunsCommand}" DockPanel.Dock="Right" Margin="10">GO</Button> - </DockPanel> - </materialDesign:Card> + <StackPanel Margin="50 10 0 0" HorizontalAlignment="Center"> + <TextBlock FontSize="11">Start Date:</TextBlock> + <DatePicker x:Name="startdatePicker" Margin="0 5 0 0" SelectedDate="{Binding StartSelectedDate}" materialDesign:HintAssist.Hint="Pick start date" Width="130" VerticalAlignment="Center" FontSize="11" /> + </StackPanel> + <StackPanel Margin="50 10 0 0" HorizontalAlignment="Center"> + <TextBlock FontSize="11">End Date:</TextBlock> + <DatePicker x:Name="endDatePicker" Margin="0 5 0 0" SelectedDate="{Binding EndSelectedDate}" materialDesign:HintAssist.Hint="Pick end date" Width="130" VerticalAlignment="Center" FontSize="11" /> + </StackPanel> + </StackPanel> + + <StackPanel Orientation="Horizontal" Grid.Row="1"> + <StackPanel Margin="10 20 0 0" Orientation="Vertical" HorizontalAlignment="Center"> + <!--<TextBlock Text="Job Name:" VerticalAlignment="Center" FontSize="11"></TextBlock>--> + <!--<TextBox Text="{Binding JobName}" VerticalAlignment="Center" FontSize="11" Margin="0 5 0 0" Width="130"></TextBox>--> + <autoComplete:AutoCompleteTextBox Provider="{Binding JobRunsProvider}" Width="130" FontSize="11" LoadingContent="Loading..." SelectedItem="{Binding JobRun,Mode=TwoWay}" materialDesign:HintAssist.Hint="Job Name" DisplayMember="JobName" materialDesign:HintAssist.IsFloating="True"> + <autoComplete:AutoCompleteTextBox.ItemTemplate> + <DataTemplate> + <StackPanel> + <TextBlock Text="{Binding JobName}" FontWeight="Bold" FontStyle="Italic"></TextBlock> + <!--<TextBlock FontSize="11" Text="{Binding Name}" Foreground="Gray"></TextBlock>--> + </StackPanel> + </DataTemplate> + </autoComplete:AutoCompleteTextBox.ItemTemplate> + </autoComplete:AutoCompleteTextBox> + </StackPanel> + <StackPanel Margin="40 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> + <ControlTemplate> + <Grid> + <Border CornerRadius="3" BorderBrush="{StaticResource borderBrush}" BorderThickness="1" TextElement.Foreground="Black" > + <DockPanel> + <Button x:Name="jobRunSourcesButton" Width="18" Padding="0" Height="16" DockPanel.Dock="Right" BorderBrush="{x:Null}" HorizontalAlignment="Left" Click="JobRunSourcesButton_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" Text="{Binding JobRunSelectedSources.SynchedSource, Converter={StaticResource CollectionConverter}}"/> + </DockPanel> + </Border> + <Popup StaysOpen="False" IsOpen="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=IsChecked }" Width="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=Width}"> + <Border Background="{DynamicResource ComboBox.Floating.Background}" BorderBrush="{StaticResource AutoCompleteTextBox.Popup.BorderBrush}" > + <ItemsControl ItemsSource="{Binding JobRunSelectedSources}" Foreground="{StaticResource MainWindow.Foreground}"> + <ItemsControl.ItemTemplate> + <DataTemplate> + <CheckBox VerticalAlignment="Center" DockPanel.Dock="Left" IsChecked="{Binding IsSelected}"> + <CheckBox.Content> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" Text="{Binding Data}"></TextBlock> + </CheckBox.Content> + </CheckBox> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </Border> + </Popup> + </Grid> + </ControlTemplate> + </ToggleButton.Template> + </ToggleButton> + </StackPanel> + <StackPanel Margin="40 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> + <ControlTemplate> + <Grid> + <Border CornerRadius="3" BorderBrush="{StaticResource borderBrush}" BorderThickness="1" TextElement.Foreground="Black" > + <DockPanel> + <Button x:Name="isGradientButton" Width="18" Padding="0" Height="16" DockPanel.Dock="Right" BorderBrush="{x:Null}" HorizontalAlignment="Left" Click="IsGradientButton_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"> + <Run Text="{Binding IsGradientSelection.SynchedSource, Converter={StaticResource CollectionConverter}}"></Run> + </TextBlock> + </DockPanel> + </Border> + <Popup StaysOpen="False" IsOpen="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=IsChecked }" Width="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=Width}"> + <Border Padding="5" Background="{DynamicResource ComboBox.Floating.Background}" BorderBrush="{StaticResource AutoCompleteTextBox.Popup.BorderBrush}"> + <ItemsControl ItemsSource="{Binding IsGradientSelection}" Foreground="{StaticResource MainWindow.Foreground}"> + <ItemsControl.ItemTemplate> + <DataTemplate> + <CheckBox VerticalAlignment="Center" DockPanel.Dock="Left" IsChecked="{Binding IsSelected}"> + <CheckBox.Content> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" Text="{Binding Data, Converter={StaticResource BooleanToYesNoConverter}}"/> + </CheckBox.Content> + </CheckBox> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </Border> + </Popup> + </Grid> + </ControlTemplate> + </ToggleButton.Template> + </ToggleButton> + </StackPanel> + <StackPanel Margin="40 10 0 0" Orientation="Vertical" HorizontalAlignment="Center"> + <TextBlock Text="Length:" VerticalAlignment="Center" FontSize="11"></TextBlock> + <Border MinWidth="200" BorderThickness="1" CornerRadius="3" BorderBrush="{StaticResource borderBrush}" Margin="0 5 0 0" Height="40"> + <StackPanel Orientation="Horizontal" Width="200" Margin="2 0 2 0"> + <TextBlock Text="{Binding LengthLowerValue, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" FontSize="11"></TextBlock> + <mahapps:RangeSlider Height="40" Margin="5 5 5 5" Minimum="0" Maximum="5000" Width="140" + LowerValue="{Binding LengthLowerValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Delay=100}" + UpperValue="{Binding LengthUpperValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, Delay=100}" + VerticalAlignment="Center" IsSnapToTickEnabled="True" FontSize="8"/> + <TextBlock Text="{Binding LengthUpperValue}" VerticalAlignment="Center" FontSize="11"></TextBlock> + </StackPanel> + </Border> + </StackPanel> + <StackPanel Margin="40 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> + <ControlTemplate> + <Grid> + <Border CornerRadius="3" BorderBrush="{StaticResource borderBrush}" BorderThickness="1" TextElement.Foreground="Black" > + <DockPanel> + <Button x:Name="jobRunStatusButton" Width="18" Padding="0" Height="16" DockPanel.Dock="Right" BorderBrush="{x:Null}" HorizontalAlignment="Left" Click="JobRunStatusButton_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" Text="{Binding JobRunSelectedStatuses.SynchedSource, Converter={StaticResource CollectionConverter}}"/> + </DockPanel> + </Border> + <Popup StaysOpen="False" IsOpen="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=IsChecked }" Width="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=Width}"> + <Border Padding="5" Background="{DynamicResource ComboBox.Floating.Background}" BorderBrush="{StaticResource AutoCompleteTextBox.Popup.BorderBrush}" > + <ItemsControl ItemsSource="{Binding JobRunSelectedStatuses}" Foreground="{StaticResource MainWindow.Foreground}"> + <ItemsControl.ItemTemplate> + <DataTemplate> + <CheckBox VerticalAlignment="Center" DockPanel.Dock="Left" IsChecked="{Binding IsSelected}"> + <CheckBox.Content> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" Text="{Binding Data}"/> + </CheckBox.Content> + </CheckBox> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </Border> + </Popup> + </Grid> + </ControlTemplate> + </ToggleButton.Template> + </ToggleButton> + </StackPanel> + <StackPanel Margin="40 10 0 0" Orientation="Vertical" HorizontalAlignment="Center"> + <TextBlock Text="Threads:" VerticalAlignment="Center" FontSize="11"></TextBlock> + <ToggleButton Width="130" Margin="0 10 0 0" x:Name="selectThreadsButton" HorizontalAlignment="Left" FontSize="16" VerticalAlignment="Center"> + <ToggleButton.Template> + <ControlTemplate> + <Grid> + <Border CornerRadius="3" BorderBrush="{StaticResource borderBrush}" BorderThickness="1" TextElement.Foreground="Black" Height="24"> + <DockPanel> + <Button x:Name="selectThreadButton" Width="18" Padding="0" Height="16" DockPanel.Dock="Right" BorderBrush="{x:Null}" HorizontalAlignment="Left" Click="SelectMachineButton_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"> + <TextBlock.Style> + <Style TargetType="{x:Type TextBlock}"> + <Setter Property="Text" Value="{Binding SelectedThreads.SynchedSource.Count, StringFormat={}Selected Machines({0})}"> + </Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding SelectedThreads.SynchedSource.Count}" Value="0"> + <Setter Property="Text" Value="All threads"/> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + </DockPanel> + </Border> + <Popup StaysOpen="False" IsOpen="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=IsChecked }" Width="{Binding RelativeSource={RelativeSource AncestorType=ToggleButton},Path=Width}" > + <Border Background="{DynamicResource ComboBox.Floating.Background}" BorderBrush="{StaticResource AutoCompleteTextBox.Popup.BorderBrush}" CornerRadius="3" BorderThickness="0.5" Padding="2"> + <ScrollViewer MaxHeight="600" Background="{DynamicResource ComboBox.Floating.Background}"> + <ItemsControl ItemsSource="{Binding SelectedThreads}" Foreground="{StaticResource MainWindow.Foreground}"> + <ItemsControl.ItemTemplate> + <DataTemplate> + <CheckBox VerticalAlignment="Center" DockPanel.Dock="Left" IsChecked="{Binding IsSelected}" > + <CheckBox.Content> + <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" Text="{Binding Data.Name}" ToolTip="{Binding Data.Name}"></TextBlock> + </CheckBox.Content> + </CheckBox> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </ScrollViewer> + </Border> + </Popup> + </Grid> + </ControlTemplate> + </ToggleButton.Template> + </ToggleButton> + </StackPanel> + </StackPanel> + </Grid> + <Button Grid.Column="1" HorizontalAlignment="Right" Command="{Binding LoadJobRunsCommand}" Margin="10" Width="100" VerticalAlignment="Center">GO</Button> + </Grid> + </Border> + </Grid> - <DataGrid Grid.Row="1" Margin="20 0 0 10" SelectionMode="Single" SelectionUnit="FullRow" RowHeight="40" BorderBrush="{StaticResource borderBrush}" IsReadOnly="True" BorderThickness="1" + <DataGrid Grid.Row="1" Margin="20 0 0 10" SelectionMode="Single" SelectionUnit="FullRow" BorderBrush="{StaticResource borderBrush}" IsReadOnly="True" BorderThickness="1" RowHeight="60" Background="{StaticResource TransparentBackgroundBrush}" AlternatingRowBackground="{StaticResource Transparent200}" AutoGenerateColumns="False" CanUserReorderColumns="True" - CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding JobRuns}" + CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding JobRuns}" HorizontalScrollBarVisibility="Disabled" SelectedItem="{Binding SelectedJobRun}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" FontSize="11"> + <DataGrid.CellStyle> <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}"> <Setter Property="BorderThickness" Value="0"/> <Setter Property="FocusVisualStyle" Value="{x:Null}"/> <Setter Property="VerticalContentAlignment" Value="Center"></Setter> + <Setter Property="VerticalAlignment" Value="Stretch"/> + <Setter Property="HorizontalAlignment" Value="Left"/> + <!--<Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type DataGridCell}"> + <ContentPresenter VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> + </ControlTemplate> + </Setter.Value> + </Setter>--> <Style.Triggers> <Trigger Property="IsSelected" Value="True"> <Setter Property="Background" Value="Transparent"></Setter> @@ -199,6 +341,7 @@ </DataGrid.CellStyle> <DataGrid.RowStyle> <Style TargetType="DataGridRow" BasedOn="{StaticResource {x:Type DataGridRow}}"> + <Style.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Background" Value="Transparent"></Setter> @@ -216,11 +359,83 @@ </DataGrid.RowStyle> <DataGrid.Columns> - <DataGridTextColumn Header="START DATE" Binding="{Binding JobRun.StartDate, Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" Width="Auto" /> - <DataGridTextColumn Header="LENGTH" Binding="{Binding JobRun.JobLength}" Width="Auto" /> - <DataGridTextColumn Header="STATUS" Binding="{Binding JobRun.JobRunStatus, Converter={StaticResource EnumToDescriptionConverter}}" Width="Auto"/> - <DataGridTextColumn Header="DESIGNATION" Binding="{Binding JobRun.Designation, Converter={StaticResource EnumToDescriptionConverter}}" Width="Auto"/> - <DataGridTextColumn Header="SOURCE" Binding="{Binding JobRun.Source, Converter={StaticResource EnumToDescriptionConverter}}" Width="Auto" /> + <DataGridTemplateColumn Header="#"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <materialDesign:PackIcon Width="24" Height="24" Margin="3 -5 0 0"> + <materialDesign:PackIcon.Style> + <Style TargetType="materialDesign:PackIcon"> + <Setter Property="Kind" Value="Check"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding JobRun.JobRunStatus}" Value="Completed"> + <Setter Property="Kind" Value="Check"></Setter> + <Setter Property="Foreground" Value="{StaticResource GreenOpenFileBrush}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding JobRun.JobRunStatus}" Value="Aborted"> + <Setter Property="Kind" Value="Alert"></Setter> + <Setter Property="Foreground" Value="{StaticResource OrangeBrush}"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding JobRun.JobRunStatus}" Value="Failed"> + <Setter Property="Kind" Value="AlertOctagon"></Setter> + <Setter Property="Foreground" Value="{StaticResource RedBrush100}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </materialDesign:PackIcon.Style> + </materialDesign:PackIcon> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> + <DataGridTextColumn Header="ID" Binding="{Binding JobRun.ID}" MaxWidth="100" ElementStyle="{StaticResource WrapText}"/> + <DataGridTextColumn Header="Machine" Binding="{Binding Machine.SerialNumber}" Width="Auto" /> + <DataGridTextColumn Header="User" Binding="{Binding User.Contact.FullName}" Width="80" ElementStyle="{StaticResource WrapText}"/> + <DataGridTextColumn Header="Job Name" Binding="{Binding JobRun.JobName}" MaxWidth="100" ElementStyle="{StaticResource WrapText}"/> + <DataGridTextColumn Header="Length" Binding="{Binding JobRun.JobLength, StringFormat={}{0:0.00}}" Width="Auto" /> + <DataGridTextColumn Header="Source" Binding="{Binding JobRun.Source, Converter={StaticResource EnumToDescriptionConverter}}" Width="Auto" /> + <DataGridTextColumn Header="Upload Duration" Binding="{Binding UploadDuration, Converter={StaticResource TimeSpanToTwoDigitsTimeConverter}, FallbackValue=5}" Width="Auto"/> + <DataGridTextColumn Header="Heating Duration" Binding="{Binding HeatingDuration, Converter={StaticResource TimeSpanToTwoDigitsTimeConverter}, FallbackValue=5}" Width="Auto" /> + <DataGridTextColumn Header="Start Time" Binding="{Binding JobRun.ActualStartDate, Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" Width="Auto" /> + <DataGridTextColumn Header="IsGradient" Binding="{Binding JobRun.IsGradient}" Width="Auto" /> + <DataGridTextColumn Header="GR" Binding="{Binding JobRun.GradientResolutionCm}" Width="Auto" /> + <DataGridTextColumn Header="Status" Binding="{Binding JobRun.JobRunStatus, Converter={StaticResource EnumToDescriptionConverter}}" Width="Auto"/> + <DataGridTextColumn Header="End Time" Binding="{Binding JobRun.EndDate, Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" Width="Auto" /> + <DataGridTextColumn Header="End Position" Binding="{Binding JobRun.EndPosition, StringFormat={}{0:0.00}}" Width="Auto" /> + <DataGridTemplateColumn Header="Liquid Quantities" Width="1*"> + <DataGridTemplateColumn.CellTemplate> + <DataTemplate> + <ItemsControl ItemsSource="{Binding JobRun.LiquidQuantities,Mode=OneWay}" Margin="0 0 0 0" Height="60"> + <ItemsControl.ItemContainerStyle> + <Style TargetType="ContentPresenter"> + <Setter Property="Visibility" Value="Visible"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding Quantity}" Value="0"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </ItemsControl.ItemContainerStyle> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <WrapPanel ></WrapPanel> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <StackPanel Orientation="Vertical" ToolTip="{Binding Quantity}"> + <!--<TextBlock VerticalAlignment="Center" Margin="10 0 0 0" Text="{Binding LiquidType,Converter={StaticResource EnumToDescriptionConverter}}"/>--> + <Rectangle Height="30" Width="20" Margin="0 0 0 0"> + <Rectangle.Fill> + <SolidColorBrush Color="{Binding LiquidType,Converter={StaticResource LiquidTypeToColorConverter}}" /> + </Rectangle.Fill> + </Rectangle> + <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center" Margin="2" Text="{Binding LiquidType,Converter={StaticResource EnumToDescriptionConverter}}" Foreground="Gray"/> + </StackPanel> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </DataTemplate> + </DataGridTemplateColumn.CellTemplate> + </DataGridTemplateColumn> </DataGrid.Columns> </DataGrid> <Border Grid.Row="1" Grid.Column="1" Margin="20, 0, 20, 10" BorderBrush="{StaticResource borderBrush}" Background="{StaticResource TransparentBackgroundBrush}" BorderThickness="1"> 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 0966533b9..39b0d2c02 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 @@ -29,6 +29,23 @@ namespace Tango.MachineStudio.Statistics.Views selectMachineButton.IsChecked = true; e.Handled = true; } + + private void JobRunSourcesButton_Click(object sender, RoutedEventArgs e) + { + selectJobRunSources.IsChecked = true; + e.Handled = true; + } + private void IsGradientButton_Click(object sender, RoutedEventArgs e) + { + selectIsGradient.IsChecked = true; + e.Handled = true; + } + private void JobRunStatusButton_Click(object sender, RoutedEventArgs e) + { + selectJobRunStatus.IsChecked = true; + e.Handled = true; + } + private async void TextBox_GotFocus(object sender, RoutedEventArgs e) { await Task.Delay(200); @@ -40,5 +57,11 @@ namespace Tango.MachineStudio.Statistics.Views { e.Handled = true; } + + private void SelectMachineButton_Click(object sender, RoutedEventArgs e) + { + selectThreadsButton.IsChecked = true; + e.Handled = true; + } } } |
