diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2023-05-22 18:54:00 +0300 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2023-05-22 18:54:00 +0300 |
| commit | b981d43669a2cdcd9f7971e897ded9f1422f5b31 (patch) | |
| tree | b42b4dcf7a74788d0ae5388c96311a9ecb9c8047 /Software/Visual_Studio/FSE/Tango.FSE.Common | |
| parent | 7b97669957c3de66ffbad0dba26db1396c679a48 (diff) | |
| download | Tango-b981d43669a2cdcd9f7971e897ded9f1422f5b31.tar.gz Tango-b981d43669a2cdcd9f7971e897ded9f1422f5b31.zip | |
FSE, update Job length for Eureka. GeneralInformation in PPC ( about) - added rows.
Related Work Items: #8423
Diffstat (limited to 'Software/Visual_Studio/FSE/Tango.FSE.Common')
6 files changed, 119 insertions, 3 deletions
diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/RunningJobRingProgress.xaml b/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/RunningJobRingProgress.xaml index d0121afa5..b683ae0d2 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/RunningJobRingProgress.xaml +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/RunningJobRingProgress.xaml @@ -5,9 +5,14 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:behaviors="clr-namespace:Tango.FSE.Common.Behaviors" xmlns:local="clr-namespace:Tango.FSE.Common.Controls" + xmlns:localConverters="clr-namespace:Tango.FSE.Common.Converters" xmlns:material="http://materialdesigninxaml.net/winfx/xaml/themes" mc:Ignorable="d" d:DesignHeight="450" d:DesignWidth="450" x:Name="control"> + <UserControl.Resources> + <localConverters:ProgressLengthSpoolConverter x:Key="ProgressLengthSpoolConverter"/> + </UserControl.Resources> + <Grid Opacity="0.7"> <Viewbox> <Grid> @@ -50,10 +55,31 @@ <TextBlock Margin="5 0 0 0" VerticalAlignment="Center">Completed</TextBlock> </StackPanel> - <TextBlock FontWeight="Light" FontSize="25" Margin="0 10 0 0" HorizontalAlignment="Center"> + <TextBlock FontWeight="Light" FontSize="25" Margin="0 10 0 0" HorizontalAlignment="Center" Visibility="Collapsed"> <Run Text="{Binding ElementName=control,Path=RunningJobStatus.ProgressMinusSettingUp,StringFormat=0,FallbackValue=0}"></Run><Run Text="/" /><Run Text="{Binding RunningJobStatus.TotalProgressMinusSettingUp,StringFormat=0,FallbackValue=0}"/> <Run FontSize="16">m</Run> </TextBlock> + <StackPanel Orientation="Horizontal" Margin="0 10 0 0" HorizontalAlignment="Center" Visibility="Visible"> + <TextBlock FontWeight="Light" FontSize="25" VerticalAlignment="Center" > + <TextBlock.Text> + <MultiBinding Converter="{StaticResource ProgressLengthSpoolConverter}" StringFormat="0.#" TargetNullValue='-' FallbackValue='0' Mode="OneWay"> + <Binding Path="RunningJobStatus.TotalProgressMinusSettingUp" /> + <Binding Path="IsEureka"/> + <Binding Path="RunningJobStatus.ProgressMinusSettingUp" /> + </MultiBinding> + </TextBlock.Text> + </TextBlock> + <TextBlock FontWeight="Light" FontSize="25" VerticalAlignment="Center" Text="/"></TextBlock> + <TextBlock FontWeight="Light" FontSize="25" VerticalAlignment="Center" > + <TextBlock.Text> + <MultiBinding Converter="{StaticResource ProgressLengthSpoolConverter}" StringFormat="0" TargetNullValue='-' FallbackValue='0' Mode="OneWay"> + <Binding Path="RunningJobStatus.TotalProgressMinusSettingUp"/> + <Binding Path="IsEureka"/> + </MultiBinding> + </TextBlock.Text> + </TextBlock> + <TextBlock FontWeight="Light" FontSize="25" VerticalAlignment="Center" Text=" m"></TextBlock> + </StackPanel> </StackPanel> <StackPanel Height="90" Visibility="{Binding ElementName=control,Path=RunningJobStatus.IsSettingUp,Converter={StaticResource BooleanToVisibilityConverter}}"> diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/RunningJobRingProgress.xaml.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/RunningJobRingProgress.xaml.cs index 5e0f28419..d8374573c 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/RunningJobRingProgress.xaml.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/RunningJobRingProgress.xaml.cs @@ -40,8 +40,15 @@ namespace Tango.FSE.Common.Controls public static readonly DependencyProperty IsRunningProperty = DependencyProperty.Register("IsRunning", typeof(bool), typeof(RunningJobRingProgress), new PropertyMetadata(false)); + public bool IsEureka + { + get { return (bool)GetValue(IsEurekaProperty); } + set { SetValue(IsEurekaProperty, value); } + } + public static readonly DependencyProperty IsEurekaProperty = + DependencyProperty.Register("IsEureka", typeof(bool), typeof(RunningJobRingProgress), new PropertyMetadata(false)); - + public RunningJobRingProgress() { InitializeComponent(); diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/RunningJobViewer.xaml b/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/RunningJobViewer.xaml index 2cd4fa7ad..faf5e072f 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/RunningJobViewer.xaml +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/RunningJobViewer.xaml @@ -6,9 +6,14 @@ xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL" xmlns:material="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:local="clr-namespace:Tango.FSE.Common.Controls" + xmlns:localConverters="clr-namespace:Tango.FSE.Common.Converters" mc:Ignorable="d" d:DesignHeight="120" d:DesignWidth="800"> + <UserControl.Resources> + <localConverters:ProgressLengthSpoolConverter x:Key="ProgressLengthSpoolConverter"/> + </UserControl.Resources> + <DockPanel> <Canvas Height="50" Margin="0" DockPanel.Dock="Top"> <StackPanel> @@ -132,7 +137,15 @@ </Style.Triggers> </Style> </TextBlock.Style> - <Run Text="{Binding LengthWithFactor,Mode=OneWay,StringFormat=N0}"></Run><Run Text="m"></Run> + <Run > + <Run.Text> + <MultiBinding Converter="{StaticResource ProgressLengthSpoolConverter}" StringFormat="N0" TargetNullValue=' ' FallbackValue='0' Mode="OneWay"> + <Binding Path="LengthWithFactor"/> + <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="IsEureka"/> + </MultiBinding> + </Run.Text> + </Run> + <Run Text="m"></Run> </TextBlock> </Grid> </DataTemplate> diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/RunningJobViewer.xaml.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/RunningJobViewer.xaml.cs index 4a970ffda..459728264 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/RunningJobViewer.xaml.cs +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Controls/RunningJobViewer.xaml.cs @@ -55,6 +55,14 @@ namespace Tango.FSE.Common.Controls public static readonly DependencyProperty JobProperty = DependencyProperty.Register("Job", typeof(Job), typeof(RunningJobViewer), new PropertyMetadata(null)); + public bool IsEureka + { + get { return (bool)GetValue(IsEurekaProperty); } + set { SetValue(IsEurekaProperty, value); } + } + public static readonly DependencyProperty IsEurekaProperty = + DependencyProperty.Register("IsEureka", typeof(bool), typeof(RunningJobViewer), new PropertyMetadata(false)); + /// <summary> /// Gets or sets the running job status. /// </summary> diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Converters/ProgressLengthSpoolConverter.cs b/Software/Visual_Studio/FSE/Tango.FSE.Common/Converters/ProgressLengthSpoolConverter.cs new file mode 100644 index 000000000..10c20c171 --- /dev/null +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Converters/ProgressLengthSpoolConverter.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Data; +using Tango.BL.Entities; + +namespace Tango.FSE.Common.Converters +{ + public class ProgressLengthSpoolConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + if (values.Count() == 2) + { + double length = System.Convert.ToDouble(values[0]); + bool isEureka = System.Convert.ToBoolean(values[1]); + int jobSpools = 1; + if (isEureka) + jobSpools = 4; + var totalBy4Spools = (double)length * jobSpools;// spools 4; + return totalBy4Spools; + + } + if (values.Count() == 3) + { + double length = System.Convert.ToDouble(values[0]); + var segment = values[1] as Segment; + bool isEureka = System.Convert.ToBoolean(values[1]); + int jobSpools = 1; + if (isEureka) + jobSpools = 4; + double currentProgresslength = System.Convert.ToDouble(values[2]); + + var totalBySpools = (double)length * jobSpools; + var currentProgressBySpools = (double)currentProgresslength * jobSpools; + + int coeff = (int)currentProgressBySpools / (int)totalBySpools; + var progressCurrent = (coeff == 0 || coeff == 1) ? currentProgressBySpools : currentProgressBySpools % (coeff * totalBySpools);//show for progress + + return progressCurrent; + } + return "-"; + } + catch + { + return "-"; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj b/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj index 82d62ff14..8ef3551d5 100644 --- a/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj +++ b/Software/Visual_Studio/FSE/Tango.FSE.Common/Tango.FSE.Common.csproj @@ -220,6 +220,7 @@ <Compile Include="Converters\LiquidTypeToShortNameConverter.cs" /> <Compile Include="Converters\NanolitersToLitersConverter.cs" /> <Compile Include="Converters\ObjectToJsonConverter.cs" /> + <Compile Include="Converters\ProgressLengthSpoolConverter.cs" /> <Compile Include="Converters\TimeSpanHumanizeConverter.cs" /> <Compile Include="Converters\TotalDyeTimeConverter.cs" /> <Compile Include="Converters\TotalMetersConverter.cs" /> |
