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 | |
| 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')
15 files changed, 694 insertions, 272 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs index 22ea1c7f1..42817daaa 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/JobModel.cs @@ -131,6 +131,7 @@ namespace Tango.PPC.Jobs.Models _numberofunits = value; RaisePropertyChangedAuto(); RaisePropertyChanged(nameof(LengthIncludingNumberOfUnits)); + RaisePropertyChanged(nameof(LengthIncludingNumberOfUnitsAndSpools)); RaisePropertyChanged(nameof(GetEstimatedDuration)); } } @@ -659,6 +660,9 @@ namespace Tango.PPC.Jobs.Models } } + + + [JsonIgnore] public bool IsEureka { get; set; } @@ -1045,7 +1049,8 @@ namespace Tango.PPC.Jobs.Models } RaisePropertyChanged(nameof(Length)); RaisePropertyChanged(nameof(LengthIncludingNumberOfUnits)); - + RaisePropertyChanged(nameof(LengthIncludingNumberOfUnitsAndSpools)); + } RaisePropertyChanged(nameof(GetEstimatedDuration)); } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/SegmentModel.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/SegmentModel.cs index 40450c001..5d6c53c59 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/SegmentModel.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Models/SegmentModel.cs @@ -96,7 +96,23 @@ namespace Tango.PPC.Jobs.Models UndoRedoManager.Instance.InsertAndExecuteCommand(new ChangeLengthCommand(this, _lastLength, value)); _lastLength = Length; } - + + private double _weight; + + public double Weight + { + get { return _weight; } + set + { + if(_weight != value) + { + _weight = value; + OnWeightChanged(); + RaisePropertyChangedAuto(); + } + } + } + protected Int32 _segmentindex; /// <summary> /// Gets or sets the index of the segment. @@ -813,19 +829,45 @@ namespace Tango.PPC.Jobs.Models /// <summary> /// Called when the Length has changed. - /// </summary> - /// <param name="length"></param> protected void OnLengthChanged(double length) { - //if (_lastLength != length) + if (Job != null && Job.Rml != null) { + var gramPerlength = Job.Rml.GetGramPer1000mLength; + var weight = (Length * gramPerlength)/( 1000 *1000);//(kg) + _weight = weight; + RaisePropertyChanged(nameof(Weight)); + //if (_lastLength != length) + { + BrushStops.ToList().ForEach(x => x.RaiseOffsetChanged()); + //_lastLength = Length; + //RaisePropertyChanged(nameof(LengthWithFactor)); + RaisePropertyChanged(nameof(LengthWithInterSegment)); + RaisePropertyChanged(nameof(LeftOffsetLabel)); + RaisePropertyChanged(nameof(MiddleOffsetLabel)); + RaisePropertyChanged(nameof(RightOffsetLabel)); + } + } + } + + /// <summary> + /// Called when [weight changed]. + /// </summary> + private void OnWeightChanged() + { + if (Job != null && Job.Rml != null) + { + var gramPerlength = Job.Rml.GetGramPer1000mLength; + var length = (Weight * 1000 * 1000)/ gramPerlength;//(m) + _length = length; + RaisePropertyChanged(nameof(Length)); + BrushStops.ToList().ForEach(x => x.RaiseOffsetChanged()); - //_lastLength = Length; - //RaisePropertyChanged(nameof(LengthWithFactor)); RaisePropertyChanged(nameof(LengthWithInterSegment)); RaisePropertyChanged(nameof(LeftOffsetLabel)); RaisePropertyChanged(nameof(MiddleOffsetLabel)); RaisePropertyChanged(nameof(RightOffsetLabel)); + } } @@ -834,49 +876,62 @@ namespace Tango.PPC.Jobs.Models /// </summary> /// <param name="brushstops"></param> protected void OnBrushStopsChanged(SynchronizedObservableCollection<BrushStopModel> brushstops) - { - if (brushstops != null) { - brushstops.CollectionChanged -= BrushStops_CollectionChanged; - brushstops.CollectionChanged += BrushStops_CollectionChanged; - - foreach (var stop in brushstops.ToList()) + if (brushstops != null) { - stop.RaiseOffsetChanged(); + brushstops.CollectionChanged -= BrushStops_CollectionChanged; + brushstops.CollectionChanged += BrushStops_CollectionChanged; + + foreach (var stop in brushstops.ToList()) + { + stop.RaiseOffsetChanged(); + } + + RaiseSegmentBrushChanged(); } + } - RaiseSegmentBrushChanged(); + private void AddGap() + { + EnableInterSegment = true; } - } - private void AddGap() - { - EnableInterSegment = true; - } + private void DeleteGap() + { + EnableInterSegment = false; + } - private void DeleteGap() - { - EnableInterSegment = false; - } + public void UpdateBrushStops() + { + foreach (var stop in BrushStops.Where(x => x.ColorSpace == BL.Enumerations.ColorSpaces.RGB || x.ColorSpace == BL.Enumerations.ColorSpaces.LAB).ToList()) + { + try + { + stop.OnBrushStopFieldValueChanged(); + stop.InitColorsFromBestmatch(); + //TODO ASK ROY!!!!!! + //output.ApplyOnBrushStopVolumesOnly(stop); + } + catch (Exception ex) + { + LogManager.Log(ex, $"Error updating stop volumes after changing thread on segment {stop.SegmentModel.SegmentIndex}, stop {stop.StopIndex}."); + } + } + } - public void UpdateBrushStops() - { - foreach (var stop in BrushStops.Where(x => x.ColorSpace == BL.Enumerations.ColorSpaces.RGB || x.ColorSpace == BL.Enumerations.ColorSpaces.LAB).ToList()) + public void UpdateWeightOnRMLChange( bool isWeightView) { - try + if(isWeightView) { - stop.OnBrushStopFieldValueChanged(); - stop.InitColorsFromBestmatch(); - //TODO ASK ROY!!!!!! - //output.ApplyOnBrushStopVolumesOnly(stop); + OnWeightChanged(); } - catch (Exception ex) + else { - LogManager.Log(ex, $"Error updating stop volumes after changing thread on segment {stop.SegmentModel.SegmentIndex}, stop {stop.StopIndex}."); + OnLengthChanged(Length); } } + + + #endregion } - - #endregion } -} diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs index 7dcc349c1..02ed4d27d 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobViewVM.cs @@ -255,7 +255,21 @@ namespace Tango.PPC.Jobs.ViewModels RaisePropertyChangedAuto(); } } + private bool _isWeigthView; + public bool IsWeightView + { + get { return _isWeigthView; } + set { + if(_isWeigthView != value) + { + _isWeigthView = value; + + RaisePropertyChangedAuto(); + } + } + } + #endregion #region Commands @@ -463,8 +477,8 @@ namespace Tango.PPC.Jobs.ViewModels //await SetSpoolTension(Job.Rml); LogManager.Log("Loading RMLS..."); - Rmls = (await new RmlsCollectionBuilder(_db).SetAll().WithSpools().ForHeadType(MachineProvider.Machine.MachineHeadType).ForSite(MachineProvider.Machine.SiteGuid).BuildAsync()).OrderBy(x => x.FinalName).ToList(); - //Rmls = (await new RmlsCollectionBuilder(_db).SetAll().WithSpools().BuildAsync()).OrderBy(x => x.FinalName).ToList(); + //Rmls = (await new RmlsCollectionBuilder(_db).SetAll().WithSpools().ForHeadType(MachineProvider.Machine.MachineHeadType).ForSite(MachineProvider.Machine.SiteGuid).BuildAsync()).OrderBy(x => x.FinalName).ToList(); + Rmls = (await new RmlsCollectionBuilder(_db).SetAll().WithSpools().BuildAsync()).OrderBy(x => x.FinalName).ToList(); LogManager.Log("Loading Color Spaces..."); ColorSpaces = await _db.ColorSpaces.Where(x => x.Code != (int)BL.Enumerations.ColorSpaces.CMYK).ToListAsync(); LogManager.Log("Loading Spool Types..."); @@ -483,6 +497,7 @@ namespace Tango.PPC.Jobs.ViewModels IsBasicMode = true; } else IsBasicMode = false; + IsWeightView = false; LoadJobModel(); @@ -891,7 +906,9 @@ namespace Tango.PPC.Jobs.ViewModels .WithSpools() .BuildAsync(); if (JobModel != null) + { JobModel.Rml = Job.Rml; + } if (updateRML && JobModel != null) { @@ -900,12 +917,15 @@ namespace Tango.PPC.Jobs.ViewModels { if (segment is SegmentModel innerSegment) { + innerSegment.UpdateWeightOnRMLChange(IsWeightView); innerSegment.UpdateBrushStops(); + } else if (segment is SegmentsGroupModel group) { foreach (var segm in group.Segments) { + segm.UpdateWeightOnRMLChange(IsWeightView); segm.UpdateBrushStops(); } } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs index 448ba7a57..ebc396a39 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/ViewModels/JobsViewVM.cs @@ -542,11 +542,22 @@ namespace Tango.PPC.Jobs.ViewModels await Task.Delay(200); - await NavigationManager.NavigateWithObject<JobsV2Module, JobView, JobNavigationObject>(new JobNavigationObject() + if(BuildProvider.IsEureka) { - Job = job, - Intent = JobNavigationIntent.NewJob - }); + await NavigationManager.NavigateWithObject<JobsV2Module, JobEurekaView, JobNavigationObject>(new JobNavigationObject() + { + Job = job, + Intent = JobNavigationIntent.NewJob + }); + } + else + { + await NavigationManager.NavigateWithObject<JobsV2Module, JobView, JobNavigationObject>(new JobNavigationObject() + { + Job = job, + Intent = JobNavigationIntent.NewJob + }); + } } catch (Exception ex) { @@ -694,8 +705,8 @@ namespace Tango.PPC.Jobs.ViewModels using (ObservablesContext db = ObservablesContext.CreateDefault()) { _catalogs = await new CatalogsCollectionBuilder(db).SetAll().ForSite(MachineProvider.Machine.SiteGuid).BuildAsync(); - _rmls = await new RmlsCollectionBuilder(db).SetAll().WithSpools().ForHeadType(MachineProvider.Machine.MachineHeadType).ForSite(MachineProvider.Machine.SiteGuid).BuildAsync(); - //_rmls = (await new RmlsCollectionBuilder(db).SetAll().WithSpools().BuildAsync()).OrderBy(x => x.FinalName).ToObservableCollection(); + //_rmls = await new RmlsCollectionBuilder(db).SetAll().WithSpools().ForHeadType(MachineProvider.Machine.MachineHeadType).ForSite(MachineProvider.Machine.SiteGuid).BuildAsync(); + _rmls = (await new RmlsCollectionBuilder(db).SetAll().WithSpools().BuildAsync()).OrderBy(x => x.FinalName).ToObservableCollection(); _spoolTypes = db.SpoolTypes.ToObservableCollection(); } diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml index 979bca54c..7e042c82c 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.JobsV2/Views/JobEurekaView.xaml @@ -209,14 +209,15 @@ </DataTemplate> <DataTemplate x:Key="Segment_Template" DataType="{x:Type model:SegmentModel}"> - <Grid Height="400" Margin="57 15 57 0"> + <!--<Grid Height="410" Margin="57 15 57 0">--> + <Grid Height="310" Margin="57 10 57 0"> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> <RowDefinition Height="Auto" /> - <RowDefinition Height="1*" /> + <RowDefinition Height="10" /> </Grid.RowDefinitions> <DockPanel x:Name="header"> @@ -238,9 +239,21 @@ <controls:FastTextBlock FontSize="{StaticResource TangoTitleFontSize}" Text="{Binding SegmentIndex,Mode=OneWay}"></controls:FastTextBlock> </StackPanel> <StackPanel Margin="0 5 0 0" Orientation="Horizontal"> - <controls:FastTextBlock VerticalAlignment="Center" Text="Length (m):" FontSize="18"></controls:FastTextBlock> - <Border Margin="20 0 0 0" BorderThickness="1" Height="44" CornerRadius="12" BorderBrush="{StaticResource TangoMidAccentBrush}"> - <touch:TouchNumericTextBox Margin="20 0 0 0" Width="192" FocusSelectionMode="SelectAll" HorizontalAlignment="Left" HideUnderline="True" VerticalAlignment="Center" + <controls:FastTextBlock VerticalAlignment="Center" FontSize="18"> + <controls:FastTextBlock.Style> + <Style TargetType="controls:FastTextBlock"> + <Setter Property="Text" Value="Weight (kg):" /> + <Style.Triggers> + <DataTrigger Binding="{Binding ElementName=segmentsGrid, Path=DataContext.IsWeightView}" Value="False"> + <Setter Property="Text" Value="Length (m):" /> + </DataTrigger> + </Style.Triggers> + </Style> + </controls:FastTextBlock.Style> + </controls:FastTextBlock> + + <Border Margin="20 0 0 0" BorderThickness="1" Height="44" CornerRadius="12" BorderBrush="{StaticResource TangoMidAccentBrush}" Visibility="{Binding ElementName=segmentsGrid, Path=DataContext.IsWeightView, Converter={StaticResource BooleanToVisibilityInverseConverter}}"> + <touch:TouchNumericTextBox Margin="20 0 0 0" Width="192" FocusSelectionMode="SelectAll" HorizontalAlignment="Left" HideUnderline="True" VerticalAlignment="Center" Value="{Binding Length, UpdateSourceTrigger=LostFocus}" VerticalContentAlignment="Center" StringFormat="0.0" AutoCalculateJogStep="False" HasDecimalPoint="True" Minimum="1" Maximum="100000" @@ -248,6 +261,14 @@ FontSize="18" ValueChangedEnd="Length_ValueChanged" TextGotFocus="Length_BeforeChangeValue" RippleBrush="Transparent"/> </Border> + <Border Margin="20 0 0 0" BorderThickness="1" Height="44" CornerRadius="12" BorderBrush="{StaticResource TangoMidAccentBrush}" Visibility="{Binding ElementName=segmentsGrid, Path=DataContext.IsWeightView, Converter={StaticResource BooleanToVisibilityConverter}}"> + <touch:TouchNumericTextBox Margin="20 0 0 0" Width="192" FocusSelectionMode="SelectAll" HorizontalAlignment="Left" HideUnderline="True" VerticalAlignment="Center" + Value="{Binding Weight, UpdateSourceTrigger=LostFocus}" VerticalContentAlignment="Center" + StringFormat="0.0000" AutoCalculateJogStep="False" + HasDecimalPoint="True" Minimum="0" Maximum="1000" + KeyboardContainer="{Binding ElementName=Container}" + FontSize="18" RippleBrush="Transparent"/> + </Border> </StackPanel> </StackPanel> @@ -409,10 +430,11 @@ </Style> </ContentControl.Style> </ContentControl> - + </Grid> + <Rectangle Grid.Row="5" Fill="{StaticResource TangoDividerBrush}" Height="2" VerticalAlignment="Bottom" Margin="0 0 0 0"/> - <Grid Grid.Row="5" x:Name="add_new_segment_gap" HorizontalAlignment="Stretch" Margin="0 30 0 0" > + <!--<Grid Grid.Row="5" x:Name="add_new_segment_gap" HorizontalAlignment="Stretch" Margin="0 30 0 0" > <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="1*"/> @@ -441,7 +463,7 @@ </Border> <DockPanel Margin="0 10 0 0" Grid.Row="1"> - <!--<Grid DockPanel.Dock="Right" Visibility="{Binding IsLast, Converter={StaticResource BooleanToVisibilityInverseConverter}}">--> + --><!--<Grid DockPanel.Dock="Right" Visibility="{Binding IsLast, Converter={StaticResource BooleanToVisibilityInverseConverter}}">--><!-- <Grid DockPanel.Dock="Right" Visibility="Collapsed"> <touch:TouchButton x:Name="deletegap" DockPanel.Dock="Right" HorizontalAlignment="Right" VerticalAlignment="Center" Command="{Binding DeleteGapCommand}" EnableDropShadow="False" Foreground="{StaticResource TangoKeyboardKeyDarkTextBrush}" Background="Transparent" BorderThickness="0" Visibility="{Binding EnableInterSegment, Converter={StaticResource BooleanToVisibilityConverter}}"> <TextBlock Margin="10 2 0 0" FontSize="{StaticResource TangoButtonFontSize}" VerticalAlignment="Center">Delete Gap</TextBlock> @@ -466,16 +488,17 @@ </DockPanel> <Rectangle Margin="0 10 0 0" Grid.Row="2" Stroke="{StaticResource TangoDividerBrush}" StrokeThickness="1" VerticalAlignment="Bottom"/> - </Grid> + </Grid>--> </Grid> </DataTemplate> <DataTemplate x:Key="GroupSegment_Template" DataType="{x:Type model:SegmentsGroupModel}"> - <Grid Height="400" Margin="57 15 57 0"> + <Grid Height="310" Margin="57 10 57 0"> <Grid.RowDefinitions> <RowDefinition Height="Auto" /> - <RowDefinition Height="Auto" /> <RowDefinition Height="1*" /> + <!--<RowDefinition Height="1*" />--> + <RowDefinition Height="10" /> </Grid.RowDefinitions> <DockPanel> @@ -554,7 +577,9 @@ </Border> </Grid> </Border> - <Grid Grid.Row="2" x:Name="add_new_segment_gap" HorizontalAlignment="Stretch" Margin="0 30 0 0" > + <Rectangle Grid.Row="2" Fill="{StaticResource TangoDividerBrush}" Height="2" VerticalAlignment="Bottom" Margin="0 0 0 0"/> + + <!--<Grid Grid.Row="2" x:Name="add_new_segment_gap" HorizontalAlignment="Stretch" Margin="0 30 0 0" > <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="1*"/> @@ -583,7 +608,7 @@ </Border> <DockPanel Margin="0 10 0 0" Grid.Row="1"> - <!--<Grid DockPanel.Dock="Right" Visibility="{Binding IsLast, Converter={StaticResource BooleanToVisibilityInverseConverter}}">--> + --><!--<Grid DockPanel.Dock="Right" Visibility="{Binding IsLast, Converter={StaticResource BooleanToVisibilityInverseConverter}}">--> <!--<Grid DockPanel.Dock="Right" Visibility="Collapsed">--> <!--<touch:TouchButton x:Name="deletegap" DockPanel.Dock="Right" HorizontalAlignment="Right" VerticalAlignment="Center" Command="{Binding DeleteGapCommand}" EnableDropShadow="False" Foreground="{StaticResource TangoKeyboardKeyDarkTextBrush}" Background="Transparent" BorderThickness="0" Visibility="{Binding EnableInterSegment, Converter={StaticResource BooleanToVisibilityConverter}}"> <TextBlock Margin="10 2 0 0" FontSize="{StaticResource TangoButtonFontSize}" VerticalAlignment="Center">Delete Gap</TextBlock> @@ -596,7 +621,7 @@ <TextBlock Margin="10 2 0 0" FontSize="{StaticResource TangoButtonFontSize}" VerticalAlignment="Center">Add Gap</TextBlock> </StackPanel> </touch:TouchButton>--> - <!--</Grid>--> + <!--</Grid>--><!-- <touch:TouchButton DockPanel.Dock="Left" HorizontalAlignment="Left" VerticalAlignment="Center" Command="{Binding DataContext.AddNewSegmentCommand, ElementName=listSegments}" CommandParameter="{Binding }" EnableDropShadow="False" Foreground="{StaticResource TangoKeyboardKeyDarkTextBrush}" Background="Transparent" BorderThickness="0"> <StackPanel Orientation="Horizontal"> <Border Height="35" Width="35" BorderThickness="0" Background="Transparent" HorizontalAlignment="Left"> @@ -608,7 +633,7 @@ </DockPanel> <Rectangle Margin="0 10 0 0" Grid.Row="2" Stroke="{StaticResource TangoDividerBrush}" StrokeThickness="1" VerticalAlignment="Bottom"/> - </Grid> + </Grid>--> <Rectangle Margin="0 10 0 0" Grid.Row="2" Stroke="{StaticResource TangoDividerBrush}" StrokeThickness="1" VerticalAlignment="Bottom"/> </Grid> @@ -808,7 +833,7 @@ <StackPanel Orientation="Vertical"> <DockPanel> <StackPanel DockPanel.Dock="Right" Orientation="Horizontal" VerticalAlignment="Center" Width="200" MinHeight="55" HorizontalAlignment="Right" Margin="0 0 0 0"> - <touch:TouchToggleSlider Style="{StaticResource TouchToggleButtonSlider}" Background="{StaticResource TangoMidBackgroundBrush}" CheckedBackground="{StaticResource TangoMidBackgroundBrush}" UncheckedBackground="{StaticResource TangoMidBackgroundBrush}" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="20 0 110 0" CornerRadius="17" Height="34" Width="164" ThumbWidth="80" LeftText="Lenght" RightText="Weight" ThumbCornerRadius="13" ></touch:TouchToggleSlider> + <touch:TouchToggleSlider Style="{StaticResource TouchToggleButtonSlider}" Background="{StaticResource TangoMidBackgroundBrush}" CheckedBackground="{StaticResource TangoMidBackgroundBrush}" UncheckedBackground="{StaticResource TangoMidBackgroundBrush}" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="20 0 110 0" CornerRadius="17" Height="34" Width="164" ThumbWidth="80" LeftText="Lenght" RightText="Weight" ThumbCornerRadius="13" IsChecked="{Binding IsWeightView}" ></touch:TouchToggleSlider> </StackPanel> <StackPanel Orientation="Horizontal" MinHeight="55" VerticalAlignment="Top" > <StackPanel.Style> @@ -911,7 +936,7 @@ </Grid> - </Border> + </Border> </touch:TouchLoadingPanel> <touch:TouchLoadingPanel Grid.Row="2" IsLoading="{Binding IsBusy}" > @@ -963,7 +988,7 @@ <!--Border x:Name="borderDockFloat" Height="10" Margin="0 0 0 0" BorderBrush="Transparent" > <DockPanel x:Name="dockEdit" LastChildFill="False" Height="10" Width="50" HorizontalAlignment="Right" RenderTransformOrigin="0.58,2.08"/> </Border> --> - <ListBox x:Name="listSegments" Margin="10 0 10 100" Padding="0" BorderThickness="0" ItemsSource="{Binding SegmentsCollectionView}" ItemTemplateSelector="{StaticResource GroupSegmentTemplateSelector}" Style="{StaticResource SegmentsListBox}" + <ListBox x:Name="listSegments" Margin="10 0 10 20" Padding="0" BorderThickness="0" ItemsSource="{Binding SegmentsCollectionView}" ItemTemplateSelector="{StaticResource GroupSegmentTemplateSelector}" Style="{StaticResource SegmentsListBox}" ScrollViewer.VerticalScrollBarVisibility="Visible" Visibility="{Binding IsFullMode, Converter={StaticResource BooleanToVisibilityConverter}}"/> @@ -984,22 +1009,39 @@ <RowDefinition Height="Auto" /> </Grid.RowDefinitions> - <DockPanel x:Name="header" HorizontalAlignment="Stretch" Margin="0 10 0 0"> - - - <controls:FastTextBlock VerticalAlignment="Center" DockPanel.Dock="Left" Text="Length (m):" FontSize="{StaticResource TangoButtonFontSize}"></controls:FastTextBlock> - <Border Margin="20 0 0 0" BorderThickness="1" Height="44" CornerRadius="12" BorderBrush="{StaticResource TangoMidAccentBrush}"> - <touch:TouchNumericTextBox Margin="20 0 0 0" Width="192" FocusSelectionMode="SelectAll" HorizontalAlignment="Left" HideUnderline="True" VerticalAlignment="Center" + <Grid x:Name="header" HorizontalAlignment="Stretch" Margin="0 10 0 0"> + <controls:FastTextBlock VerticalAlignment="Center" DockPanel.Dock="Left" FontSize="{StaticResource TangoButtonFontSize}" Width="120" HorizontalAlignment="Left"> + <controls:FastTextBlock.Style> + <Style TargetType="controls:FastTextBlock"> + <Setter Property="Text" Value="Weight (kg):" /> + <Style.Triggers> + <DataTrigger Binding="{Binding ElementName=segmentsGrid, Path=DataContext.IsWeightView}" Value="False"> + <Setter Property="Text" Value="Length (m):" /> + </DataTrigger> + </Style.Triggers> + </Style> + </controls:FastTextBlock.Style> + </controls:FastTextBlock> + <Border Margin="140 0 0 0" BorderThickness="1" Height="44" CornerRadius="12" BorderBrush="{StaticResource TangoMidAccentBrush}" Visibility="{Binding ElementName=segmentsGrid, Path=DataContext.IsWeightView, Converter={StaticResource BooleanToVisibilityInverseConverter}}"> + <touch:TouchNumericTextBox Margin="20 0 0 0" Width="192" FocusSelectionMode="SelectAll" HorizontalAlignment="Left" HideUnderline="True" VerticalAlignment="Center" Value="{Binding Length, UpdateSourceTrigger=LostFocus}" VerticalContentAlignment="Center" StringFormat="0.0" AutoCalculateJogStep="False" HasDecimalPoint="True" Minimum="1" Maximum="100000" KeyboardContainer="{Binding ElementName=Container}" FontSize="18" ValueChangedEnd="Length_ValueChanged" TextGotFocus="Length_BeforeChangeValue" RippleBrush="Transparent"/> - </Border> - - - </DockPanel> + + </Border> + <Border Margin="140 0 0 0" BorderThickness="1" Height="44" CornerRadius="12" BorderBrush="{StaticResource TangoMidAccentBrush}" Visibility="{Binding ElementName=segmentsGrid, Path=DataContext.IsWeightView, Converter={StaticResource BooleanToVisibilityConverter}}"> + <touch:TouchNumericTextBox Margin="20 0 0 0" Width="192" FocusSelectionMode="SelectAll" HorizontalAlignment="Left" HideUnderline="True" VerticalAlignment="Center" + Value="{Binding Weight, UpdateSourceTrigger=LostFocus}" VerticalContentAlignment="Center" + StringFormat="0.0000" AutoCalculateJogStep="False" + HasDecimalPoint="True" Minimum="0" Maximum="1000" + KeyboardContainer="{Binding ElementName=Container}" + FontSize="18" RippleBrush="Transparent"/> + + </Border> + </Grid> <Border Grid.Row="1" x:Name="segmentBrush" Height="90" Margin="0 20 0 0" CornerRadius="20" Background="{StaticResource TangoPrimaryBackgroundBrush}" BorderThickness="1" BorderBrush="{StaticResource TangoGrayBrush}"> @@ -1151,12 +1193,12 @@ <TextBlock VerticalAlignment="Center" Margin="0 0 0 0" FontSize="{StaticResource TangoDefaultFontSize}" Visibility="{Binding IsSummaryOpened, Converter={StaticResource BooleanToVisibilityInverseConverter}, Mode=TwoWay}"> <Run Text="Copy:" FontWeight="Normal"></Run> - <Run Text="{Binding JobModel.Length,Mode=OneWay}" FontWeight="DemiBold"/> + <Run Text="{Binding JobModel.Length,Mode=OneWay, StringFormat=0.##}" FontWeight="DemiBold"/> <Run Text="m" FontWeight="DemiBold"></Run> </TextBlock> <TextBlock VerticalAlignment="Center" Margin="20 0 0 0" FontSize="{StaticResource TangoDefaultFontSize}" Visibility="{Binding IsSummaryOpened, Converter={StaticResource BooleanToVisibilityInverseConverter}, Mode=TwoWay}"> <Run Text="Total:" FontWeight="Normal"></Run> - <Run Text="{Binding JobModel.LengthIncludingNumberOfUnitsAndSpools,Mode=OneWay}" FontWeight="DemiBold"/> + <Run Text="{Binding JobModel.LengthIncludingNumberOfUnitsAndSpools,Mode=OneWay,StringFormat=0.##}" FontWeight="DemiBold"/> <Run Text="m" FontWeight="DemiBold"></Run> </TextBlock> <TextBlock Margin="20 0 0 0" VerticalAlignment="Center" FontSize="{StaticResource TangoDefaultFontSize}" FontWeight="SemiBold" Foreground="{StaticResource TangoDarkForegroundBrush}"> @@ -1195,7 +1237,7 @@ <TextBlock Text="Total:" FontWeight="DemiBold" FontSize="{StaticResource TangoDefaultFontSize}"></TextBlock> <TextBlock FontSize="{StaticResource TangoDefaultFontSize}"> <Run Text="Copy:" FontWeight="Normal"></Run> - <Run Text="{Binding JobModel.Length,Mode=OneWay}" FontWeight="DemiBold"/> + <Run Text="{Binding JobModel.Length,Mode=OneWay,StringFormat=0.##}" FontWeight="DemiBold"/> <Run Text="m" FontWeight="DemiBold"></Run> </TextBlock> <TextBlock FontSize="{StaticResource TangoDefaultFontSize}"> @@ -1204,7 +1246,7 @@ </TextBlock> <TextBlock FontSize="{StaticResource TangoDefaultFontSize}"> <Run Text="Total:" FontWeight="Normal"></Run> - <Run Text="{Binding JobModel.LengthIncludingNumberOfUnitsAndSpools,Mode=OneWay}" FontWeight="DemiBold"/> + <Run Text="{Binding JobModel.LengthIncludingNumberOfUnitsAndSpools,Mode=OneWay, StringFormat=0.##}" FontWeight="DemiBold"/> <Run Text="m" FontWeight="DemiBold"></Run> </TextBlock> </UniformGrid> @@ -1220,7 +1262,7 @@ </TextBlock> <TextBlock FontSize="{StaticResource TangoDefaultFontSize}"> <Run Text="Total:" FontWeight="Normal"></Run> - <Run Text="{Binding JobModel.LengthIncludingNumberOfUnits,Mode=OneWay}" FontWeight="DemiBold"/> + <Run Text="{Binding JobModel.LengthIncludingNumberOfUnits,Mode=OneWay, StringFormat=0.##}" FontWeight="DemiBold"/> <Run Text="m" FontWeight="DemiBold"></Run> </TextBlock> </UniformGrid> 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> diff --git a/Software/Visual_Studio/Tango.BL/Entities/Job.cs b/Software/Visual_Studio/Tango.BL/Entities/Job.cs index 235a347b7..bfcd19cb1 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/Job.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/Job.cs @@ -93,6 +93,84 @@ namespace Tango.BL.Entities } } + [NotMapped] + [JsonIgnore] + public double LengthIncludingNumberOfUnitsAndSpools + { + get + { + if (Spools >= 4) + { + return LengthIncludingNumberOfUnits * Spools; + } + + return LengthIncludingNumberOfUnits; + } + } + + [NotMapped] + [JsonIgnore] + public double WeightIncludingNumberOfUnits + { + get + { + if (Rml == null) + return 0; + + var gramPerlength = Rml.GetGramPer1000mLength; + var weight = (LengthIncludingNumberOfUnits * gramPerlength) / (1000 * 1000);//(kg) + return weight; + } + } + + [NotMapped] + [JsonIgnore] + public double WeightIncludingNumberOfUnitsAndSpools + { + get + { + if (Spools >= 4) + { + return WeightIncludingNumberOfUnits * Spools; + } + + return WeightIncludingNumberOfUnits; + } + } + + [NotMapped] + [JsonIgnore] + public Int32 NumberOfUnitsMultipliedBySpools + { + get + { + if (Spools >= 4) + { + return NumberOfUnits * Spools; + } + return NumberOfUnits; + } + } + + [NotMapped] + [JsonIgnore] + public double WeightNumberOfUnits + { + get + { + _lastLength = GetLength(); + var l = _lastLength * Math.Max(NumberOfUnits, 1); + + if (EnableInterSegment && NumberOfUnits > 1) + { + l += ((NumberOfUnits - 1) * InterSegmentLength); + } + + return l; + } + } + + /// <summary> /// Gets or sets the job <see cref="Status"/> property as <see cref="JobStatus"/> enum instead of int. /// </summary> @@ -141,6 +219,13 @@ namespace Tango.BL.Entities } } + [NotMapped] + [JsonIgnore] + public int Spools + { + get { return 4; }//headunits? + } + /// <summary> /// Gets or sets the effective segments. /// </summary> @@ -318,6 +403,11 @@ namespace Tango.BL.Entities set { EditingState = value.ToInt32(); RaisePropertyChangedAuto(); } } + [NotMapped] + [JsonIgnore] + public double GramPerLength { get; private set;} + + #endregion #region Unmapped Fine Tuning @@ -381,6 +471,17 @@ namespace Tango.BL.Entities } } + protected override void OnRmlChanged(Rml rml) + { + base.OnRmlChanged(rml); + if(rml != null) + { + GramPerLength = Rml.GetGramPer1000mLength; + } + else + GramPerLength = 0; + } + #endregion #region Override Methods @@ -529,6 +630,17 @@ namespace Tango.BL.Entities return length; } + private double GetWeigth() + { + if(Rml == null) + return 0; + + double length = GetLength(); + + var weight = (length * GramPerLength) / (1000 * 1000);//length in m, return value in kg + return weight; + } + #endregion #region Public Methods diff --git a/Software/Visual_Studio/Tango.BL/Entities/Rml.cs b/Software/Visual_Studio/Tango.BL/Entities/Rml.cs index a49b3cf84..80d3afdba 100644 --- a/Software/Visual_Studio/Tango.BL/Entities/Rml.cs +++ b/Software/Visual_Studio/Tango.BL/Entities/Rml.cs @@ -292,6 +292,30 @@ namespace Tango.BL.Entities } } + [NotMapped] + [JsonIgnore] + public double GetGramPer1000mLength + { + + get + { + if (LinearMassDensityUnit == null || FiberSize == 0) + return 1; + if (LinearMassDensityUnit.Name == "Tex") + return FiberSize; + if (LinearMassDensityUnit.Name == "DTEX") + return (FiberSize /10); + if (LinearMassDensityUnit.Name == "Ne") + return (590.5 / FiberSize); + if (LinearMassDensityUnit.Name == "Nm") + return (1000 / FiberSize); + if (LinearMassDensityUnit.Name == "Denier") + return FiberSize/9; + + return 1; + } + } + [NotMapped] [JsonIgnore] diff --git a/Software/Visual_Studio/Tango.Touch/Resources/Colors.xaml b/Software/Visual_Studio/Tango.Touch/Resources/Colors.xaml index 0ae0c31f0..283e69b45 100644 --- a/Software/Visual_Studio/Tango.Touch/Resources/Colors.xaml +++ b/Software/Visual_Studio/Tango.Touch/Resources/Colors.xaml @@ -58,6 +58,7 @@ <Color x:Key="TangoPanelMaskColor">#9E000000</Color> <Color x:Key="TangoPanelMaskColorLight">#55FFFFFF</Color> + <Color x:Key="TangoMenuPanelDarkColor">#000131</Color> <!--Brushes--> <SolidColorBrush x:Key="TangoPrimaryBackgroundBrush" Color="{StaticResource TangoPrimaryBackgroundColor}"></SolidColorBrush> @@ -126,4 +127,5 @@ <SolidColorBrush x:Key="TangoPopupTitleBackgroundBrush" Color="{StaticResource TangoPopupTitleBackgroundColor}"></SolidColorBrush> <SolidColorBrush x:Key="TangoPowerMenuOpenedBackgroundBrush" Color="{StaticResource TangoPowerMenuOpenedBackgroundColor}"></SolidColorBrush> + <SolidColorBrush x:Key="TangoMenuPanelDarkBrush" Color="{StaticResource TangoMenuPanelDarkColor}"></SolidColorBrush> </ResourceDictionary>
\ No newline at end of file diff --git a/Software/Visual_Studio/Tango.Touch/Styles/TouchScrollViewer.xaml b/Software/Visual_Studio/Tango.Touch/Styles/TouchScrollViewer.xaml index 8c112431e..92cbc71f1 100644 --- a/Software/Visual_Studio/Tango.Touch/Styles/TouchScrollViewer.xaml +++ b/Software/Visual_Studio/Tango.Touch/Styles/TouchScrollViewer.xaml @@ -87,5 +87,48 @@ </Setter> </Style> + <Style x:Key="TouchScrollViewerListBox" TargetType="{x:Type controls:TouchScrollViewer}" > + <Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/> + <Setter Property="Stylus.IsFlicksEnabled" Value="false"/> + <Setter Property="Background" Value="#33000000"/> + <Setter Property="BorderBrush" Value="#33000000"/> + <Setter Property="Foreground" Value="Gray"/> + <Setter Property="BorderThickness" Value="0"/> + <Setter Property="Width" Value="5"/> + <Setter Property="MinWidth" Value="5"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type ScrollViewer}"> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="Auto"/> + <RowDefinition Height="*"/> + </Grid.RowDefinitions> + + <DataGridColumnHeadersPresenter x:Name="PART_ColumnHeadersPresenter" Visibility="Collapsed"/> + <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" Grid.Row="1"/> + <ScrollBar Opacity="0" Grid.Row="1" x:Name="PART_VerticalScrollBar" Style="{StaticResource TouchScrollBar}" HorizontalAlignment="Right" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}"/> + </Grid> + + <ControlTemplate.Triggers> + <EventTrigger RoutedEvent="ScrollViewer.ScrollChanged"> + <EventTrigger.Actions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimationUsingKeyFrames Storyboard.TargetName="PART_VerticalScrollBar" Storyboard.TargetProperty="Opacity" Duration="00:00:03" FillBehavior="Stop"> + <EasingDoubleKeyFrame KeyTime="00:00:0.2" Value="1"></EasingDoubleKeyFrame> + <DiscreteDoubleKeyFrame KeyTime="00:00:2.5" Value="1"></DiscreteDoubleKeyFrame> + <EasingDoubleKeyFrame KeyTime="00:00:03" Value="0"></EasingDoubleKeyFrame> + </DoubleAnimationUsingKeyFrames> + </Storyboard> + </BeginStoryboard> + </EventTrigger.Actions> + </EventTrigger> + </ControlTemplate.Triggers> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + </ResourceDictionary>
\ No newline at end of file |
