diff options
| author | Mirta <mirta@twine-s.com> | 2020-12-30 16:39:52 +0200 |
|---|---|---|
| committer | Mirta <mirta@twine-s.com> | 2020-12-30 16:39:52 +0200 |
| commit | 00a491d93733d4625ad329b2ba8237f445364b3f (patch) | |
| tree | 4b24c6fa78d7648f4bb7cefafa464bb0b063fec4 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views | |
| parent | 124ad4150f80c6846fdee41dbbda9848c105f6e5 (diff) | |
| download | Tango-00a491d9.tar.gz Tango-00a491d9.zip | |
merge
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views')
6 files changed, 98 insertions, 1203 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/ChartsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/ChartsView.xaml deleted file mode 100644 index b76154941..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/ChartsView.xaml +++ /dev/null @@ -1,145 +0,0 @@ -<UserControl x:Class="Tango.MachineStudio.Statistics.Views.ChartsView" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:vm="clr-namespace:Tango.MachineStudio.Statistics.ViewModels" - xmlns:global="clr-namespace:Tango.MachineStudio.Statistics" - xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" - xmlns:localrule="clr-namespace:Tango.MachineStudio.Statistics.ValidationRules" - xmlns:local="clr-namespace:Tango.MachineStudio.Statistics.Views" - xmlns:tooltips="clr-namespace:Tango.MachineStudio.Statistics.Tooltips" - xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf" - mc:Ignorable="d" - d:DesignHeight="450" d:DesignWidth="800"> - <Grid IsEnabled="{Binding IsFree}"> - <Grid.RowDefinitions> - <RowDefinition Height="80"/> - <RowDefinition Height="337*"/> - </Grid.RowDefinitions> - - - <StackPanel Margin="60 20 0 0" VerticalAlignment="Center" HorizontalAlignment="Left" Orientation="Horizontal" DockPanel.Dock="Left"> - <StackPanel> - <TextBlock FontSize="10">Start Date:</TextBlock> - <DatePicker x:Name="startdatePicker" SelectedDateChanged="StartDatePicker_SelectedDateChanged" materialDesign:HintAssist.Hint="Pick start date" Width="200" VerticalAlignment="Bottom" FontSize="16"> - <DatePicker.SelectedDate> - <Binding Path="StartDate" UpdateSourceTrigger="PropertyChanged" NotifyOnValidationError="True"> - <Binding.ValidationRules> - <localrule:DateExpiredRule x:Name="StartDateExpiredRule"/> - </Binding.ValidationRules> - </Binding> - </DatePicker.SelectedDate> - </DatePicker> - </StackPanel> - - <StackPanel Margin="40 0 0 0"> - <TextBlock FontSize="10">End Date:</TextBlock> - <DatePicker x:Name="endDatePicker" materialDesign:HintAssist.Hint="Pick end date" Width="200" VerticalAlignment="Bottom" FontSize="16" SelectedDateChanged="EndDatePicker_SelectedDateChanged"> - <DatePicker.SelectedDate> - <Binding Path="EndDate" UpdateSourceTrigger="PropertyChanged" NotifyOnValidationError="True"> - <Binding.ValidationRules> - <localrule:DateExpiredRule x:Name="EndDateExpiredRule"/> - </Binding.ValidationRules> - </Binding> - </DatePicker.SelectedDate> - </DatePicker> - </StackPanel> - <Button Width="100" Margin="60 0 0 0" Command="{Binding LoadJobRunsCommand}" VerticalAlignment="Bottom" HorizontalAlignment="Right" Content="LOAD"> - <Button.Style> - <Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}"> - <Setter Property="IsEnabled" Value="False"/> - <Style.Triggers> - <MultiDataTrigger> - <MultiDataTrigger.Conditions> - <Condition Binding="{Binding Path=(Validation.HasError), Source={x:Reference startdatePicker}}" Value="False"/> - <Condition Binding="{Binding Path=(Validation.HasError), Source={x:Reference endDatePicker}}" Value="False"/> - </MultiDataTrigger.Conditions> - <Setter Property="IsEnabled" Value="True"/> - </MultiDataTrigger> - </Style.Triggers> - </Style> - </Button.Style> - </Button> - </StackPanel> - - - <UniformGrid Columns="3" Margin="50 20 50 50" Rows="2" Grid.Row="1"> - <Border BorderBrush="{StaticResource Statistics.BorderBrush}" Padding="5" BorderThickness="1" CornerRadius="5" Margin="10"> - <DockPanel> - <TextBlock DockPanel.Dock="Top" FontSize="16" FontWeight="Bold" HorizontalAlignment="Center" Padding="10" Text="{Binding TimelineJobStatusSeries.Title}"></TextBlock> - <lvc:CartesianChart Series="{Binding TimelineJobStatusSeries.SeriesCollection}" LegendLocation="Bottom"> - <lvc:CartesianChart.DataTooltip> - <lvc:DefaultTooltip BulletSize="20" Background="{StaticResource TransparentBackgroundBrush450}" Foreground="{StaticResource Dialog.Foreground}"/> - </lvc:CartesianChart.DataTooltip> - <lvc:CartesianChart.AxisX> - <lvc:Axis Title="{Binding TimelineJobStatusSeries.LabelsTitle}" Labels="{Binding TimelineJobStatusSeries.Labels}" Foreground="{StaticResource DarkGrayBrush200}"> - <lvc:Axis.Separator> - <lvc:Separator Stroke="#A5A5A5" /> - </lvc:Axis.Separator> - </lvc:Axis> - </lvc:CartesianChart.AxisX> - <lvc:CartesianChart.AxisY> - <lvc:Axis Title="{Binding TimelineJobStatusSeries.ChartTitle}" MinValue="0" Foreground="{StaticResource DarkGrayBrush200}" > - <lvc:Axis.Separator> - <lvc:Separator Stroke="#B0B0B0" /> - </lvc:Axis.Separator> - </lvc:Axis> - </lvc:CartesianChart.AxisY> - </lvc:CartesianChart> - </DockPanel> - </Border> - - <Border BorderBrush="{StaticResource Statistics.BorderBrush}" Padding="5" BorderThickness="1" CornerRadius="5" Margin="10"> - <DockPanel> - <TextBlock DockPanel.Dock="Top" FontSize="16" FontWeight="Bold" HorizontalAlignment="Center" Padding="10" Text="{Binding PieJobFailedReasons.Title}"></TextBlock> - <UniformGrid Columns="2"> - <lvc:PieChart DataHover="PieChart_DataHover" Series="{Binding PieJobFailedReasons.SeriesCollection}" LegendLocation="None" Background="Transparent"> - <lvc:PieChart.Resources> - <Style TargetType="lvc:PieSeries"> - <Setter Property="Stroke" Value="#99F9F9F9"></Setter> - <Setter Property="StrokeThickness" Value="2"/> - </Style> - </lvc:PieChart.Resources> - <lvc:PieChart.DataTooltip> - <tooltips:PieChartTooltipControl Visibility="Hidden" /> - </lvc:PieChart.DataTooltip> - </lvc:PieChart> - - <TextBlock x:Name="txtPieTitle" TextWrapping="Wrap"></TextBlock> - </UniformGrid> - </DockPanel> - </Border> - - <Border BorderBrush="{StaticResource Statistics.BorderBrush}" Padding="5" BorderThickness="1" CornerRadius="5" Margin="10"> - <DockPanel> - <TextBlock DockPanel.Dock="Top" FontSize="16" FontWeight="Bold" HorizontalAlignment="Center" Padding="10" Text="{Binding PrintPerWeekSeries.Title}"></TextBlock> - <lvc:CartesianChart Series="{Binding PrintPerWeekSeries.SeriesCollection}" LegendLocation="Bottom" > - <lvc:CartesianChart.Resources> - <Style TargetType="lvc:ColumnSeries"> - <Setter Property="Foreground" Value="{StaticResource DarkGrayBrush200}"></Setter> - </Style> - </lvc:CartesianChart.Resources> - <lvc:CartesianChart.AxisX> - <lvc:Axis Title="{Binding PrintPerWeekSeries.LabelsTitle}" Labels="{Binding PrintPerWeekSeries.Labels}" Foreground="{StaticResource DarkGrayBrush200}"> - <lvc:Axis.Separator> - <lvc:Separator Stroke="#A5A5A5" /> - </lvc:Axis.Separator> - </lvc:Axis> - </lvc:CartesianChart.AxisX> - <lvc:CartesianChart.AxisY> - <lvc:Axis Title="{Binding PrintPerWeekSeries.ChartTitle}" MinValue="0" Foreground="{StaticResource DarkGrayBrush200}" > - <lvc:Axis.Separator> - <lvc:Separator Stroke="#6F6F6F" /> - </lvc:Axis.Separator> - </lvc:Axis> - </lvc:CartesianChart.AxisY> - <lvc:CartesianChart.DataTooltip> - <lvc:DefaultTooltip BulletSize="20" Background="{StaticResource TransparentBackgroundBrush450}" Foreground="{StaticResource Dialog.Foreground}"/> - </lvc:CartesianChart.DataTooltip> - </lvc:CartesianChart> - </DockPanel> - </Border> - </UniformGrid> - </Grid> -</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/ChartsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/ChartsView.xaml.cs deleted file mode 100644 index bd97ed2bc..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/ChartsView.xaml.cs +++ /dev/null @@ -1,74 +0,0 @@ -using LiveCharts; -using LiveCharts.Wpf; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace Tango.MachineStudio.Statistics.Views -{ - /// <summary> - /// Interaction logic for ChartsView.xaml - /// </summary> - public partial class ChartsView : UserControl - { - public ChartsView() - { - InitializeComponent(); - } - private void PieChart_DataHover(object sender, ChartPoint chartPoint) - { - var tooltip = ((chartPoint.ChartView as PieChart).DataTooltip as Tooltips.PieChartTooltipControl).Title; - txtPieTitle.Text = tooltip; - } - private void StartDatePicker_SelectedDateChanged(object sender, SelectionChangedEventArgs e) - { - DatePicker datePickerObj = sender as DatePicker; - if (datePickerObj != null && datePickerObj.SelectedDate != null && endDatePicker.SelectedDate != null) - { - if (datePickerObj.SelectedDate > endDatePicker.SelectedDate) - { - BindingExpression start_be = datePickerObj.GetBindingExpression(DatePicker.SelectedDateProperty); - ValidationError validationError = new ValidationError(StartDateExpiredRule, start_be); - validationError.ErrorContent = "The start time must be less than or equal to end time."; - Validation.MarkInvalid(start_be, validationError); - } - else if (Validation.GetHasError(endDatePicker)) - { - BindingExpression end_be = endDatePicker.GetBindingExpression(DatePicker.SelectedDateProperty); - Validation.ClearInvalid(end_be); - } - } - } - - private void EndDatePicker_SelectedDateChanged(object sender, SelectionChangedEventArgs e) - { - DatePicker datePickerObj = sender as DatePicker; - if (datePickerObj.SelectedDate != null && startdatePicker.SelectedDate != null) - { - if (datePickerObj != null && datePickerObj.SelectedDate < startdatePicker.SelectedDate) - { - BindingExpression end_be = datePickerObj.GetBindingExpression(DatePicker.SelectedDateProperty); - ValidationError validationError = new ValidationError(EndDateExpiredRule, end_be); - validationError.ErrorContent = "The end time must be greater than or equal to the start time."; - Validation.MarkInvalid(end_be, validationError); - } - else if (Validation.GetHasError(startdatePicker)) - { - BindingExpression start_be = startdatePicker.GetBindingExpression(DatePicker.SelectedDateProperty); - Validation.ClearInvalid(start_be); - } - } - } - } -} 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 deleted file mode 100644 index bc99c1bfa..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml +++ /dev/null @@ -1,787 +0,0 @@ -<UserControl x:Class="Tango.MachineStudio.Statistics.Views.JobRunsView" - xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" - xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:sharedConverters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" - xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" - xmlns:localConverters="clr-namespace:Tango.MachineStudio.Statistics.Converters" - xmlns:localrule="clr-namespace:Tango.MachineStudio.Statistics.ValidationRules" - xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" - xmlns:autoComplete="clr-namespace:Tango.AutoComplete.Editors;assembly=Tango.AutoComplete" - xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf" - xmlns:tooltips="clr-namespace:Tango.MachineStudio.Statistics.Tooltips" - xmlns:sys="clr-namespace:System;assembly=mscorlib" - xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL" - xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" - xmlns:local="clr-namespace:Tango.MachineStudio.Statistics.Views" - xmlns:model="clr-namespace:Tango.MachineStudio.Statistics.Models" - xmlns:vs="clr-namespace:Tango.MachineStudio.Statistics.ViewModels" - xmlns:wellknowntypes="clr-namespace:Google.Protobuf.WellKnownTypes;assembly=Google.Protobuf" - mc:Ignorable="d" - 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" /> - <localConverters:DateTimeToStringFormatConverter x:Key="DateTimeToStringFormatConverter" /> - <sharedConverters:DateTimeUTCToShortDateTimeConverter x:Key="DateTimeUTCToShortDateTimeConverter"/> - <localConverters:StringToBoolYesNoNullConverter x:Key="StringToBoolYesNoNullConverter"/> - <localConverters:LiquidTypeToColorConverter x:Key="LiquidTypeToColorConverter"/> - <localConverters:CollectionConverter x:Key="CollectionConverter"/> - <localConverters:StringToFirstLetterConverter x:Key="StringToFirstLetterConverter"/> - <localConverters:MidTankLevelToElementHeightConverter x:Key="MidTankLevelToElementHeightConverter"/> - <localConverters:JobLengthConverter x:Key="JobLengthConverter"/> - <localConverters:NanoLiterToLiterFormatConverter x:Key="NanoLiterToLiterFormatConverter"/> - <localConverters:LiquidQuantityToFormatStringConverter x:Key="LiquidQuantityToFormatStringConverter"/> - <localConverters:TooltipLiquidQuantityFormatConverter x:Key="TooltipLiquidQuantityFormatConverter"/> - - <ResourceDictionary x:Key="SelectAllTextBoxResource"> - <Style TargetType="TextBox"> - <EventSetter Event="GotFocus" Handler="TextBox_GotFocus"></EventSetter> - <EventSetter Event="MouseDown" Handler="TextBox_PreviewMouseUp"></EventSetter> - </Style> - </ResourceDictionary> - - <ObjectDataProvider x:Key="HeadCleaning" MethodName="GetValues" ObjectType="{x:Type sys:Enum}"> - <ObjectDataProvider.MethodParameters> - <x:Type TypeName="vs:HeadCleaningSelectionEnum"/> - </ObjectDataProvider.MethodParameters> - </ObjectDataProvider> - - <Style TargetType="{x:Type TextBlock}" x:Key="WrapText"> - <Setter Property="TextWrapping" Value="Wrap"/> - </Style> - - <Style TargetType="lvc:PieSeries"> - <Setter Property="Stroke" Value="#99F9F9F9"></Setter> - <Setter Property="StrokeThickness" Value="2"/> - <Setter Property="Foreground" Value="#FF1C1C1F" /> - </Style> - <Style TargetType="lvc:PieChart"> - <Setter Property="Background" Value="Transparent"/> - <Setter Property="LegendLocation" Value="None"/> - </Style> - - <DataTemplate x:Key="PopUpDataTemplate"> - <CheckBox VerticalAlignment="Center" FontSize="11" DockPanel.Dock="Left" IsChecked="{Binding IsSelected}" Click="CheckBox_StayChecked" Tag="{Binding Path=ItemsSource, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}},Mode=OneWay}"> - <CheckBox.Content> - <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" Text="{Binding Data}"></TextBlock> - </CheckBox.Content> - </CheckBox> - </DataTemplate> - - <DataTemplate x:Key="PopupBoolDataTemplate"> - <CheckBox VerticalAlignment="Center" FontSize="11" DockPanel.Dock="Left" IsChecked="{Binding IsSelected}" Click="CheckBox_StayChecked" Tag="{Binding Path=ItemsSource, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}},Mode=OneWay}"> - <CheckBox.Content> - <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" Text="{Binding Data, Converter={StaticResource BooleanToYesNoConverter}}"/> - </CheckBox.Content> - </CheckBox> - </DataTemplate> - - - <Style x:Key="{x:Type ToolTip}" TargetType="{x:Type ToolTip}" BasedOn="{StaticResource MaterialDesignToolTip}"> - <Setter Property="Background" Value="{StaticResource Logging.Background}" /> - <Setter Property="Foreground" Value="{StaticResource MainWindow.Foreground}" /> - </Style> - - </UserControl.Resources> - - <Grid IsEnabled="{Binding IsFree}" > - <Grid.ColumnDefinitions> - <ColumnDefinition Width="3*"/> - <ColumnDefinition Width="1*"/> - </Grid.ColumnDefinitions> - <Grid.RowDefinitions> - <RowDefinition Height="Auto"/> - <RowDefinition Height="*"/> - <RowDefinition Height="Auto"/> - </Grid.RowDefinitions> - <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="Auto"/> - </Grid.ColumnDefinitions> - - <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="140" 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 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" BorderBrush="{StaticResource AutoCompleteTextBox.Popup.BorderBrush}" > - <Border.Effect> - <DropShadowEffect Opacity="0.2" /> - </Border.Effect> - <controls:AllSelectedCheckboxList Style="{StaticResource AllSelectedCheckBoxListStyle}" MaxHeight="600" ItemsSource="{Binding SelectedMachines}" Background="{StaticResource ComboBox.Floating.Background}" Foreground="{StaticResource MainWindow.Foreground}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" SelectionMode="Multiple" AllSelected="True" FontSize="11" FontFamily="{StaticResource FontName}"> - <controls:AllSelectedCheckboxList.ItemTemplate> - <DataTemplate > - <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" Text="{Binding Data.SerialNumber}" ToolTip="{Binding Data.SerialNumber}" FontFamily="{StaticResource FontName}" Background="{DynamicResource TransparentBackgroundBrush}" FontSize="11"></TextBlock> - - </DataTemplate> - </controls:AllSelectedCheckboxList.ItemTemplate> - </controls:AllSelectedCheckboxList> - </Border> - </Popup> - </Grid> - </ControlTemplate> - </ToggleButton.Template> - </ToggleButton> - </StackPanel> - - <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> - <Binding Path="StartSelectedDate" UpdateSourceTrigger="PropertyChanged" NotifyOnValidationError="True"> - <Binding.ValidationRules> - <localrule:DateExpiredRule x:Name="StartDateExpiredRule"/> - </Binding.ValidationRules> - </Binding> - </DatePicker.SelectedDate> - </DatePicker> - </StackPanel> - <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> - <Binding Path="EndSelectedDate" UpdateSourceTrigger="PropertyChanged" NotifyOnValidationError="True"> - <Binding.ValidationRules> - <localrule:DateExpiredRule x:Name="EndDateExpiredRule"/> - </Binding.ValidationRules> - </Binding> - </DatePicker.SelectedDate> - - </DatePicker> - </StackPanel> - </StackPanel> - - <StackPanel Orientation="Horizontal" Grid.Row="1"> - <StackPanel Margin="10 10 0 0" Orientation="Vertical" HorizontalAlignment="Center"> - <TextBlock Text="Job Name:" VerticalAlignment="Center" FontSize="11"></TextBlock> - <autoComplete:AutoCompleteTextBox Margin="0 10 0 0" Provider="{Binding JobsProvider}" Width="140" FontSize="11" LoadingContent="Loading..." SelectedItem="{Binding SelectedJob,Mode=TwoWay}" materialDesign:HintAssist.Hint="All" DisplayMember="Name" materialDesign:HintAssist.IsFloating="False"> - <autoComplete:AutoCompleteTextBox.ItemTemplate> - <DataTemplate> - <StackPanel> - <TextBlock Text="{Binding Name}" FontWeight="Bold" FontStyle="Italic"></TextBlock> - </StackPanel> - </DataTemplate> - </autoComplete:AutoCompleteTextBox.ItemTemplate> - </autoComplete:AutoCompleteTextBox> - </StackPanel> - <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> - <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 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 JobRunSelectedSources}" Foreground="{StaticResource MainWindow.Foreground}" ItemTemplate="{StaticResource PopUpDataTemplate}"/> - - </Border> - </Popup> - </Grid> - </ControlTemplate> - </ToggleButton.Template> - </ToggleButton> - </StackPanel> - <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> - <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}, ConverterParameter='No, Yes'}"></Run> - </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 IsGradientSelection}" Foreground="{StaticResource MainWindow.Foreground}" ItemTemplate="{StaticResource PopupBoolDataTemplate}"/> - - </Border> - </Popup> - </Grid> - </ControlTemplate> - </ToggleButton.Template> - </ToggleButton> - </StackPanel> - <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"> - <TextBlock Text="{Binding LengthLowerValue, UpdateSourceTrigger=PropertyChanged}" VerticalAlignment="Center" FontSize="11" Width="30"></TextBlock> - <mahapps:RangeSlider Focusable="True" Height="40" Margin="5 5 5 5" Minimum="0" Maximum="10000" Width="140" ExtendedMode="True" - LowerValue="{Binding LengthLowerValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" - UpperValue="{Binding LengthUpperValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" - VerticalAlignment="Center" IsSnapToTickEnabled="True" FontSize="8"/> - <TextBlock Text="{Binding LengthUpperValue}" VerticalAlignment="Center" FontSize="11" Width="30"></TextBlock> - </StackPanel> - </Border> - </StackPanel> - <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> - <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 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 JobRunSelectedStatuses}" Foreground="{StaticResource MainWindow.Foreground}" ItemTemplate="{StaticResource PopUpDataTemplate}"/> - </Border> - </Popup> - </Grid> - </ControlTemplate> - </ToggleButton.Template> - </ToggleButton> - </StackPanel> - <StackPanel Margin="30 10 0 0" Orientation="Vertical" HorizontalAlignment="Center"> - <TextBlock Text="Threads:" VerticalAlignment="Center" FontSize="11"></TextBlock> - <ToggleButton Width="100" 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 Threads({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 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" BorderBrush="{StaticResource AutoCompleteTextBox.Popup.BorderBrush}" > - <Border.Effect> - <DropShadowEffect Opacity="0.2" /> - </Border.Effect> - <controls:AllSelectedCheckboxList Style="{StaticResource AllSelectedCheckBoxListStyle}" MaxHeight="600" ItemsSource="{Binding SelectedThreads}" Background="{StaticResource ComboBox.Floating.Background}" Foreground="{StaticResource MainWindow.Foreground}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" SelectionMode="Multiple" AllSelected="True" FontSize="11" FontFamily="{StaticResource FontName}"> - <controls:AllSelectedCheckboxList.ItemTemplate> - <DataTemplate > - <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" Text="{Binding Data.Name}" ToolTip="{Binding Data.Name}" FontFamily="{StaticResource FontName}"></TextBlock> - </DataTemplate> - </controls:AllSelectedCheckboxList.ItemTemplate> - </controls:AllSelectedCheckboxList> - </Border> - </Popup> - </Grid> - </ControlTemplate> - </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" Text="{Binding HeadCleaningSelected, Converter={StaticResource EnumToDescriptionConverter}}"> - - </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> - <ListBox x:Name="HeadCleaningListBoxItem" ItemsSource="{Binding Source={StaticResource HeadCleaning}}" Foreground="{StaticResource MainWindow.Foreground}" SelectedItem="{Binding HeadCleaningSelected, Mode=TwoWay}" SelectionMode="Single" > - <ListBox.ItemTemplate> - <DataTemplate> - <CheckBox x:Name="HeadCleaningCheckBox" Selector.IsSelected="True" VerticalAlignment="Center" FontSize="11" DockPanel.Dock="Left" IsChecked="{Binding IsSelected, Mode=TwoWay, RelativeSource={RelativeSource AncestorType={x:Type ListBoxItem}}, UpdateSourceTrigger=PropertyChanged}" Click="CheckBox_PreventUndoCheck"> - <CheckBox.Content> - <TextBlock Margin="5 0 0 0" VerticalAlignment="Center" Text="{Binding Converter={StaticResource EnumToDescriptionConverter}}"/> - </CheckBox.Content> - </CheckBox> - </DataTemplate> - </ListBox.ItemTemplate> - </ListBox> - </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="30 15" Height="Auto" VerticalAlignment="Center" Content="ANALYZE"> - <Button.Style> - <Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}"> - <Setter Property="IsEnabled" Value="False"/> - <Style.Triggers> - <MultiDataTrigger> - <MultiDataTrigger.Conditions> - <Condition Binding="{Binding Path=(Validation.HasError), Source={x:Reference startdatePicker}}" Value="False"/> - <Condition Binding="{Binding Path=(Validation.HasError), Source={x:Reference endDatePicker}}" Value="False"/> - </MultiDataTrigger.Conditions> - <Setter Property="IsEnabled" Value="True"/> - </MultiDataTrigger> - </Style.Triggers> - </Style> - </Button.Style> - </Button> - </Grid> - </Border> - </Grid> - - <DataGrid x:Name="ItemsGrid" GridLinesVisibility="None" Grid.Row="1" Margin="20 0 0 10" SelectionMode="Single" SelectionUnit="FullRow" BorderBrush="{StaticResource borderBrush}" IsReadOnly="True" BorderThickness="1" RowHeight="80" - Background="{StaticResource TransparentBackgroundBrush}" AlternatingRowBackground="{StaticResource Transparent200}" AutoGenerateColumns="False" CanUserReorderColumns="False" - CanUserAddRows="False" CanUserDeleteRows="False" ItemsSource="{Binding JobRuns}" HorizontalScrollBarVisibility="Disabled" CanUserResizeColumns="False" CanUserResizeRows="False" - SelectedItem="{Binding SelectedJobRun}" CanUserSortColumns="True" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" FontSize="11"> - - <DataGrid.Resources> - <Style TargetType="DataGridColumnHeader" BasedOn="{StaticResource {x:Type DataGridColumnHeader}}"> - <Setter Property="HorizontalAlignment" Value="Left"></Setter> - <Setter Property="HorizontalContentAlignment" Value="Left"></Setter> - <Setter Property="Padding" Value="0 8 0 8"></Setter> - <Setter Property="Margin" Value="0 0 0 0"></Setter> - <Setter Property="FontWeight" Value="SemiBold"/> - </Style> - </DataGrid.Resources> - - <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="Center"/> - <Setter Property="HorizontalAlignment" Value="Left"/> - <Setter Property="Margin" Value="0 0 10 0"/> - <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> - <Setter Property="Foreground" Value="{StaticResource AccentColorBrush}" /> - </Trigger> - </Style.Triggers> - </Style> - </DataGrid.CellStyle> - <DataGrid.RowStyle> - <Style TargetType="DataGridRow" BasedOn="{StaticResource {x:Type DataGridRow}}"> - <Setter Property="BorderThickness" Value="0 0 0 1"/> - <Setter Property="BorderBrush" Value="LightGray"/> - <Style.Triggers> - <Trigger Property="IsMouseOver" Value="True"> - <Setter Property="Background" Value="Transparent"></Setter> - <Setter Property="Foreground" Value="{StaticResource AccentColorBrush}" /> - <Setter Property="Cursor" Value="Hand"></Setter> - </Trigger> - <Trigger Property="IsSelected" Value="True"> - <Setter Property="Background" Value="Transparent"></Setter> - </Trigger> - <Trigger Property="IsFocused" Value="True"> - <Setter Property="Background" Value="Transparent"></Setter> - </Trigger> - </Style.Triggers> - </Style> - </DataGrid.RowStyle> - - <DataGrid.Columns> - <DataGridTemplateColumn Header="" Width="50"> - <DataGridTemplateColumn.CellTemplate> - <DataTemplate> - <materialDesign:PackIcon Width="24" Height="24" Margin="8 -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}" Width="50" ElementStyle="{StaticResource WrapText}"/> - <DataGridTextColumn Header="Machine" Binding="{Binding Machine.SerialNumber}" Width="100" ></DataGridTextColumn> - <DataGridTextColumn Header="User" Binding="{Binding User.Contact.FullName,TargetNullValue='PPC',FallbackValue='PPC'}" Width="100" ElementStyle="{StaticResource WrapText}" /> - <DataGridTextColumn Header="Job Name" Binding="{Binding JobRun.JobName}" Width="100" ElementStyle="{StaticResource WrapText}"/> - <DataGridTextColumn Header="Thread" Binding="{Binding Rml.Name}" Width="80" ElementStyle="{StaticResource WrapText}"/> - <DataGridTextColumn Header="Length" Binding="{Binding JobRun.JobLength, StringFormat={}{0:0.00}}" Width="60" /> - <DataGridTextColumn Header="Source" Binding="{Binding JobRun.Source, Converter={StaticResource EnumToDescriptionConverter}}" Width="60" /> - <DataGridTextColumn Header="Upload Duration" Binding="{Binding UploadDuration, Converter={StaticResource DateTimeToStringFormatConverter}, FallbackValue='N/A',TargetNullValue='N/A'}" Width="80"/> - <DataGridTextColumn Header="Heating Duration" Binding="{Binding HeatingDuration, Converter={StaticResource DateTimeToStringFormatConverter}, FallbackValue='N/A',TargetNullValue='N/A'}" Width="80" /> - <DataGridTextColumn Header="Start Time" Binding="{Binding JobRun.ActualStartDate, Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" Width="95" /> - <DataGridTextColumn Header="IsGradient" Binding="{Binding JobRun.IsGradient}" Width="70" /> - <DataGridTextColumn Header="GR" Binding="{Binding JobRun.GradientResolutionCm}" Width="30" /> - <DataGridTextColumn Header="Status" Binding="{Binding JobRun.JobRunStatus, Converter={StaticResource EnumToDescriptionConverter}}" Width="70"/> - <DataGridTextColumn Header="End Time" Binding="{Binding JobRun.EndDate, Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" Width="95" /> - <DataGridTextColumn Header="End Position" Binding="{Binding JobRun.EndPosition, StringFormat={}{0:0.00}}" Width="70" /> - <DataGridTemplateColumn Header="Liquid Quantities" Width="1*"> - <DataGridTemplateColumn.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="Center"/> - <Setter Property="HorizontalAlignment" Value="Stretch"/> - <Setter Property="Margin" Value="0 0 10 0"/> - <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> - <Setter Property="Foreground" Value="{StaticResource AccentColorBrush}" /> - </Trigger> - </Style.Triggers> - </Style> - </DataGridTemplateColumn.CellStyle> - <DataGridTemplateColumn.CellTemplate> - <DataTemplate> - <Grid HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> - <Grid.RowDefinitions> - <RowDefinition Height="1*"/> - <RowDefinition Height="20"/> - </Grid.RowDefinitions> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="1*" MaxWidth="200"/> - </Grid.ColumnDefinitions> - <ItemsControl ItemsSource="{Binding JobRun.LiquidQuantitiesFast,Mode=OneWay}" Margin="0 0 0 0" Height="70"> - <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> - <StackPanel Orientation="Horizontal" IsItemsHost="True"></StackPanel> - </ItemsPanelTemplate> - </ItemsControl.ItemsPanel> - <ItemsControl.ItemTemplate> - <DataTemplate> - <DockPanel ToolTip="{Binding Quantity, Converter={StaticResource TooltipLiquidQuantityFormatConverter}, ConverterParameter='#,#\\'}" ToolTipService.Placement="Center" ToolTipService.VerticalOffset="10"> - <Grid DockPanel.Dock="Top" Height="40" Margin="0 5 8 0" Width="16" > - <Border x:Name="LiquidTypeBorder" BorderThickness="1" BorderBrush="{StaticResource borderBrush}" CornerRadius="2" > - <Canvas x:Name="LiquidCanvas" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Margin="0" ClipToBounds="True" ToolTip="{Binding Quantity}" ToolTipService.Placement="Left" ToolTipService.VerticalOffset="10"> - <Border Height="{Binding RelativeSource={RelativeSource AncestorType=Canvas}, Path=ActualHeight }" Width="{Binding RelativeSource={RelativeSource AncestorType=Canvas}, Path=ActualWidth }" > - <Border.Background> - <SolidColorBrush Color="{Binding LiquidType,Converter={StaticResource LiquidTypeToColorConverter}}" /> - </Border.Background> - <Border.Style> - <Style> - <Setter Property="Canvas.Top" > - <Setter.Value> - <MultiBinding Converter="{StaticResource MidTankLevelToElementHeightConverter}"> - <Binding RelativeSource="{RelativeSource Self}" Path="ActualHeight" /> - <Binding Path="Quantity" /> - </MultiBinding> - </Setter.Value> - </Setter> - </Style> - </Border.Style> - </Border> - <Border Background="Transparent" ToolTip="{Binding Quantity, Converter={StaticResource TooltipLiquidQuantityFormatConverter}, ConverterParameter='#,#\\'}" Height="{Binding RelativeSource={RelativeSource AncestorType=Canvas}, Path=ActualHeight }" Width="{Binding RelativeSource={RelativeSource AncestorType=Canvas}, Path=ActualWidth }"></Border> - </Canvas> - </Border> - </Grid> - <TextBlock DockPanel.Dock="Bottom" FontSize="9" VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0 0 10 0" Text="{Binding LiquidType,Converter={StaticResource StringToFirstLetterConverter}}" Foreground="Gray"/> - </DockPanel> - - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> - <Border Grid.Row="1" Grid.Column="0" Background="Transparent" HorizontalAlignment="Stretch" Height="8" BorderThickness="1" BorderBrush="{StaticResource borderBrush}"> - <Rectangle Margin="0 0 -1 0" Fill="{StaticResource AccentColorBrush}" HorizontalAlignment="Left" VerticalAlignment="Stretch" ToolTip="{Binding JobRun.EndPosition}"> - <Rectangle.Width> - <MultiBinding Converter="{StaticResource JobLengthConverter}"> - <Binding Path="JobRun.JobLength" /> - <Binding Path="JobRun.EndPosition"/> - <Binding Path="ActualWidth" RelativeSource="{RelativeSource AncestorType=Border}"/> - </MultiBinding> - </Rectangle.Width> - </Rectangle> - </Border> - </Grid> - </DataTemplate> - </DataGridTemplateColumn.CellTemplate> - </DataGridTemplateColumn> - </DataGrid.Columns> - </DataGrid> - <Border Grid.Row="1" Grid.Column="1" Grid.RowSpan="2" Margin="20, 0, 20, 20" BorderBrush="{StaticResource borderBrush}" Background="{StaticResource TransparentBackgroundBrush}" BorderThickness="1"> - - <StackPanel> - <TextBlock Margin="10" Text="{Binding SelectedJobName}"></TextBlock> - </StackPanel> - </Border> - <Border Grid.Row="2" Margin="20, 0, 0, 20" Height="200" BorderBrush="{StaticResource borderBrush}" Background="{StaticResource TransparentBackgroundBrush}" BorderThickness="1"> - <Grid > - <Grid.ColumnDefinitions> - <ColumnDefinition Width="*"/> - <ColumnDefinition Width="2"/> - <ColumnDefinition Width="*"/> - <ColumnDefinition Width="2"/> - <ColumnDefinition Width="*"/> - </Grid.ColumnDefinitions> - <Border Grid.Column="0" BorderBrush="{StaticResource borderBrush}" Padding="5" BorderThickness="1" CornerRadius="5" Margin="10"> - <StackPanel Orientation="Vertical" Margin="5"> - <ItemsControl ItemsSource="{Binding StatisticsValueCollection.StatisticsCollection}"> - <ItemsControl.ItemTemplate> - <DataTemplate> - <StackPanel Orientation="Horizontal" Margin="0 3"> - <TextBlock Text="{Binding Name}" FontWeight="SemiBold"/> - <TextBlock Text=": "/> - <TextBlock Text="{Binding Value, StringFormat={}{0:N2}}"/> - <TextBlock Text="{Binding Unit}"/> - </StackPanel> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> - <TextBlock Visibility="Collapsed" Margin="0 10 0 0" Text="Total Thread Consumption per thread:" FontWeight="SemiBold"> - <TextBlock.Style> - <Style TargetType="TextBlock"> - <Setter Property="Visibility" Value="Visible" /> - <Style.Triggers> - <DataTrigger Binding="{Binding StatisticsValueCollection.ThreadConsumptionPerThreadCollection.Count}" Value="0"> - <Setter Property="Visibility" Value="Collapsed" /> - </DataTrigger> - </Style.Triggers> - </Style> - </TextBlock.Style> - </TextBlock> - <ItemsControl Visibility="Collapsed" ItemsSource="{Binding StatisticsValueCollection.ThreadConsumptionPerThreadCollection}"> - <ItemsControl.ItemsPanel> - <ItemsPanelTemplate> - <UniformGrid Rows="3" /> - </ItemsPanelTemplate> - </ItemsControl.ItemsPanel> - <ItemsControl.Resources> - <DataTemplate DataType="{x:Type model:StatisticsValue}"> - <StackPanel Orientation="Horizontal"> - <TextBlock Text="{Binding Name}" FontWeight="SemiBold"/> - <TextBlock Text=": "/> - <TextBlock Text="{Binding Value, StringFormat={}{0:0.0}}"/> - <TextBlock Text="{Binding Unit}"/> - </StackPanel> - </DataTemplate> - <DataTemplate DataType="{x:Type model:MoreValue}"> - <Border BorderThickness="0"> - <TextBlock Text="{Binding Text}" Tag="{Binding Path=DataContext.StatisticsValueCollection.ThreadConsumptionPerThread, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ItemsControl}}}" HorizontalAlignment="Left" VerticalAlignment="Center" > - <TextBlock.ToolTip > - <ToolTip DataContext="{Binding RelativeSource={RelativeSource Self},Path=PlacementTarget.Tag}" Placement="Right" Background="{StaticResource Logging.Background}"> - <Border CornerRadius="5"> - <ItemsControl ItemsSource="{Binding }"> - <ItemsControl.ItemTemplate> - <DataTemplate> - <StackPanel Orientation="Horizontal" Margin="2"> - <TextBlock Margin="5 0 0 0" Text="{Binding Name}" FontWeight="SemiBold"/> - <TextBlock Text=": "/> - <TextBlock Text="{Binding Value, StringFormat={}{0:N0}}"/> - <TextBlock Text="{Binding Unit}"/> - </StackPanel> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> - </Border> - </ToolTip> - </TextBlock.ToolTip> - </TextBlock> - </Border> - </DataTemplate> - </ItemsControl.Resources> - </ItemsControl> - </StackPanel> - </Border> - <Border Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Stretch" Width="2" Background="{StaticResource borderBrush}" Margin="0 4" Visibility="Visible"></Border> - <Border Grid.Column="2" BorderBrush="{StaticResource borderBrush}" Padding="5" BorderThickness="1" CornerRadius="5" Margin="10"> - <DockPanel> - <UniformGrid Columns="3"> - <DockPanel> - <TextBlock DockPanel.Dock="Top" FontSize="12" FontWeight="Bold" HorizontalAlignment="Center" Padding="2" Text="PPC/MS"></TextBlock> - <lvc:PieChart Series="{Binding StatisticsValueCollection.PieJobSource.SeriesCollection}" > - <lvc:PieChart.DataTooltip> - <tooltips:PieChartTooltipControl Visibility="Visible" /> - </lvc:PieChart.DataTooltip> - </lvc:PieChart> - </DockPanel> - <DockPanel> - <TextBlock DockPanel.Dock="Top" FontSize="12" FontWeight="Bold" HorizontalAlignment="Center" Padding="2" Text="Failed/Aborted/Completed"></TextBlock> - <lvc:PieChart Series="{Binding StatisticsValueCollection.PieJobRunStatus.SeriesCollection}"> - <lvc:PieChart.DataTooltip> - <tooltips:PieChartTooltipControl Visibility="Visible" /> - </lvc:PieChart.DataTooltip> - </lvc:PieChart> - </DockPanel> - <DockPanel> - <TextBlock DockPanel.Dock="Top" FontSize="12" FontWeight="Bold" HorizontalAlignment="Center" Padding="2" Text="Gradient/Solid"></TextBlock> - <lvc:PieChart Series="{Binding StatisticsValueCollection.PieGradientSolid.SeriesCollection}" > - <lvc:PieChart.DataTooltip> - <tooltips:PieChartTooltipControl Visibility="Visible" /> - </lvc:PieChart.DataTooltip> - </lvc:PieChart> - </DockPanel> - </UniformGrid> - </DockPanel> - </Border> - - <Border Grid.Column="3" HorizontalAlignment="Center" VerticalAlignment="Stretch" Width="2" Background="{StaticResource borderBrush}" Margin="0 6" CornerRadius="1"/> - - <Border Grid.Column="4" BorderBrush="{StaticResource borderBrush}" Padding="5" BorderThickness="1" CornerRadius="5" Margin="10"> - <DockPanel> - <ItemsControl DockPanel.Dock="Top" ItemsSource="{Binding StatisticsValueCollection.LiquidQuantities}"> - <ItemsControl.ItemsPanel> - <ItemsPanelTemplate> - <UniformGrid Columns="3"/> - </ItemsPanelTemplate> - </ItemsControl.ItemsPanel> - <ItemsControl.ItemTemplate> - <DataTemplate> - <Border Background="Transparent" ToolTip="{Binding Quantity, Converter={StaticResource TooltipLiquidQuantityFormatConverter}, ConverterParameter='#,#\\'}"> - <StackPanel Orientation="Horizontal" Margin="4"> - <Ellipse Width="30" Height="30"> - <Ellipse.Fill> - <SolidColorBrush Color="{Binding LiquidType,Converter={StaticResource LiquidTypeToColorConverter}}" /> - </Ellipse.Fill> - </Ellipse> - <StackPanel Orientation="Vertical" Margin="4"> - <TextBlock Text="{Binding LiquidType,Converter={StaticResource EnumToDescriptionConverter}}" FontWeight="SemiBold"></TextBlock> - <TextBlock > - <Run Text="{Binding Quantity, Converter={StaticResource NanoLiterToLiterFormatConverter}, ConverterParameter='0.00'}"></Run> - <Run Text=" liters"></Run> - </TextBlock> - </StackPanel> - </StackPanel> - </Border> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> - <Border Background="Transparent" ToolTip="{Binding StatisticsValueCollection.TotalLiquidQuantities, Converter={StaticResource TooltipLiquidQuantityFormatConverter}, ConverterParameter='#,#\\'}"> - <TextBlock DockPanel.Dock="Bottom" Margin="4 10 0 0 "> - <Run Text="Total liquid quantities for all: " FontWeight="SemiBold"/> - <Run Text="{Binding StatisticsValueCollection.TotalLiquidQuantities, Converter={StaticResource NanoLiterToLiterFormatConverter}, ConverterParameter='0.00'}"></Run> - <Run Text=" liters"></Run> - <TextBlock.Style> - <Style TargetType="TextBlock"> - <Setter Property="Visibility" Value="Visible" /> - <Style.Triggers> - <DataTrigger Binding="{Binding StatisticsValueCollection.LiquidQuantities.Count}" Value="0"> - <Setter Property="Visibility" Value="Collapsed" /> - </DataTrigger> - </Style.Triggers> - </Style> - </TextBlock.Style> - </TextBlock> - </Border> - </DockPanel> - </Border> - </Grid> - </Border> - <Grid Grid.Row="0" Grid.Column="1" Margin="20 0 20 0"> - <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> - - <Button Grid.Column="1" HorizontalAlignment="Right" Command="{Binding ExportToExcelCommand}" Margin="0 0 10 0" Padding="10 15" Height="Auto" VerticalAlignment="Center" Width="Auto">EXPORT TO EXCEL</Button> - </Border> - </Grid> - </Grid> -</UserControl> 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 deleted file mode 100644 index 961d7f691..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/JobRunsView.xaml.cs +++ /dev/null @@ -1,175 +0,0 @@ -using LiveCharts; -using LiveCharts.Wpf; -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; -using Tango.SharedUI.Components; - -namespace Tango.MachineStudio.Statistics.Views -{ - /// <summary> - /// Interaction logic for JobRunsView.xaml - /// </summary> - public partial class JobRunsView : UserControl - { - private int _lastSelectedGridItemIndex; - public JobRunsView() - { - InitializeComponent(); - _lastSelectedGridItemIndex = -1; - } - - - private void Button_Click(object sender, RoutedEventArgs e) - { - 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); - TextBox txtBox = sender as TextBox; - txtBox.SelectAll(); - } - - private void TextBox_PreviewMouseUp(object sender, MouseButtonEventArgs e) - { - e.Handled = true; - } - - private void SelectMachineButton_Click(object sender, RoutedEventArgs e) - { - selectThreadsButton.IsChecked = true; - 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; - _lastSelectedGridItemIndex = -1; - if (e.AddedItems != null && e.AddedItems.Count > 0) - { - DataGridRow row = (DataGridRow)dataGrid.ItemContainerGenerator.ContainerFromItem(e.AddedItems[0]); - if (row != null) - { - _lastSelectedGridItemIndex = row.GetIndex(); - } - } - } - - private void StartDatePicker_SelectedDateChanged(object sender, SelectionChangedEventArgs e) - { - DatePicker datePickerObj = sender as DatePicker; - if(datePickerObj != null && datePickerObj.SelectedDate != null && endDatePicker.SelectedDate != null) - { - if(datePickerObj.SelectedDate> endDatePicker.SelectedDate) - { - BindingExpression start_be = datePickerObj.GetBindingExpression(DatePicker.SelectedDateProperty); - ValidationError validationError = new ValidationError(StartDateExpiredRule, start_be); - validationError.ErrorContent = "The start time must be less than or equal to end time."; - Validation.MarkInvalid(start_be, validationError); - } - else if (Validation.GetHasError(endDatePicker)) - { - BindingExpression end_be = endDatePicker.GetBindingExpression(DatePicker.SelectedDateProperty); - Validation.ClearInvalid(end_be); - } - } - } - - private void EndDatePicker_SelectedDateChanged(object sender, SelectionChangedEventArgs e) - { - DatePicker datePickerObj = sender as DatePicker; - if (datePickerObj.SelectedDate != null && startdatePicker.SelectedDate != null ) - { - if(datePickerObj != null && datePickerObj.SelectedDate < startdatePicker.SelectedDate) - { - BindingExpression end_be = datePickerObj.GetBindingExpression(DatePicker.SelectedDateProperty); - ValidationError validationError = new ValidationError(EndDateExpiredRule, end_be); - validationError.ErrorContent = "The end time must be greater than or equal to the start time."; - Validation.MarkInvalid(end_be, validationError); - } - else if (Validation.GetHasError(startdatePicker)) - { - BindingExpression start_be = startdatePicker.GetBindingExpression(DatePicker.SelectedDateProperty); - Validation.ClearInvalid(start_be); - } - } - } - - private void CheckBox_PreventUndoCheck(object sender, RoutedEventArgs e) - { - if( sender is CheckBox) - { - CheckBox cb = sender as CheckBox; - if (cb.IsChecked == false) - { - cb.IsChecked = true; - e.Handled = true; - return; - } - } - e.Handled = false; - } - private void CheckBox_StayChecked(object sender, RoutedEventArgs e) - { - if (sender is CheckBox) - { - CheckBox cb = sender as CheckBox; - if (cb.IsChecked == false) - { - var col = cb.Tag; - Type type = col.GetType(); - if (col != null && col.GetType().GetGenericTypeDefinition() == typeof(SelectedObjectCollection<>)) - { - dynamic dSynchedSource = type.GetProperty("SynchedSource").GetValue(col); - if(dSynchedSource != null && dSynchedSource.GetType().GetGenericTypeDefinition() == typeof(ObservableCollection<>) && dSynchedSource.Count == 0) - { - cb.IsChecked = true; - e.Handled = true; - return; - } - } - } - } - e.Handled = false; - } - - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/MainView.xaml index 21c099db9..55804c7b3 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/MainView.xaml @@ -11,28 +11,100 @@ xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf" mc:Ignorable="d" d:DesignHeight="1080" d:DesignWidth="1920" Background="Transparent" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> - <Grid> + <Grid IsEnabled="{Binding IsFree}"> <Grid.RowDefinitions> - <RowDefinition Height="1*"/> - <RowDefinition Height="20"/> + <RowDefinition Height="80"/> + <RowDefinition Height="337*"/> </Grid.RowDefinitions> - <Grid Grid.Row="0" IsEnabled="{Binding IsFree}"> - <TabControl Background="Transparent" Margin="0,40,0,0" x:Name="chartsTabControl" Padding="0 25 0 0"> - <TabControl.Resources> - <Style TargetType="TabPanel"> - <Setter Property="HorizontalAlignment" Value="Center"/> - </Style> - <Style TargetType="TabItem" BasedOn="{StaticResource {x:Type TabItem}}"> - <Setter Property="Padding" Value="20,2"></Setter> - </Style> - </TabControl.Resources> - <TabItem Header="JOB RUNS" Margin="-100 0 0 0 "> - <local:JobRunsView x:Name="jobRunsView" DataContext="{Binding JobRunsViewVM}"/> - </TabItem> - <TabItem Header="STATS" Margin="-100 0 0 0 "> - <local:ChartsView x:Name="processParametersView" DataContext="{Binding ChartsViewVM}"/> - </TabItem> - </TabControl> - </Grid> + + <StackPanel Margin="60 20 0 0" VerticalAlignment="Center" HorizontalAlignment="Left" Orientation="Horizontal"> + <StackPanel> + <TextBlock FontSize="10">Start Date:</TextBlock> + <DatePicker DisplayDateStart="{Binding MinDate}" DisplayDateEnd="{Binding MaxDate}" SelectedDate="{Binding StartDate}" materialDesign:HintAssist.Hint="Pick start date" Width="200" VerticalAlignment="Bottom" FontSize="16"></DatePicker> + </StackPanel> + + <StackPanel Margin="40 0 0 0"> + <TextBlock FontSize="10">End Date:</TextBlock> + <DatePicker DisplayDateStart="{Binding MinDate}" DisplayDateEnd="{Binding MaxDate}" SelectedDate="{Binding EndDate}" materialDesign:HintAssist.Hint="Pick end date" Width="200" VerticalAlignment="Bottom" FontSize="16"></DatePicker> + </StackPanel> + </StackPanel> + + <UniformGrid Columns="3" Margin="50 20 50 50" Rows="2" Grid.Row="1"> + <Border BorderBrush="{StaticResource Statistics.BorderBrush}" Padding="5" BorderThickness="1" CornerRadius="5" Margin="10"> + <DockPanel> + <TextBlock DockPanel.Dock="Top" FontSize="16" FontWeight="Bold" HorizontalAlignment="Center" Padding="10" Text="{Binding TimelineJobStatusSeries.Title}"></TextBlock> + <lvc:CartesianChart Series="{Binding TimelineJobStatusSeries.SeriesCollection}" LegendLocation="Bottom" SeriesColors="{Binding TimelineJobStatusSeries.SeriesColors}"> + <lvc:CartesianChart.DataTooltip> + <lvc:DefaultTooltip BulletSize="20" Background="{StaticResource TransparentBackgroundBrush450}" Foreground="{StaticResource Dialog.Foreground}"/> + </lvc:CartesianChart.DataTooltip> + <lvc:CartesianChart.AxisX> + <lvc:Axis Title="{Binding TimelineJobStatusSeries.LabelsTitle}" Labels="{Binding TimelineJobStatusSeries.Labels}" Foreground="{StaticResource DarkGrayBrush200}"> + <lvc:Axis.Separator> + <lvc:Separator Stroke="#A5A5A5" /> + </lvc:Axis.Separator> + </lvc:Axis> + </lvc:CartesianChart.AxisX> + <lvc:CartesianChart.AxisY> + <lvc:Axis Title="{Binding TimelineJobStatusSeries.ChartTitle}" MinValue="0" Foreground="{StaticResource DarkGrayBrush200}" > + <lvc:Axis.Separator> + <lvc:Separator Stroke="#B0B0B0" /> + </lvc:Axis.Separator> + </lvc:Axis> + </lvc:CartesianChart.AxisY> + </lvc:CartesianChart> + </DockPanel> + </Border> + + <Border BorderBrush="{StaticResource Statistics.BorderBrush}" Padding="5" BorderThickness="1" CornerRadius="5" Margin="10"> + <DockPanel> + <TextBlock DockPanel.Dock="Top" FontSize="16" FontWeight="Bold" HorizontalAlignment="Center" Padding="10" Text="{Binding PieJobFailedReasons.Title}"></TextBlock> + <UniformGrid Columns="2"> + <lvc:PieChart DataHover="PieChart_DataHover" Series="{Binding PieJobFailedReasons.SeriesCollection}" LegendLocation="None" SeriesColors="{Binding PieJobFailedReasons.SeriesColors}" Background="Transparent"> + <lvc:PieChart.Resources> + <Style TargetType="lvc:PieSeries"> + <Setter Property="Stroke" Value="#99F9F9F9"></Setter> + <Setter Property="StrokeThickness" Value="2"/> + </Style> + </lvc:PieChart.Resources> + <lvc:PieChart.DataTooltip> + <tooltips:PieChartTooltipControl Visibility="Hidden" /> + </lvc:PieChart.DataTooltip> + </lvc:PieChart> + + <TextBlock x:Name="txtPieTitle" TextWrapping="Wrap"></TextBlock> + </UniformGrid> + </DockPanel> + </Border> + + <Border BorderBrush="{StaticResource Statistics.BorderBrush}" Padding="5" BorderThickness="1" CornerRadius="5" Margin="10"> + <DockPanel> + <TextBlock DockPanel.Dock="Top" FontSize="16" FontWeight="Bold" HorizontalAlignment="Center" Padding="10" Text="{Binding PrintPerWeekSeries.Title}"></TextBlock> + <lvc:CartesianChart Series="{Binding PrintPerWeekSeries.SeriesCollection}" LegendLocation="Bottom" SeriesColors="{Binding PrintPerWeekSeries.SeriesColors}" > + <lvc:CartesianChart.Resources> + <Style TargetType="lvc:ColumnSeries"> + <Setter Property="Foreground" Value="{StaticResource DarkGrayBrush200}"></Setter> + </Style> + </lvc:CartesianChart.Resources> + <lvc:CartesianChart.AxisX> + <lvc:Axis Title="{Binding PrintPerWeekSeries.LabelsTitle}" Labels="{Binding PrintPerWeekSeries.Labels}" Foreground="{StaticResource DarkGrayBrush200}"> + <lvc:Axis.Separator> + <lvc:Separator Stroke="#A5A5A5" /> + </lvc:Axis.Separator> + </lvc:Axis> + </lvc:CartesianChart.AxisX> + <lvc:CartesianChart.AxisY> + <lvc:Axis Title="{Binding PrintPerWeekSeries.ChartTitle}" MinValue="0" Foreground="{StaticResource DarkGrayBrush200}" > + <lvc:Axis.Separator> + <lvc:Separator Stroke="#6F6F6F" /> + </lvc:Axis.Separator> + </lvc:Axis> + </lvc:CartesianChart.AxisY> + <lvc:CartesianChart.DataTooltip> + <lvc:DefaultTooltip BulletSize="20" Background="{StaticResource TransparentBackgroundBrush450}" Foreground="{StaticResource Dialog.Foreground}"/> + </lvc:CartesianChart.DataTooltip> + </lvc:CartesianChart> + </DockPanel> + </Border> + </UniformGrid> </Grid> </UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/MainView.xaml.cs index f0d1c39a7..3948c4e5a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/MainView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Statistics/Views/MainView.xaml.cs @@ -28,6 +28,10 @@ namespace Tango.MachineStudio.Statistics.Views InitializeComponent(); } - + private void PieChart_DataHover(object sender, ChartPoint chartPoint) + { + var tooltip = ((chartPoint.ChartView as PieChart).DataTooltip as Tooltips.PieChartTooltipControl).Title; + txtPieTitle.Text = tooltip; + } } } |
