aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-01-31 13:30:15 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-01-31 13:30:15 +0200
commit80c023fa734d7788e155d4f311ab16220aa80650 (patch)
treedc79c0689e00419c7f447d1b32716df99df8f278 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer
parent2fa92ca3654ebb274482f9bad86231028d357e5a (diff)
downloadTango-80c023fa734d7788e155d4f311ab16220aa80650.tar.gz
Tango-80c023fa734d7788e155d4f311ab16220aa80650.zip
Job Brush working nicely.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentToBrushConverter.cs48
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentToBrushConverterMulti.cs53
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs67
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml97
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml.cs37
6 files changed, 278 insertions, 26 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentToBrushConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentToBrushConverter.cs
new file mode 100644
index 000000000..8aef260ff
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentToBrushConverter.cs
@@ -0,0 +1,48 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Media;
+using Tango.Integration.Observables;
+
+namespace Tango.MachineStudio.Developer.Converters
+{
+ public class SegmentToBrushConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ try
+ {
+ Segment segment = value as Segment;
+
+ GradientStopCollection stops = new GradientStopCollection();
+
+ foreach (var stop in segment.BrushStops)
+ {
+ stops.Add(new GradientStop(stop.Color, stop.OffsetPercent / 100d));
+ }
+
+ LinearGradientBrush brush = new LinearGradientBrush();
+ brush.StartPoint = new Point(0,0);
+ brush.EndPoint = new Point(1, 0);
+
+ brush.GradientStops = stops;
+
+ return brush;
+ }
+ catch
+ {
+ return null;
+ }
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentToBrushConverterMulti.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentToBrushConverterMulti.cs
new file mode 100644
index 000000000..0248fd730
--- /dev/null
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Converters/SegmentToBrushConverterMulti.cs
@@ -0,0 +1,53 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Media;
+using Tango.Integration.Observables;
+
+namespace Tango.MachineStudio.Developer.Converters
+{
+ public class SegmentToBrushConverterMulti : IMultiValueConverter
+ {
+ public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+ {
+ try
+ {
+ Segment segment = values[0] as Segment;
+
+ if (segment != null)
+ {
+ GradientStopCollection stops = new GradientStopCollection();
+
+ foreach (var stop in segment.BrushStops)
+ {
+ stops.Add(new GradientStop(stop.Color, stop.OffsetPercent / 100d));
+ }
+
+ LinearGradientBrush brush = new LinearGradientBrush();
+ brush.StartPoint = new Point(0, 0);
+ brush.EndPoint = new Point(1, 0);
+
+ brush.GradientStops = stops;
+
+ return brush;
+ }
+
+ return null;
+ }
+ catch
+ {
+ return null;
+ }
+ }
+
+ public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj
index 7d6712318..3a753dedc 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj
@@ -79,6 +79,8 @@
<Compile Include="Converters\InkVolumeToLiquidRmlFactor.cs" />
<Compile Include="Converters\JobToColumnDefinitionsConverter.cs" />
<Compile Include="Converters\SegmentLengthToWidthConverter.cs" />
+ <Compile Include="Converters\SegmentToBrushConverter.cs" />
+ <Compile Include="Converters\SegmentToBrushConverterMulti.cs" />
<Compile Include="Converters\SegmentToGradientStopsConverterMulti.cs" />
<Compile Include="Converters\SegmentToGradientStopsConverter.cs" />
<Compile Include="DeveloperModule.cs" />
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs
index f6ddc9d19..7afb099db 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs
@@ -76,7 +76,8 @@ namespace Tango.MachineStudio.Developer.ViewModels
public ProcessParametersTablesGroup RmlProcessParametersTableGroup
{
get { return _rmlProcessParametersTablesGroup; }
- set { _rmlProcessParametersTablesGroup = value; RaisePropertyChangedAuto(); }
+ set
+ { _rmlProcessParametersTablesGroup = value; RaisePropertyChangedAuto(); OnProcessParametersTableGroupChanged(); }
}
private ObservableCollection<ProcessParametersTablesGroup> _groupsHistory;
@@ -100,6 +101,16 @@ namespace Tango.MachineStudio.Developer.ViewModels
set { _selectedGroupHistory = value; RaisePropertyChangedAuto(); OnSelectedGroupHistoryChanged(); }
}
+ private ProcessParametersTable _selectedProcessParametersTable;
+ /// <summary>
+ /// Gets or sets the selected process parameters table.
+ /// </summary>
+ public ProcessParametersTable SelectedProcessParametersTable
+ {
+ get { return _selectedProcessParametersTable; }
+ set { _selectedProcessParametersTable = value; RaisePropertyChangedAuto(); }
+ }
+
private Job _selectedJob;
/// <summary>
/// Gets or sets the selected machine job.
@@ -181,6 +192,16 @@ namespace Tango.MachineStudio.Developer.ViewModels
set { _graphs = value; RaisePropertyChangedAuto(); }
}
+ private TimeSpan _estimatedDuration;
+ /// <summary>
+ /// Gets or sets the estimated duration for the selected job.
+ /// </summary>
+ public TimeSpan EstimatedDuration
+ {
+ get { return _estimatedDuration; }
+ set { _estimatedDuration = value; RaisePropertyChangedAuto(); }
+ }
+
#endregion
#region Commands
@@ -297,11 +318,38 @@ namespace Tango.MachineStudio.Developer.ViewModels
InvalidateLiquidFactorsAndProcessTables();
}
+ private void SelectedJob_LengthChanged(object sender, EventArgs e)
+ {
+ UpdateEstimatedDuration();
+ }
+
+ private void SelectedProcessParametersTable_DyeingSpeedChanged(object sender, EventArgs e)
+ {
+ UpdateEstimatedDuration();
+ }
+
#endregion
#region Virtual Methods
/// <summary>
+ /// Called when the process parameters table group has been changed
+ /// </summary>
+ /// <exception cref="NotImplementedException"></exception>
+ private void OnProcessParametersTableGroupChanged()
+ {
+ if (RmlProcessParametersTableGroup != null && RmlProcessParametersTableGroup.ProcessParametersTables.Count > 0)
+ {
+ SelectedProcessParametersTable = RmlProcessParametersTableGroup.ProcessParametersTables.First();
+
+ SelectedProcessParametersTable.DyeingSpeedChanged -= SelectedProcessParametersTable_DyeingSpeedChanged;
+ SelectedProcessParametersTable.DyeingSpeedChanged += SelectedProcessParametersTable_DyeingSpeedChanged;
+ }
+
+ UpdateEstimatedDuration();
+ }
+
+ /// <summary>
/// Called when the selected segment has been changed
/// </summary>
protected virtual void OnSelectedSegmentChanged()
@@ -321,6 +369,11 @@ namespace Tango.MachineStudio.Developer.ViewModels
if (SelectedJob != null)
{
SelectedSegment = SelectedJob.Segments.FirstOrDefault();
+
+ SelectedJob.LengthChanged -= SelectedJob_LengthChanged;
+ SelectedJob.LengthChanged += SelectedJob_LengthChanged;
+
+ UpdateEstimatedDuration();
}
}
@@ -347,6 +400,14 @@ namespace Tango.MachineStudio.Developer.ViewModels
#region Private Methods
+ private void UpdateEstimatedDuration()
+ {
+ if (SelectedJob != null && SelectedProcessParametersTable != null)
+ {
+ EstimatedDuration = TimeSpan.FromSeconds(SelectedJob.Length / (SelectedProcessParametersTable.DyeingSpeed / 100d));
+ }
+ }
+
private void SetSegmentBrushStopsLiquidVolumes(Segment segment)
{
if (!DesignMode)
@@ -475,7 +536,10 @@ namespace Tango.MachineStudio.Developer.ViewModels
{
Segment seg = new Segment();
seg.Name = "Untitled Segment";
+ seg.Length = 1;
SelectedJob.Segments.Add(seg);
+ SelectedSegment = seg;
+ AddBrushStop();
}
}
@@ -526,6 +590,7 @@ namespace Tango.MachineStudio.Developer.ViewModels
{
var stop = new BrushStop();
stop.ColorSpace = Adapter.ColorSpaces.FirstOrDefault();
+ stop.Color = Colors.Black;
stop.SetLiquidVolumes(SelectedMachine.Configuration, SelectedRML);
SelectedSegment.BrushStops.Add(stop);
}
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml
index e0786a1ba..0c3cd62b5 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml
@@ -40,6 +40,8 @@
<localConverters:JobToColumnDefinitionsConverter x:Key="JobToColumnDefinitionsConverter" />
<localConverters:SegmentLengthToWidthConverter x:Key="SegmentLengthToWidthConverter" />
<localConverters:SegmentToGradientStopsConverterMulti x:Key="SegmentToGradientStopsConverterMulti" />
+ <localConverters:SegmentToBrushConverter x:Key="SegmentToBrushConverter" />
+ <localConverters:SegmentToBrushConverterMulti x:Key="SegmentToBrushConverterMulti" />
<SolidColorBrush x:Key="SideBarBackground" Color="#F9F9F9">
@@ -232,15 +234,34 @@
</ListBox>
</DockPanel>
</Border>
- <ItemsControl ItemsSource="{Binding RmlProcessParametersTableGroup.ProcessParametersTables}" IsEnabled="{Binding RmlProcessParametersTableGroup.Active}">
- <ItemsControl.ItemsPanel>
+ <ListBox ScrollViewer.VerticalScrollBarVisibility="Disabled" BorderThickness="0" Style="{x:Null}" HorizontalContentAlignment="Stretch" ItemsSource="{Binding RmlProcessParametersTableGroup.ProcessParametersTables}" SelectedItem="{Binding SelectedProcessParametersTable}" IsEnabled="{Binding RmlProcessParametersTableGroup.Active}">
+ <ListBox.ItemContainerStyle>
+ <Style TargetType="ListBoxItem" BasedOn="{StaticResource basicListBoxItem}">
+
+ </Style>
+ </ListBox.ItemContainerStyle>
+ <ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel IsItemsHost="True"></WrapPanel>
</ItemsPanelTemplate>
- </ItemsControl.ItemsPanel>
- <ItemsControl.ItemTemplate>
+ </ListBox.ItemsPanel>
+ <ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type observables:ProcessParametersTable}">
- <Border Padding="5" CornerRadius="5" BorderThickness="1" BorderBrush="Silver" Height="250" Margin="0 0 10 0">
+ <Border Padding="5" CornerRadius="5" BorderThickness="1" Height="245" Margin="0 0 10 0">
+ <Border.Style>
+ <Style TargetType="Border" BasedOn="{StaticResource brushStopBorder}">
+ <Setter Property="BorderBrush" Value="Silver"></Setter>
+ <Setter Property="Opacity" Value="0.5"></Setter>
+ <Setter Property="Background" Value="{StaticResource SideBarBackground}"></Setter>
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected,FallbackValue=False}" Value="True">
+ <Setter Property="BorderBrush" Value="{StaticResource AccentColorBrush}"></Setter>
+ <Setter Property="Background" Value="White"></Setter>
+ <Setter Property="Opacity" Value="1"></Setter>
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Border.Style>
<DockPanel>
<TextBox materialDesign:HintAssist.Hint="Table Name" DockPanel.Dock="Top" Text="{Binding Name}"></TextBox>
<WrapPanel Orientation="Vertical" Margin="0 5 0 0">
@@ -305,8 +326,8 @@
</DockPanel>
</Border>
</DataTemplate>
- </ItemsControl.ItemTemplate>
- </ItemsControl>
+ </ListBox.ItemTemplate>
+ </ListBox>
<StackPanel Margin="5 0 0 10" VerticalAlignment="Bottom">
<Button Command="{Binding SaveProcessParametersCommand}">SAVE GROUP</Button>
@@ -448,7 +469,7 @@
</StackPanel>
<DockPanel LastChildFill="True">
<ToggleButton Margin="10 0 0 0" DockPanel.Dock="Right" VerticalAlignment="Bottom" HorizontalAlignment="Right" IsChecked="{Binding SelectedJob.EnableInterSegment}"></ToggleButton>
- <mahapps:NumericUpDown IsEnabled="{Binding SelectedJob.EnableInterSegment}" Margin="0 2 0 0" HideUpDownButtons="True" Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0 0 0 1" BorderBrush="DimGray" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding SelectedJob.InterSegmentLength,Mode=TwoWay}"></mahapps:NumericUpDown>
+ <mahapps:NumericUpDown StringFormat="{}{0:N1} m" IsEnabled="{Binding SelectedJob.EnableInterSegment}" Margin="0 2 0 0" HideUpDownButtons="True" Minimum="0" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0 0 0 1" BorderBrush="DimGray" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding SelectedJob.InterSegmentLength,Mode=TwoWay}"></mahapps:NumericUpDown>
</DockPanel>
</StackPanel>
</Border>
@@ -549,7 +570,7 @@
<Image Source="../Images/ruler.png" Width="32"></Image>
<TextBlock VerticalAlignment="Center" Margin="5 0 0 0" FontSize="10">Length</TextBlock>
</StackPanel>
- <mahapps:NumericUpDown IsEnabled="{Binding SelectedJob.EnableInterSegment}" Margin="0 2 0 0" Minimum="1" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0 0 0 1" BorderBrush="DimGray" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding SelectedSegment.Length,Mode=TwoWay}"></mahapps:NumericUpDown>
+ <mahapps:NumericUpDown StringFormat="{}{0:N1} m" IsEnabled="{Binding SelectedJob.EnableInterSegment}" Margin="0 2 0 0" Minimum="1" Maximum="10000" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0 0 0 1" BorderBrush="DimGray" InterceptMouseWheel="True" HasDecimals="True" HorizontalContentAlignment="Left" Value="{Binding SelectedSegment.Length,Mode=TwoWay}"></mahapps:NumericUpDown>
</StackPanel>
</Border>
</StackPanel>
@@ -952,7 +973,7 @@
<StackPanel HorizontalAlignment="Left" Margin="0 0 0 0">
<TextBlock FontSize="14" Margin="0 20 0 0">
<Run FontWeight="Bold">ESTIMATED DURATION:</Run>
- <Run FontSize="18" Foreground="{StaticResource AccentColorBrush}" FontStyle="Italic" FontFamily="digital-7">00:00:00</Run>
+ <Run FontSize="18" Foreground="{StaticResource AccentColorBrush}" FontStyle="Italic" FontFamily="digital-7" Text="{Binding EstimatedDuration,StringFormat=hh\\:mm\\:ss,TargetNullValue='00:00:00'}"></Run>
</TextBlock>
</StackPanel>
</Grid>
@@ -969,12 +990,12 @@
</Grid>
<Grid>
- <Border VerticalAlignment="Center" Height="10" Margin="20 0 20 0" BorderBrush="Gainsboro" BorderThickness="1">
- <Grid>
- <ItemsControl ItemsSource="{Binding SelectedJob.Segments}" x:Name="jobBrushList">
+ <Border VerticalAlignment="Center" Height="10" Margin="30 0 40 0" BorderBrush="Gainsboro" BorderThickness="1" ClipToBounds="False">
+ <Grid ClipToBounds="False">
+ <ItemsControl x:Name="jobBrushList" ClipToBounds="False">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
- <StackPanel Orientation="Horizontal"></StackPanel>
+ <StackPanel Orientation="Horizontal" ClipToBounds="False"></StackPanel>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
@@ -990,22 +1011,50 @@
</Grid.Width>
<Rectangle>
<Rectangle.Fill>
- <LinearGradientBrush StartPoint="0,0" EndPoint="1,0">
- <LinearGradientBrush.GradientStops>
- <MultiBinding Converter="{StaticResource SegmentToGradientStopsConverterMulti}">
- <Binding Path="."></Binding>
- <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.SelectedJob"></Binding>
- <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.SelectedJob.Length"></Binding>
- <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.SelectedBrushStop.Color"></Binding>
- </MultiBinding>
- </LinearGradientBrush.GradientStops>
- </LinearGradientBrush>
+ <MultiBinding Converter="{StaticResource SegmentToBrushConverterMulti}">
+ <Binding Path="."></Binding>
+ <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.SelectedJob"></Binding>
+ <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.SelectedJob.Length"></Binding>
+ <Binding RelativeSource="{RelativeSource AncestorType=UserControl}" Path="DataContext.SelectedBrushStop.Color"></Binding>
+ </MultiBinding>
</Rectangle.Fill>
</Rectangle>
+
+ <StackPanel Margin="0 -23 0 0" HorizontalAlignment="Right">
+ <TextBlock FontSize="9" HorizontalAlignment="Right">
+ <Run Text="{Binding Length,Mode=OneWay}"></Run>
+ <Run Foreground="Gray" FontSize="8" Text="m"></Run>
+ </TextBlock>
+ <materialDesign:PackIcon HorizontalAlignment="Right" RenderTransformOrigin="0.5,0.5" Kind="Triangle" Width="8" Height="8" Foreground="DimGray">
+ <materialDesign:PackIcon.RenderTransform>
+ <RotateTransform Angle="180" />
+ </materialDesign:PackIcon.RenderTransform>
+ </materialDesign:PackIcon>
+ </StackPanel>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
+
+ <StackPanel Margin="-20 -26 0 0" HorizontalAlignment="Left">
+ <TextBlock FontSize="9">
+ <Run Text="0"></Run>
+ <Run Foreground="Gray" FontSize="8" Text="m"></Run>
+ </TextBlock>
+ <materialDesign:PackIcon HorizontalAlignment="Right" RenderTransformOrigin="0.5,0.5" Kind="SubdirectoryArrowRight" Width="16" Height="16" Foreground="DimGray">
+
+ </materialDesign:PackIcon>
+ </StackPanel>
+
+ <StackPanel Margin="0 -26 -30 0" HorizontalAlignment="Right">
+ <TextBlock FontSize="9">
+ <Run Text="{Binding SelectedJob.Length,Mode=OneWay}"></Run>
+ <Run Foreground="Gray" FontSize="8" Text="m"></Run>
+ </TextBlock>
+ <materialDesign:PackIcon HorizontalAlignment="Right" RenderTransformOrigin="0.5,0.5" Kind="FlagCheckered" Width="16" Height="16" Foreground="DimGray">
+
+ </materialDesign:PackIcon>
+ </StackPanel>
</Grid>
</Border>
</Grid>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml.cs
index c76cf657f..143280e66 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Views/MainView.xaml.cs
@@ -16,6 +16,7 @@ using Tango.Integration.Observables;
using Tango.DragAndDrop;
using Tango.MachineStudio.Developer.Converters;
using Tango.MachineStudio.Developer.ViewModels;
+using System.Windows.Threading;
namespace Tango.MachineStudio.Developer.Views
{
@@ -25,6 +26,7 @@ namespace Tango.MachineStudio.Developer.Views
public partial class MainView : UserControl
{
private MainViewVM _vm;
+ private DispatcherTimer _jobBrushTimer;
public DraggingSurface DraggingSurface
{
@@ -46,6 +48,40 @@ namespace Tango.MachineStudio.Developer.Views
chkGraphs.Checked += (x, y) => { graphRowDefinition.Height = new GridLength(440, GridUnitType.Pixel); };
chkGraphs.Unchecked += (x, y) => { graphRowDefinition.Height = new GridLength(80, GridUnitType.Pixel); };
+
+ _jobBrushTimer = new DispatcherTimer();
+ _jobBrushTimer.Interval = TimeSpan.FromSeconds(1);
+ _jobBrushTimer.Tick += _jobBrushTimer_Tick;
+ _jobBrushTimer.Start();
+ }
+
+ private void _jobBrushTimer_Tick(object sender, EventArgs e)
+ {
+ if (_vm != null && _vm.SelectedJob != null)
+ {
+ List<Segment> segments = new List<Segment>();
+ foreach (var s in _vm.SelectedJob.Segments)
+ {
+ segments.Add(s);
+
+ if (_vm.SelectedJob.EnableInterSegment && _vm.SelectedJob.Segments.IndexOf(s) != _vm.SelectedJob.Segments.Count - 1)
+ {
+ segments.Add(new Segment()
+ {
+ Length = _vm.SelectedJob.InterSegmentLength,
+ BrushStops = new System.Collections.ObjectModel.ObservableCollection<BrushStop>()
+ {
+ new BrushStop()
+ {
+ Color = Colors.White,
+ }
+ },
+ });
+ }
+ }
+
+ jobBrushList.ItemsSource = segments;
+ }
}
private void OnDropAvailableSensor(object sender, DropEventArgs e)
@@ -73,7 +109,6 @@ namespace Tango.MachineStudio.Developer.Views
SegmentToGradientStopsConverter converter = new SegmentToGradientStopsConverter();
GradientStopCollection stops = converter.Convert(_vm.SelectedSegment, null, null, null) as GradientStopCollection;
gradientBrush.GradientStops = stops;
- jobBrushList.UpdateLayout();
}
else
{