aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/FSE
diff options
context:
space:
mode:
authorRoy Ben Shabat <Roy.mail.net@gmail.com>2024-07-14 23:06:47 +0300
committerRoy Ben Shabat <Roy.mail.net@gmail.com>2024-07-14 23:06:47 +0300
commitc03fb4a1b2aadd8952b321d08ca840e55fcee72d (patch)
tree453cc2986a60c87ddff21bff348d6d35d7ed1c2e /Software/Visual_Studio/FSE
parent70c0c5921c3c124779ec0d603e43d72e67def63f (diff)
downloadTango-c03fb4a1b2aadd8952b321d08ca840e55fcee72d.tar.gz
Tango-c03fb4a1b2aadd8952b321d08ca840e55fcee72d.zip
Revision of statistics and resumed jobs.
Diffstat (limited to 'Software/Visual_Studio/FSE')
-rw-r--r--Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Controls/RangeProgressBar.cs81
-rw-r--r--Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Models/StopModel.cs33
-rw-r--r--Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Tango.FSE.Statistics.csproj1
-rw-r--r--Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Themes/Generic.xaml17
-rw-r--r--Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/ViewModels/MainViewVM.cs4
-rw-r--r--Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Views/MainView.xaml17
6 files changed, 149 insertions, 4 deletions
diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Controls/RangeProgressBar.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Controls/RangeProgressBar.cs
new file mode 100644
index 000000000..0d18bb4ca
--- /dev/null
+++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Controls/RangeProgressBar.cs
@@ -0,0 +1,81 @@
+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.FSE.Diagnostics.Controls
+{
+ public class RangeProgressBar : Control
+ {
+ private Border _innerBorder;
+ private Border _outerBorder;
+
+ static RangeProgressBar()
+ {
+ DefaultStyleKeyProperty.OverrideMetadata(typeof(RangeProgressBar), new FrameworkPropertyMetadata(typeof(RangeProgressBar)));
+ }
+
+ public Brush FillBrush
+ {
+ get { return (Brush)GetValue(FillBrushProperty); }
+ set { SetValue(FillBrushProperty, value); }
+ }
+ public static readonly DependencyProperty FillBrushProperty =
+ DependencyProperty.Register("FillBrush", typeof(Brush), typeof(RangeProgressBar), new PropertyMetadata(Brushes.Red));
+
+ public double Maximum
+ {
+ get { return (double)GetValue(MaximumProperty); }
+ set { SetValue(MaximumProperty, value); }
+ }
+ public static readonly DependencyProperty MaximumProperty =
+ DependencyProperty.Register("Maximum", typeof(double), typeof(RangeProgressBar), new PropertyMetadata(100.0));
+
+ public double LowerValue
+ {
+ get { return (double)GetValue(LowerValueProperty); }
+ set { SetValue(LowerValueProperty, value); }
+ }
+ public static readonly DependencyProperty LowerValueProperty =
+ DependencyProperty.Register("LowerValue", typeof(double), typeof(RangeProgressBar), new PropertyMetadata(20.0));
+
+ public double UpperValue
+ {
+ get { return (double)GetValue(UpperValueProperty); }
+ set { SetValue(UpperValueProperty, value); }
+ }
+ public static readonly DependencyProperty UpperValueProperty =
+ DependencyProperty.Register("UpperValue", typeof(double), typeof(RangeProgressBar), new PropertyMetadata(80.0));
+
+ public override void OnApplyTemplate()
+ {
+ base.OnApplyTemplate();
+ _innerBorder = GetTemplateChild("PART_InnerBorder") as Border;
+ _outerBorder = GetTemplateChild("PART_OuterBorder") as Border;
+
+ PlaceInnerBorder();
+ SizeChanged -= RangeProgressBar_SizeChanged;
+ SizeChanged += RangeProgressBar_SizeChanged;
+ }
+
+ private void RangeProgressBar_SizeChanged(object sender, SizeChangedEventArgs e)
+ {
+ PlaceInnerBorder();
+ }
+
+ private void PlaceInnerBorder()
+ {
+ _innerBorder.Margin = new Thickness(LowerValue / Maximum * _outerBorder.ActualWidth, 0, _outerBorder.ActualWidth - (UpperValue / Maximum * _outerBorder.ActualWidth), 0);
+ }
+ }
+}
diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Models/StopModel.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Models/StopModel.cs
index 3d616f957..d979fe55b 100644
--- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Models/StopModel.cs
+++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Models/StopModel.cs
@@ -178,6 +178,31 @@ namespace Tango.FSE.Statistics.Models
get { return IsEureka ? JobRun.EndPosition * 4 : JobRun.EndPosition; }
}
+ public double ActualStartPosition
+ {
+ get { return IsEureka ? JobRun.ActualStartPosition * 4 : JobRun.ActualStartPosition; }
+ }
+
+ public double ActualEndPosition
+ {
+ get
+ {
+ if (JobRun.ActualEndPosition > 0)
+ {
+ return IsEureka ? JobRun.ActualEndPosition * 4 : JobRun.ActualEndPosition;
+ }
+ else
+ {
+ return IsEureka ? JobRun.EndPosition * 4 : JobRun.EndPosition;
+ }
+ }
+ }
+
+ public double ActualLength
+ {
+ get { return IsEureka ? JobRun.JobLogicalLength * 4 : JobRun.JobLogicalLength; }
+ }
+
public String FineTuningMeasured
{
get
@@ -244,5 +269,13 @@ namespace Tango.FSE.Statistics.Models
}
private set { _fineTuningDeltaE = value; }
}
+
+ public double Distance
+ {
+ get
+ {
+ return ActualEndPosition - ActualStartPosition;
+ }
+ }
}
}
diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Tango.FSE.Statistics.csproj b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Tango.FSE.Statistics.csproj
index 3ca736b8a..fcfb157e6 100644
--- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Tango.FSE.Statistics.csproj
+++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Tango.FSE.Statistics.csproj
@@ -105,6 +105,7 @@
<Compile Include="..\..\..\MachineStudio\Modules\Tango.MachineStudio.Developer\Controls\JobOutlineControl.cs">
<Link>Controls\JobOutlineControl.cs</Link>
</Compile>
+ <Compile Include="Controls\RangeProgressBar.cs" />
<Compile Include="Dialogs\JobRunExtendedInfoView.xaml.cs">
<DependentUpon>JobRunExtendedInfoView.xaml</DependentUpon>
</Compile>
diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Themes/Generic.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Themes/Generic.xaml
index 2c6475626..313a46355 100644
--- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Themes/Generic.xaml
+++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Themes/Generic.xaml
@@ -1,9 +1,26 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:material="http://materialdesigninxaml.net/winfx/xaml/themes"
+ xmlns:controls="clr-namespace:Tango.FSE.Statistics.Controls"
xmlns:local="clr-namespace:Tango.FSE.Statistics.Themes">
<BitmapImage x:Key="jobImage" UriSource="../Images/cmyk.png" />
+ <Style TargetType="{x:Type controls:RangeProgressBar}">
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="{x:Type controls:RangeProgressBar}">
+ <Border x:Name="PART_OuterBorder" Background="{TemplateBinding Background}"
+ BorderBrush="{TemplateBinding BorderBrush}"
+ BorderThickness="{TemplateBinding BorderThickness}">
+ <Border x:Name="PART_InnerBorder" Background="{TemplateBinding FillBrush}">
+
+ </Border>
+ </Border>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+
</ResourceDictionary> \ No newline at end of file
diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/ViewModels/MainViewVM.cs b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/ViewModels/MainViewVM.cs
index 538e8a795..a21619aac 100644
--- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/ViewModels/MainViewVM.cs
@@ -487,8 +487,8 @@ namespace Tango.FSE.Statistics.ViewModels
stats.CompletedRuns = _model.StatisticsResult.JobRuns.Count(x => x.JobRun.Status == (int)JobRunStatus.Completed);
stats.FailedRuns = _model.StatisticsResult.JobRuns.Count(x => x.JobRun.Status == (int)JobRunStatus.Failed);
stats.AbortedRuns = _model.StatisticsResult.JobRuns.Count(x => x.JobRun.Status == (int)JobRunStatus.Aborted);
- stats.TotalDyeingLength = (int)_model.StatisticsResult.JobRuns.Where(x => x.JobRun.EndPosition > 0).Select(x => x.JobRun.EndPosition).Sum();
- stats.AverageDyeingLength = (int)_model.StatisticsResult.JobRuns.Where(x => x.JobRun.EndPosition > 0).Select(x => x.JobRun.EndPosition).Average();
+ stats.TotalDyeingLength = (int)_model.StatisticsResult.JobRuns.Where(x => x.JobRun.EndPosition > 0).Select(x => x.Distance).Sum();
+ stats.AverageDyeingLength = (int)_model.StatisticsResult.JobRuns.Where(x => x.JobRun.EndPosition > 0).Select(x => x.Distance).Average();
var timeRuns = _model.StatisticsResult.JobRuns.Where(z => z.JobRun.EndPosition > 0 && z.JobRun.EndDate != null && z.JobRun.ActualStartDate != null).ToList();
diff --git a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Views/MainView.xaml b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Views/MainView.xaml
index 590192e28..0e1d8cb60 100644
--- a/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Views/MainView.xaml
+++ b/Software/Visual_Studio/FSE/Modules/Tango.FSE.Statistics/Views/MainView.xaml
@@ -10,6 +10,7 @@
xmlns:autoComplete="clr-namespace:Tango.AutoComplete.Editors;assembly=Tango.AutoComplete"
xmlns:material="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
+ xmlns:localControls="clr-namespace:Tango.FSE.Statistics.Controls"
xmlns:local="clr-namespace:Tango.FSE.Statistics.Views"
mc:Ignorable="d"
d:DesignHeight="720" d:DesignWidth="1280" Background="{StaticResource FSE_PrimaryBackgroundBrush}" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}">
@@ -144,7 +145,19 @@
</TextBlock>
<TextBlock Text="{Binding Items[0].Items[0].JobRun.StartDate,Converter={StaticResource DateTimeUTCToShortDateTimeConverter}}" VerticalAlignment="Center" Width="120"></TextBlock>
<TextBlock Text="{Binding Items[0].Items[0].Duration,Mode=OneWay,Converter={StaticResource TotalDyeTimeConverter}}" VerticalAlignment="Center" Width="100"></TextBlock>
- <TextBlock Text="{Binding Items[0].Items[0].EndPosition,StringFormat=N1}" VerticalAlignment="Center" Width="80"></TextBlock>
+ <StackPanel VerticalAlignment="Center" Width="80" Background="Transparent" ToolTipService.InitialShowDelay="0">
+ <StackPanel.ToolTip>
+ <ToolTip>
+ <StackPanel Orientation="Horizontal">
+ <TextBlock Text="{Binding Items[0].Items[0].ActualStartPosition,Mode=OneWay,StringFormat=N1}"></TextBlock>
+ <material:PackIcon VerticalAlignment="Center" Margin="10 0" Kind="ArrowRight" Width="14" Foreground="{StaticResource FSE_PrimaryAccentBrush}"></material:PackIcon>
+ <TextBlock Text="{Binding Items[0].Items[0].ActualEndPosition,Mode=OneWay,StringFormat=N1}"></TextBlock>
+ </StackPanel>
+ </ToolTip>
+ </StackPanel.ToolTip>
+ <TextBlock HorizontalAlignment="Left" FontSize="{StaticResource FSE_SmallerFontSize}" Text="{Binding Items[0].Items[0].Distance,StringFormat=N1}" VerticalAlignment="Center"></TextBlock>
+ <localControls:RangeProgressBar ClipToBounds="True" Height="4" Maximum="{Binding Items[0].Items[0].ActualLength}" LowerValue="{Binding Items[0].Items[0].ActualStartPosition}" UpperValue="{Binding Items[0].Items[0].ActualEndPosition}" Background="Gray" FillBrush="{StaticResource FSE_PrimaryAccentBrush}"/>
+ </StackPanel>
</StackPanel>
<Grid Visibility="{Binding IsAdvancedMode,Converter={StaticResource BooleanToVisibilityConverter}}" DataContext="{Binding Items[0].Items[0]}" Width="250" Margin="0 0 50 5" HorizontalAlignment="Right" VerticalAlignment="Bottom">
@@ -258,7 +271,7 @@
<DataGridTextColumn Header="LENGTH" Width="80" CellStyle="{StaticResource EmptyColumnStyle2}" />
<DataGridTextColumn Header="START TIME" Width="120" CellStyle="{StaticResource EmptyColumnStyle2}" />
<DataGridTextColumn Header="DURATION" Width="100" CellStyle="{StaticResource EmptyColumnStyle2}" />
- <DataGridTextColumn Header="END POINT" Width="100" CellStyle="{StaticResource EmptyColumnStyle2}" />
+ <DataGridTextColumn Header="DISTANCE" Width="100" CellStyle="{StaticResource EmptyColumnStyle2}" />
<DataGridTextColumn Header="OFFSET" Width="75" Binding="{Binding StartMeters}" />
<DataGridTextColumn Header="COLOR SPACE" Width="120" Binding="{Binding ColorSpace}" />
<DataGridTemplateColumn Header="INPUT" Width="150">