diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2023-03-29 17:51:32 +0300 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2023-03-29 17:51:32 +0300 |
| commit | c61d12100372054de07f6201c27c7755c7be35e8 (patch) | |
| tree | eca0ada6201de7dd90a0227a8a06bc681060d2fb /Software/Visual_Studio/PPC/Tango.PPC.UI | |
| parent | 0766ff8488c961c7f73eec50fb9ee64c89da5eb1 (diff) | |
| download | Tango-c61d12100372054de07f6201c27c7755c7be35e8.tar.gz Tango-c61d12100372054de07f6201c27c7755c7be35e8.zip | |
Eureka PPC. Added weight of job by length and RML.
Diffstat (limited to 'Software/Visual_Studio/PPC/Tango.PPC.UI')
6 files changed, 302 insertions, 194 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml index 72a7660ad..559266d28 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Controls/RunningJobViewerEureka.xaml @@ -3,117 +3,124 @@ 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:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" xmlns:local="clr-namespace:Tango.PPC.UI.Controls" xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL" mc:Ignorable="d" d:DesignHeight="60" d:DesignWidth="500" Height="38" d:DataContext="{d:DesignInstance Type=local:RunningJobViewerEureka, IsDesignTimeCreatable=False}"> + <UserControl.Resources> + + </UserControl.Resources> + <Grid> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="1*"/> - <ColumnDefinition Width="Auto"/> - </Grid.ColumnDefinitions> <Grid> - <Grid.RowDefinitions> - <RowDefinition Height="Auto" /> - <RowDefinition Height="1*" /> - </Grid.RowDefinitions> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="1*"/> + <ColumnDefinition Width="Auto"/> + </Grid.ColumnDefinitions> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="Auto" /> + <RowDefinition Height="1*" /> + </Grid.RowDefinitions> - <ItemsControl ClipToBounds="False" ItemsSource="{Binding RelativeSource={RelativeSource AncestorType=local:RunningJobViewerEureka},Path=RunningJobStatus.CurrentUnitSegments}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DisplayMarkers,Converter={StaticResource BooleanToVisibilityConverter}}"> - <ItemsControl.ItemsPanel> - <ItemsPanelTemplate> - <StackPanel Orientation="Horizontal" ClipToBounds="False"></StackPanel> - </ItemsPanelTemplate> - </ItemsControl.ItemsPanel> - <ItemsControl.ItemTemplate> - <DataTemplate> - <Grid> - <Grid.Width> - <MultiBinding Converter="{StaticResource SegmentLengthToWidthConverter}"> - <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="RunningJobStatus.CurrentUnitTotalProgress"></Binding> - <Binding RelativeSource="{RelativeSource AncestorType=ItemsControl}" Path="ActualWidth"></Binding> - <Binding Path="LengthWithFactor"></Binding> - </MultiBinding> - </Grid.Width> + <ItemsControl ClipToBounds="False" ItemsSource="{Binding RelativeSource={RelativeSource AncestorType=local:RunningJobViewerEureka},Path=RunningJobStatus.CurrentUnitSegments}" Visibility="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DisplayMarkers,Converter={StaticResource BooleanToVisibilityConverter}}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel Orientation="Horizontal" ClipToBounds="False"></StackPanel> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <Grid> + <Grid.Width> + <MultiBinding Converter="{StaticResource SegmentLengthToWidthConverter}"> + <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="RunningJobStatus.CurrentUnitTotalProgress"></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=ItemsControl}" Path="ActualWidth"></Binding> + <Binding Path="LengthWithFactor"></Binding> + </MultiBinding> + </Grid.Width> - <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoSmallFontSize}"> - <TextBlock.Style> - <Style TargetType="TextBlock"> - <Setter Property="Visibility" Value="Visible"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Grid},Path=ActualWidth,Converter={StaticResource SmallerThanToBooleanConverter},ConverterParameter=20}" Value="True"> - <Setter Property="Visibility" Value="Collapsed"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </TextBlock.Style> + <TextBlock HorizontalAlignment="Center" FontSize="{StaticResource TangoSmallFontSize}"> + <TextBlock.Style> + <Style TargetType="TextBlock"> + <Setter Property="Visibility" Value="Visible"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Grid},Path=ActualWidth,Converter={StaticResource SmallerThanToBooleanConverter},ConverterParameter=20}" Value="True"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> <Run Text="{Binding LengthWithFactor,Mode=OneWay,StringFormat=N0}"></Run><Run Text="m"></Run> - </TextBlock> - </Grid> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> + </TextBlock> + </Grid> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> - <Border Grid.Row="1" x:Name="brush_border" ClipToBounds="False" CornerRadius="10" Margin="0 5 0 0" Background="{StaticResource TangoLightForegroundBrush}"> - <!--<Border.Background> + <Border Grid.Row="1" x:Name="brush_border" ClipToBounds="False" CornerRadius="10" Margin="0 5 0 0" Background="{StaticResource TangoLightForegroundBrush}"> + <!--<Border.Background> <ImageBrush ImageSource="../Images/JobView/transparent_small.jpg" Stretch="None" TileMode="Tile" AlignmentX="Left" ViewportUnits="Absolute" Viewport="0,0,94,30" /> </Border.Background>--> - <Border.Clip> - <RectangleGeometry RadiusX="10" RadiusY="10"> - <RectangleGeometry.Rect> - <MultiBinding Converter="{StaticResource WidthHeightToRectConverter}"> - <Binding ElementName="brush_border" Path="ActualWidth" /> - <Binding ElementName="brush_border" Path="ActualHeight" /> - </MultiBinding> - </RectangleGeometry.Rect> - </RectangleGeometry> - </Border.Clip> - <Grid> - <ItemsControl ClipToBounds="False" ItemsSource="{Binding RelativeSource={RelativeSource AncestorType=local:RunningJobViewerEureka},Path=RunningJobStatus.CurrentUnitSegments}"> - <ItemsControl.ItemsPanel> - <ItemsPanelTemplate> - <StackPanel Orientation="Horizontal" ClipToBounds="False"></StackPanel> - </ItemsPanelTemplate> - </ItemsControl.ItemsPanel> - <ItemsControl.ItemTemplate> - <DataTemplate> - <Grid> - <Grid.Width> - <MultiBinding Converter="{StaticResource SegmentLengthToWidthConverter}"> - <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="RunningJobStatus.CurrentUnitTotalProgress"></Binding> - <Binding RelativeSource="{RelativeSource AncestorType=ItemsControl}" Path="ActualWidth"></Binding> - <Binding Path="LengthWithFactor"></Binding> - </MultiBinding> - </Grid.Width> - <Rectangle Fill="{Binding SegmentBrush}"></Rectangle> - </Grid> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> + <Border.Clip> + <RectangleGeometry RadiusX="10" RadiusY="10"> + <RectangleGeometry.Rect> + <MultiBinding Converter="{StaticResource WidthHeightToRectConverter}"> + <Binding ElementName="brush_border" Path="ActualWidth" /> + <Binding ElementName="brush_border" Path="ActualHeight" /> + </MultiBinding> + </RectangleGeometry.Rect> + </RectangleGeometry> + </Border.Clip> + <Grid> + <ItemsControl ClipToBounds="False" ItemsSource="{Binding RelativeSource={RelativeSource AncestorType=local:RunningJobViewerEureka},Path=RunningJobStatus.CurrentUnitSegments}"> + <ItemsControl.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel Orientation="Horizontal" ClipToBounds="False"></StackPanel> + </ItemsPanelTemplate> + </ItemsControl.ItemsPanel> + <ItemsControl.ItemTemplate> + <DataTemplate> + <Grid> + <Grid.Width> + <MultiBinding Converter="{StaticResource SegmentLengthToWidthConverter}"> + <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="RunningJobStatus.CurrentUnitTotalProgress"></Binding> + <Binding RelativeSource="{RelativeSource AncestorType=ItemsControl}" Path="ActualWidth"></Binding> + <Binding Path="LengthWithFactor"></Binding> + </MultiBinding> + </Grid.Width> + <Rectangle Fill="{Binding SegmentBrush}"></Rectangle> + </Grid> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> - <Rectangle Stroke="{StaticResource TangoGrayBrush}" StrokeThickness="1" StrokeDashArray="5 5 5 5" RadiusX="8" RadiusY="8" /> - </Grid> - </Border> - </Grid> + <Rectangle Stroke="{StaticResource TangoGrayBrush}" StrokeThickness="1" StrokeDashArray="5 5 5 5" RadiusX="8" RadiusY="8" /> + </Grid> + </Border> + </Grid> - <Grid Grid.Column="1" VerticalAlignment="Bottom"> - <Grid.Style> - <Style TargetType="Grid"> - <Setter Property="Visibility" Value="Collapsed"></Setter> - <Style.Triggers> - <MultiDataTrigger> - <MultiDataTrigger.Conditions> - <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:RunningJobViewerEureka},Path=Job.JobType}" Value="{x:Static enumerations:JobTypes.Embroidery}" /> - <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:RunningJobViewerEureka},Path=IsActive}" Value="False" /> - </MultiDataTrigger.Conditions> - <Setter Property="Visibility" Value="Visible"></Setter> - </MultiDataTrigger> - </Style.Triggers> - </Style> - </Grid.Style> + <!--<Grid Grid.Column="1" VerticalAlignment="Bottom"> + <Grid.Style> + <Style TargetType="Grid"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <MultiDataTrigger> + <MultiDataTrigger.Conditions> + <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:RunningJobViewerEureka},Path=Job.JobType}" Value="{x:Static enumerations:JobTypes.Embroidery}" /> + <Condition Binding="{Binding RelativeSource={RelativeSource AncestorType=local:RunningJobViewerEureka},Path=IsActive}" Value="False" /> + </MultiDataTrigger.Conditions> + <Setter Property="Visibility" Value="Visible"></Setter> + </MultiDataTrigger> + </Style.Triggers> + </Style> + </Grid.Style> - <TextBlock Margin="10 0 0 -2" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}"> + <TextBlock Margin="10 0 0 -2" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}"> <Run Text="x"></Run><Run Text="{Binding RelativeSource={RelativeSource AncestorType=local:RunningJobViewerEureka},Path=Job.NumberOfUnits}"></Run> - </TextBlock> + </TextBlock> + </Grid>--> </Grid> </Grid> </UserControl> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/LengthToWeightConverter.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/LengthToWeightConverter.cs new file mode 100644 index 000000000..32ba01ad2 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/LengthToWeightConverter.cs @@ -0,0 +1,35 @@ +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; + +namespace Tango.PPC.UI.Converters +{ + public class LengthToWeightConverter : IMultiValueConverter + { + public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + { + try + { + double length = System.Convert.ToDouble(values[0]); + double coef = System.Convert.ToDouble(values[1]); + var weight = ((double)length * coef) / (1000 * 1000);//(kg) + + return weight; + } + catch + { + return 0d; + } + } + + public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index 6249447c4..88bbcc92e 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -141,6 +141,7 @@ </Compile> <Compile Include="Converters\AppBarItemConverter.cs" /> <Compile Include="Converters\ItemBaseConverter.cs" /> + <Compile Include="Converters\LengthToWeightConverter.cs" /> <Compile Include="Dialogs\BitResultsView.xaml.cs"> <DependentUpon>BitResultsView.xaml</DependentUpon> </Compile> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs index 594f418a7..f22d43b19 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs @@ -7,6 +7,9 @@ using Tango.BL.Entities; using Tango.Core.Commands; using Tango.Integration.Operation; using Tango.PPC.Common; +using Tango.PPC.Jobs; +using Tango.PPC.Jobs.NavigationObjects; +using Tango.PPC.Jobs.Views; namespace Tango.PPC.UI.ViewModels { @@ -44,12 +47,37 @@ namespace Tango.PPC.UI.ViewModels set { _isJobStatusViewEnable = value; RaisePropertyChangedAuto(); } } + private bool _isEnabledStopButton; + /// <summary> + /// Gets or sets a value indicating whether this instance is enabled stop button. + /// </summary> + public bool IsEnabledStopButton + { + get { return _isEnabledStopButton; } + set { _isEnabledStopButton = value; RaisePropertyChangedAuto(); } + } + + private bool _isSpoolView; + /// <summary> + /// Gets or sets a value indicating whether this instance is spool view. + /// </summary> + public bool IsSpoolView + { + get { return _isSpoolView; } + set { _isSpoolView = value; RaisePropertyChangedAuto(); } + } + + #endregion #region Commands public RelayCommand StopCommand { get; set; } + public RelayCommand AbortCommand { get; set; } + + public RelayCommand GoToJobCommand { get; set; } + /// <summary> /// Gets or sets the job status view command. /// </summary> @@ -64,16 +92,26 @@ namespace Tango.PPC.UI.ViewModels public MachineStatusViewVM() { - StopCommand = new RelayCommand(StopJob); + StopCommand = new RelayCommand(StopJob, ()=>CanStopped()); + AbortCommand = new RelayCommand(AbortJob, () => CanStopped()); + GoToJobCommand = new RelayCommand(GoToJob); JobStatusViewCommand = new RelayCommand(JobStatusView); OverviewViewCommand = new RelayCommand(OverviewView); IsJobStatusViewEnable = true; + IsEnabledStopButton = false; + IsSpoolView = false; } - + public override void OnApplicationStarted() { MachineProvider.MachineOperator.PrintingStarted += MachineOperator_PrintingStarted; + MachineProvider.MachineOperator.PrintingEnded += MachineOperator_PrintingEnded; + } + + private bool CanStopped() + { + return IsEnabledStopButton; } private void MachineOperator_PrintingStarted(object sender, PrintingEventArgs e) @@ -83,7 +121,15 @@ namespace Tango.PPC.UI.ViewModels e.JobHandler.StatusChanged += JobHandler_StatusChanged; //e.JobHandler.SpoolChangeRequired += JobHandler_SpoolChangeRequired; e.JobHandler.Stopped += JobHandler_Stopped; - //e.JobHandler.CanCancelChanged += JobHandler_CanCancelChanged; + e.JobHandler.CanCancelChanged += JobHandler_CanCancelChanged; + InvokeUI(() => + { + IsEnabledStopButton = true; + StopCommand.RaiseCanExecuteChanged(); + AbortCommand.RaiseCanExecuteChanged(); + }); + + } private void JobHandler_Stopped(object sender, EventArgs e) @@ -93,9 +139,22 @@ namespace Tango.PPC.UI.ViewModels _handler.StatusChanged -= JobHandler_StatusChanged; //_handler.SpoolChangeRequired -= JobHandler_SpoolChangeRequired; _handler.Stopped -= JobHandler_Stopped; + _handler.StatusChanged -= JobHandler_StatusChanged; + _handler.CanCancelChanged -= JobHandler_CanCancelChanged; } } + private void MachineOperator_PrintingEnded(object sender, PrintingEventArgs e) + { + LogManager.Log("Printing ended"); + InvokeUI(() => + { + IsEnabledStopButton = false; + StopCommand.RaiseCanExecuteChanged(); + AbortCommand.RaiseCanExecuteChanged(); + }); + } + private void JobHandler_StatusChanged(object sender, RunningJobStatus e) { InvokeUI(() => @@ -103,7 +162,35 @@ namespace Tango.PPC.UI.ViewModels RunningJobStatus = e; }); } - + + private void JobHandler_CanCancelChanged(object sender, EventArgs e) + { + InvokeUI( () => + { + IsEnabledStopButton = _handler.CanCancel; + StopCommand.RaiseCanExecuteChanged(); + AbortCommand.RaiseCanExecuteChanged(); + }); + } + + private void StopJob() + { + _handler?.Cancel(); + } + + private void AbortJob() + { + _handler?.Cancel(); + Job = null; + } + + private void GoToJob() + { + + // NavigationManager.NavigateWithObject<JobsV2Module, JobEurekaView, JobNavigationObject>(new JobNavigationObject() { Job = _handler.Job }); + // NavigationManager.ClearHistoryExcept<JobsView>(); + + } #region Public Methods /// <summary> @@ -121,10 +208,7 @@ namespace Tango.PPC.UI.ViewModels } } - private void StopJob() - { - _handler?.Cancel(); - } + protected void JobStatusView() { diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml index 402af001c..097245990 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/LayoutEurekaView.xaml @@ -35,9 +35,9 @@ <Grid Background="{StaticResource TangoPrimaryBackgroundBrush}"> <Viewbox Stretch="Fill" Width="350"> - <Grid Width="250" Height="900" > + <Grid Width="205" Height="750" > <Border TextElement.FontSize="16" x:Name="border" BorderThickness="0 0 0 0" BorderBrush="{StaticResource TangoDarkForegroundBrush}" TextElement.Foreground="{StaticResource TangoDarkForegroundBrush}"> - <Grid Background="{StaticResource TangoPrimaryBackgroundBrush}"> + <Grid Background="{StaticResource TangoMenuPanelDarkBrush}" > <StackPanel VerticalAlignment="Top"> <Border Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderBrush="{StaticResource TangoDividerBrush}" BorderThickness="0 0 0 0"> <Grid> @@ -59,10 +59,10 @@ <DataTemplate> <Border Visibility="{Binding DockToBottom,Converter={StaticResource BooleanToVisibilityInverseConverter}}"> <Border BorderBrush="{StaticResource TangoDividerBrush}" BorderThickness="0 0 0 1" Visibility="{Binding IsVisibleInMenu,Converter={StaticResource BooleanToVisibilityConverter}}"> - <touch:TouchButton Margin="0 0 0 0" Padding="30 15" Foreground="{StaticResource TangoDarkForegroundBrush}" Style="{StaticResource TangoFlatButton}" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.ModuleNavigationCommand}" CommandParameter="{Binding Name}" > + <touch:TouchButton Margin="0 0 0 0" Padding="10 15" Foreground="{StaticResource TangoDarkForegroundBrush}" Style="{StaticResource TangoFlatButton}" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.ModuleNavigationCommand}" CommandParameter="{Binding Name}" > <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> <Image VerticalAlignment="Center" Source="{Binding Image}" Width="32" Height="32"></Image> - <TextBlock VerticalAlignment="Center" Margin="40 0 0 0" Text="{Binding Name}" Foreground="{StaticResource TangoPrimaryAccentBrush}"></TextBlock> + <TextBlock VerticalAlignment="Center" Margin="20 0 0 0" Text="{Binding Name}" Foreground="{StaticResource TangoLightForegroundBrush}"></TextBlock> </StackPanel> </touch:TouchButton> </Border> @@ -73,10 +73,10 @@ <StackPanel Margin="0 5 0 0"> <Border BorderBrush="{StaticResource TangoDividerBrush}" BorderThickness="0 0 0 1"> - <touch:TouchButton Style="{StaticResource TangoFlatButton}" Padding="30 15" Foreground="{StaticResource TangoDarkForegroundBrush}" Command="{Binding UpdateCommand}"> + <touch:TouchButton Style="{StaticResource TangoFlatButton}" Padding="10 15" Foreground="{StaticResource TangoDarkForegroundBrush}" Command="{Binding UpdateCommand}"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> <Image Source="/Images/Menu/update.png" VerticalAlignment="Center" Width="32" Height="32"></Image> - <TextBlock VerticalAlignment="Center" Margin="40 0 0 0" Foreground="{StaticResource TangoPrimaryAccentBrush}">Update</TextBlock> + <TextBlock VerticalAlignment="Center" Margin="20 0 0 0" Foreground="{StaticResource TangoLightForegroundBrush}">Update</TextBlock> </StackPanel> </touch:TouchButton> </Border> @@ -84,7 +84,7 @@ </StackPanel> <Grid VerticalAlignment="Bottom"> - <Border Background="{StaticResource TangoPowerMenuOpenedBackgroundBrush}" Height="350" Padding="20" RenderTransformOrigin="0.5,1" VerticalAlignment="Bottom"> + <Border Background="{StaticResource TangoPrimaryBackgroundBrush}" Height="350" Padding="20" RenderTransformOrigin="0.5,1" VerticalAlignment="Bottom"> <Border.Resources> <Style x:Key="PowerButton" TargetType="touch:TouchButton" BasedOn="{StaticResource TangoLinkButton}"> <Setter Property="Foreground" Value="{StaticResource TangoPrimaryBackgroundBrush}"></Setter> @@ -190,10 +190,10 @@ </Style.Triggers> </Style> </Border.Style> - <touch:TouchButton Style="{StaticResource TangoFlatButton}" Padding="40 25" Foreground="{StaticResource TangoDarkForegroundBrush}" Command="{Binding PowerCommand}"> + <touch:TouchButton Style="{StaticResource TangoFlatButton}" Padding="10 0 0 25" Foreground="{StaticResource TangoDarkForegroundBrush}" Command="{Binding PowerCommand}" Background="{StaticResource TangoMenuPanelDarkBrush}"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> <Image Source="/Images/menu/power.png" VerticalAlignment="Center" Width="32" Height="32"></Image> - <TextBlock VerticalAlignment="Center" Margin="40 0 0 0" Foreground="{StaticResource TangoPrimaryAccentBrush}">Power</TextBlock> + <TextBlock VerticalAlignment="Center" Margin="20 0 0 0" Foreground="{StaticResource TangoLightForegroundBrush}">Power</TextBlock> </StackPanel> </touch:TouchButton> </Border> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml index 243fa8584..f681a5112 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml @@ -6,12 +6,15 @@ xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" xmlns:vm="clr-namespace:Tango.PPC.UI.ViewModels" xmlns:locaControls="clr-namespace:Tango.PPC.UI.Controls" + xmlns:locaConverters="clr-namespace:Tango.PPC.UI.Converters" xmlns:global="clr-namespace:Tango.PPC.UI" xmlns:local="clr-namespace:Tango.PPC.UI.Views" mc:Ignorable="d" d:DesignHeight="1280" d:DesignWidth="932" d:DataContext="{d:DesignInstance Type=vm:MachineStatusViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MachineStatusViewVM}"> <UserControl.Resources> - + + <locaConverters:LengthToWeightConverter x:Key="LengthToWeightConverter" /> + <Style x:Key="LinkRoundButtonStyle" TargetType="{x:Type touch:TouchButton}"> <Setter Property="Background" Value="{StaticResource TangoMidAccentBrush}"></Setter> <Setter Property="CornerRadius" Value="23"></Setter> @@ -43,39 +46,9 @@ <RowDefinition Height="1*"></RowDefinition> </Grid.RowDefinitions> - <Border x:Name="StatusTabs" HorizontalAlignment="Center" VerticalAlignment="Top" Width="330" BorderThickness="2" CornerRadius ="28" BorderBrush="{StaticResource TangoNotificationBorderBrush}"> - <StackPanel Orientation="Horizontal" Margin="3"> - <touch:TouchButton EnableDropShadow="False" Command="{Binding JobStatusViewCommand}"> - <TextBlock Text="Job Status"></TextBlock> - <touch:TouchButton.Style> - <Style TargetType="{x:Type touch:TouchButton}" BasedOn="{StaticResource LinkRoundButtonStyle}"> - <Style.Triggers> - <DataTrigger Binding="{Binding IsJobStatusViewEnable}" Value="False"> - <Setter Property="Background" Value="Transparent"></Setter> - <Setter Property="BorderBrush" Value="Transparent"></Setter> - <Setter Property="Foreground" Value="{StaticResource TangoDisabledForegroundBrush}"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </touch:TouchButton.Style> - </touch:TouchButton> - <touch:TouchButton Margin="0 0 0 0" Command="{Binding OverviewViewCommand}"> - <touch:TouchButton.Style> - <Style TargetType="{x:Type touch:TouchButton}" BasedOn="{StaticResource LinkRoundButtonStyle}"> - <Style.Triggers> - <DataTrigger Binding="{Binding IsJobStatusViewEnable}" Value="True"> - <Setter Property="Background" Value="Transparent"></Setter> - <Setter Property="BorderBrush" Value="Transparent"></Setter> - <Setter Property="Foreground" Value="{StaticResource TangoDisabledForegroundBrush}"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </touch:TouchButton.Style> - <TextBlock Text="Overview"></TextBlock> - </touch:TouchButton> - </StackPanel> - </Border> - <Canvas Width="300" VerticalAlignment="Top" HorizontalAlignment="Right" Height="56" Margin="0 -30 -60 0"> + <touch:TouchToggleSlider Style="{StaticResource TouchToggleButtonSlider}" Background="Transparent" CheckedBackground="{StaticResource TangoMidBackgroundBrush}" UncheckedBackground="{StaticResource TangoMidBackgroundBrush}" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0 0 0 0" CornerRadius="20" Height="40" Width="324" ThumbWidth="160" LeftText="Job Status" RightText="Overview" ThumbCornerRadius="18" IsChecked="{Binding IsJobStatusViewEnable, Converter={StaticResource BooleanInverseConverter}}"></touch:TouchToggleSlider> + + <Canvas Width="300" VerticalAlignment="Top" HorizontalAlignment="Right" Height="56" Margin="0 -30 -60 0"> <Grid Panel.ZIndex="100" DockPanel.Dock="Top" Height="117" Background="Transparent"> <Grid HorizontalAlignment="Right" Margin="0 0 0 0"> <StackPanel Orientation="Horizontal"> @@ -162,39 +135,10 @@ </Grid> </Grid>--> - <Border x:Name="TotalSpool" DockPanel.Dock="Right" HorizontalAlignment="Center" VerticalAlignment="Top" Width="164" BorderThickness="2" CornerRadius ="14" BorderBrush="{StaticResource TangoNotificationBorderBrush}"> - <StackPanel Orientation="Horizontal" Margin="3"> - <touch:TouchButton EnableDropShadow="False" Command="{Binding JobStatusViewCommand}" Width="80" Height="24" CornerRadius="12"> - <TextBlock Text="Total"></TextBlock> - <touch:TouchButton.Style> - <Style TargetType="{x:Type touch:TouchButton}" BasedOn="{StaticResource LinkRoundButtonStyle}"> - <Style.Triggers> - <DataTrigger Binding="{Binding IsJobStatusViewEnable}" Value="False"> - <Setter Property="Background" Value="Transparent"></Setter> - <Setter Property="BorderBrush" Value="Transparent"></Setter> - <Setter Property="Foreground" Value="{StaticResource TangoDisabledForegroundBrush}"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </touch:TouchButton.Style> - </touch:TouchButton> - <touch:TouchButton Margin="0 0 0 0" Width="80" Height="24" CornerRadius="12"> - <touch:TouchButton.Style> - <Style TargetType="{x:Type touch:TouchButton}" BasedOn="{StaticResource LinkRoundButtonStyle}"> - <Style.Triggers> - <DataTrigger Binding="{Binding IsJobStatusViewEnable}" Value="True"> - <Setter Property="Background" Value="Transparent"></Setter> - <Setter Property="BorderBrush" Value="Transparent"></Setter> - <Setter Property="Foreground" Value="{StaticResource TangoDisabledForegroundBrush}"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </touch:TouchButton.Style> - <TextBlock Text="Spool"></TextBlock> - </touch:TouchButton> + <StackPanel DockPanel.Dock="Right" Orientation="Horizontal" VerticalAlignment="Top" Width="200" MinHeight="30" HorizontalAlignment="Right" Margin="0 0 0 0"> + <touch:TouchToggleSlider Style="{StaticResource TouchToggleButtonSlider}" Background="{StaticResource TangoMidBackgroundBrush}" CheckedBackground="{StaticResource TangoMidBackgroundBrush}" UncheckedBackground="{StaticResource TangoMidBackgroundBrush}" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="20 0 20 0" CornerRadius="17" Height="34" Width="164" ThumbWidth="80" LeftText="Total" RightText="Spool" ThumbCornerRadius="13" IsChecked="{Binding IsSpoolView}" ></touch:TouchToggleSlider> </StackPanel> - </Border> - <UniformGrid DockPanel.Dock="Left" Columns="1" Rows="5" HorizontalAlignment="Left" Margin="0 0 0 0" Height="420" VerticalAlignment="Top"> + <UniformGrid DockPanel.Dock="Left" Columns="1" Rows="5" HorizontalAlignment="Left" Margin="0 0 0 0" Height="420" VerticalAlignment="Top"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> <Image Source="../Images/Job Issues/thread_type.png" Stretch="None" VerticalAlignment="Top"/> <StackPanel Orientation="Vertical" Margin="15 0 0 0"> @@ -207,28 +151,50 @@ <Image Source="../Images/Job Issues/job_length.png" Stretch="None" VerticalAlignment="Top" HorizontalAlignment="Left"/> <StackPanel Orientation="Vertical" Margin="15 0 0 0"> <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoDefaultFontSize}">Job Length</TextBlock> - <TextBlock Text="{Binding Job.LengthIncludingNumberOfUnits, TargetNullValue='-', FallbackValue='-'}" FontWeight="DemiBold" FontSize="{StaticResource TangoComboBoxItemFontSize}"></TextBlock> + <TextBlock FontWeight="DemiBold" FontSize="{StaticResource TangoComboBoxItemFontSize}"> + <TextBlock.Style> + <Style TargetType="{x:Type TextBlock}"> + <Setter Property="Text" Value="{Binding Job.LengthIncludingNumberOfUnitsAndSpools, TargetNullValue='-', FallbackValue='-', StringFormat=0.##}" /> + <Style.Triggers> + <DataTrigger Binding="{Binding IsSpoolView}" Value="True"> + <Setter Property="Text" Value="{Binding Job.LengthIncludingNumberOfUnits, TargetNullValue='-', FallbackValue='-', StringFormat=0.##}" /> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> + </StackPanel> </StackPanel> - </StackPanel> <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> <Image Source="../Images/Job Issues/job_weight.png" Stretch="None" VerticalAlignment="Top"/> <StackPanel Orientation="Vertical" Margin="15 0 0 0"> <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoDefaultFontSize}">Job Weight</TextBlock> - <TextBlock Text="10 kg" FontWeight="DemiBold" FontSize="{StaticResource TangoComboBoxItemFontSize}"></TextBlock> + <TextBlock FontWeight="DemiBold" FontSize="{StaticResource TangoComboBoxItemFontSize}"> + <TextBlock.Style> + <Style TargetType="{x:Type TextBlock}"> + <Setter Property="Text" Value="{Binding Job.WeightIncludingNumberOfUnitsAndSpools, TargetNullValue='-', FallbackValue='-', StringFormat=0.#####}" /> + <Style.Triggers> + <DataTrigger Binding="{Binding IsSpoolView}" Value="True"> + <Setter Property="Text" Value="{Binding Job.WeightIncludingNumberOfUnits, TargetNullValue='-', FallbackValue='-', StringFormat=0.#####}" /> + </DataTrigger> + </Style.Triggers> + </Style> + </TextBlock.Style> + </TextBlock> </StackPanel> </StackPanel> <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> <Image Source="../Images/Job Issues/job_copies.png" Stretch="None" VerticalAlignment="Top"/> <StackPanel Orientation="Vertical" Margin="15 0 0 0"> <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoDefaultFontSize}">Copies</TextBlock> - <TextBlock Text="{Binding Job.NumberOfUnits, TargetNullValue='-', FallbackValue='-'}" FontWeight="DemiBold" FontSize="{StaticResource TangoComboBoxItemFontSize}"></TextBlock> + <TextBlock Text="{Binding Job.NumberOfUnitsMultipliedBySpools, TargetNullValue='-', FallbackValue='-'}" FontWeight="DemiBold" FontSize="{StaticResource TangoComboBoxItemFontSize}"></TextBlock> </StackPanel> </StackPanel> <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> <Image Source="../Images/Job Issues/spools.png" Stretch="None" VerticalAlignment="Top"/> <StackPanel Orientation="Vertical" Margin="15 0 0 0"> <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoDefaultFontSize}">Spools</TextBlock> - <TextBlock Text="4" FontWeight="DemiBold" FontSize="{StaticResource TangoComboBoxItemFontSize}"></TextBlock> + <TextBlock Text="{Binding Job.Spools, TargetNullValue='-', FallbackValue='-'}" FontWeight="DemiBold" FontSize="{StaticResource TangoComboBoxItemFontSize}"></TextBlock> </StackPanel> </StackPanel> </UniformGrid> @@ -329,7 +295,7 @@ </Grid> <StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> - <touch:TouchButton Content="Abort" Margin="0 20 0 0" Height="50" Width="164" CornerRadius="30" Command="{Binding StopCommand}" IsEnabled="true" BorderThickness="1" BorderBrush="{StaticResource TangoPrimaryAccentBrush}" EnableDropShadow="False"> + <touch:TouchButton Content="Abort" Margin="0 20 0 0" Height="50" Width="164" CornerRadius="30" Command="{Binding AbortCommand}" IsEnabled="true" BorderThickness="1" BorderBrush="{StaticResource TangoPrimaryAccentBrush}" EnableDropShadow="False"> <touch:TouchButton.Style > <Style TargetType="touch:TouchButton" > <Setter Property="Foreground" Value="{StaticResource TangoPrimaryAccentBrush}"></Setter> @@ -368,40 +334,55 @@ <Rectangle Height="2" Fill="{StaticResource TangoLightBorderBrush}" Width="1010" VerticalAlignment="Top" Margin="15 20 0 0"></Rectangle> </StackPanel> <Grid Margin="0 25 0 0"> - <locaControls:RunningJobViewerEureka Height="26" DisplayMarkers="False" IsActive="True" Job="{Binding Job}" RunningJobStatus="{Binding RunningJobStatus}" /> - - <!--<TextBlock Margin="0 0 -50 0" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}" HorizontalAlignment="Right"> + <locaControls:RunningJobViewerEureka Height="26" DisplayMarkers="False" IsActive="True" Job="{Binding Job}" RunningJobStatus="{Binding RunningJobStatus}" /> + + + <!--<TextBlock Margin="0 0 -50 0" VerticalAlignment="Center" FontSize="{StaticResource TangoTitleFontSize}" HorizontalAlignment="Right"> <Run Text="x"></Run><Run Text="{Binding RunningJobStatus.RemainingUnits}"></Run> </TextBlock>--> - </Grid> - <UniformGrid DockPanel.Dock="Bottom" Columns="4" Rows="1" HorizontalAlignment="Left" Margin="0 35 0 0" Height="Auto" VerticalAlignment="Top" Width="1200"> + </Grid> + <touch:MultiRangeSlider x:Name="PART_LowerSlider" Height="30" Margin="0 0 0 0" Minimum="0" Maximum="{Binding RunningJobStatus.TotalProgressMinusSettingUp}" Value="{Binding RunningJobStatus.ProgressMinusSettingUp}" Foreground="{StaticResource TangoDarkForegroundBrush}" + IsSnapToTickEnabled="True" TickFrequency="1" VerticalAlignment="Center" IsEnabled="False" /> + <UniformGrid DockPanel.Dock="Bottom" Columns="4" Rows="1" HorizontalAlignment="Left" Margin="0 35 0 0" Height="Auto" VerticalAlignment="Top" Width="900"> <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> <Image Source="../Images/Job Issues/job_length.png" Stretch="None" VerticalAlignment="Top" HorizontalAlignment="Left"/> <StackPanel Orientation="Vertical" Margin="15 0 0 0"> <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoDefaultFontSize}">Job Length</TextBlock> - <TextBlock Text="{Binding Job.LengthIncludingNumberOfUnits, TargetNullValue='-', FallbackValue='-'}" FontWeight="DemiBold" FontSize="{StaticResource TangoComboBoxItemFontSize}"></TextBlock> + <TextBlock Text="{Binding RunningJobStatus.ProgressMinusSettingUp,StringFormat=0.##,FallbackValue=0}" FontWeight="DemiBold" FontSize="{StaticResource TangoComboBoxItemFontSize}"></TextBlock> </StackPanel> </StackPanel> <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> <Image Source="../Images/Job Issues/job_weight.png" Stretch="None" VerticalAlignment="Top"/> <StackPanel Orientation="Vertical" Margin="15 0 0 0"> <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoDefaultFontSize}">Job Weight</TextBlock> - <TextBlock Text="10 kg" FontWeight="DemiBold" FontSize="{StaticResource TangoComboBoxItemFontSize}"></TextBlock> + <TextBlock FontWeight="DemiBold" FontSize="{StaticResource TangoComboBoxItemFontSize}"> + <TextBlock.Text> + <MultiBinding Converter="{StaticResource LengthToWeightConverter}" StringFormat="0.#####" TargetNullValue='-' FallbackValue='-'> + <Binding Path="RunningJobStatus.ProgressMinusSettingUp"/> + <Binding Path="Job.GramPerLength"/> + </MultiBinding> + </TextBlock.Text> + </TextBlock> </StackPanel> </StackPanel> <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> <Image Source="../Images/Job Issues/job_copies.png" Stretch="None" VerticalAlignment="Top"/> <StackPanel Orientation="Vertical" Margin="15 0 0 0"> <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoDefaultFontSize}">Copies</TextBlock> - <TextBlock Text="{Binding Job.NumberOfUnits,TargetNullValue='-', FallbackValue='-'}" FontWeight="DemiBold" FontSize="{StaticResource TangoComboBoxItemFontSize}"></TextBlock> + <TextBlock Text="{Binding RunningJobStatus.RemainingUnits,TargetNullValue='-', FallbackValue='-'}" FontWeight="DemiBold" FontSize="{StaticResource TangoComboBoxItemFontSize}"></TextBlock> </StackPanel> </StackPanel> <StackPanel Orientation="Horizontal" HorizontalAlignment="Left"> <Image Source="../Images/Job Issues/ttime_left.png" Stretch="None" VerticalAlignment="Top"/> <StackPanel Orientation="Vertical" Margin="15 0 0 0"> <TextBlock VerticalAlignment="Center" FontSize="{StaticResource TangoDefaultFontSize}">Time Left</TextBlock> - <TextBlock Text="14:30 hrs" FontWeight="DemiBold" FontSize="{StaticResource TangoComboBoxItemFontSize}"></TextBlock> - </StackPanel> + <TextBlock FontWeight="Light" FontSize="{StaticResource TangoComboBoxItemFontSize}" Margin="0 0 0 0" HorizontalAlignment="Center"> + <Run Text="{Binding RunningJobStatus.RemainingTime,Converter={StaticResource TimeSpanToTwoDigitsTimeConverter},FallbackValue=5}"></Run> + <Run FontSize="16" Text="{Binding RunningJobStatus.RemainingTime,Converter={StaticResource TimeSpanToLabelConverter},FallbackValue=min}"></Run> + + <!--<Run FontSize="16">m</Run>--> + </TextBlock> + </StackPanel> </StackPanel> </UniformGrid> |
