aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician
diff options
context:
space:
mode:
authorMirta <mirta@twine-s.com>2020-12-30 16:39:52 +0200
committerMirta <mirta@twine-s.com>2020-12-30 16:39:52 +0200
commit00a491d93733d4625ad329b2ba8237f445364b3f (patch)
tree4b24c6fa78d7648f4bb7cefafa464bb0b063fec4 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician
parent124ad4150f80c6846fdee41dbbda9848c105f6e5 (diff)
downloadTango-00a491d9.tar.gz
Tango-00a491d9.zip
merge
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/BlowerElementEditor.xaml6
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ControllerElementEditor.xaml6
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml4
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/JobRunnerElementEditor.xaml2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ProcessParametersElementEditor.xaml4
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ThreadMotionElementEditor.xaml2
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ValveElementEditor.xaml6
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs331
10 files changed, 108 insertions, 257 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/BlowerElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/BlowerElementEditor.xaml
index dae945940..524dd79c5 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/BlowerElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/BlowerElementEditor.xaml
@@ -56,8 +56,8 @@
</i:Interaction.Triggers>
</visuals:AnalogSwitch>
- <Border Background="#1B1B1B" Margin="8" CornerRadius="3" Padding="5" Grid.Column="1">
- <Grid >
+ <Border Background="{StaticResource DarkGrayBrush}" Margin="8" CornerRadius="3" Padding="5" Grid.Column="1">
+ <Grid>
<mahapps:NumericUpDown Style="{x:Null}" InterceptMouseWheel="True" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HorizontalContentAlignment="Right" HideUpDownButtons="True" ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Disabled" HasDecimals="True" Minimum="0" Maximum="10000" Padding="0" Value="{Binding HardwareBlower.Voltage,FallbackValue='0.0',Mode=TwoWay}" VerticalAlignment="Center" FontSize="44" FontFamily="{StaticResource digital-7}" Foreground="#FFD400" Margin="0 0 16 0">
<mahapps:NumericUpDown.Resources>
<Style TargetType="TextBox">
@@ -72,7 +72,7 @@
<Button Style="{x:Null}" Grid.Column="2" Margin="8" Cursor="Hand" Command="{Binding SetCommand}">
<Button.Template>
<ControlTemplate TargetType="Button">
- <Grid Background="#3E3E3E">
+ <Grid Background="{StaticResource GrayBrush280}">
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Gainsboro" FontSize="16" FontWeight="SemiBold">SET</TextBlock>
</Grid>
<ControlTemplate.Triggers>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ControllerElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ControllerElementEditor.xaml
index e71f7e1e0..27530ab10 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ControllerElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ControllerElementEditor.xaml
@@ -86,7 +86,7 @@
<RowDefinition Height="70*"/>
<RowDefinition Height="90*"/>
</Grid.RowDefinitions>
- <Border Background="#1B1B1B" Margin="0 3 0 0" CornerRadius="3" Padding="5">
+ <Border Background="{StaticResource DarkGrayBrush}" Margin="0 3 0 0" CornerRadius="3" Padding="5">
<Grid>
<TextBlock Text="{Binding EffectiveValue,StringFormat=0.0,FallbackValue='0.0'}" Foreground="#FF6F78" HorizontalAlignment="Right" VerticalAlignment="Center" FontSize="44" FontFamily="{StaticResource digital-7}" Margin="0 0 12 0">
@@ -95,7 +95,7 @@
</Grid>
</Border>
- <Border Background="#1B1B1B" Grid.Row="1" Margin="0 10 0 0" CornerRadius="3" Padding="5">
+ <Border Background="{StaticResource DarkGrayBrush}" Grid.Row="1" Margin="0 10 0 0" CornerRadius="3" Padding="5">
<Grid>
<mahapps:NumericUpDown Style="{x:Null}" InterceptMouseWheel="True" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HorizontalContentAlignment="Right" HideUpDownButtons="True" ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Disabled" StringFormat="0.0" HasDecimals="True" Minimum="{Binding ElementName=fader,Path=Minimum}" Maximum="{Binding ElementName=fader,Path=Maximum}" Padding="0" Value="{Binding Value,Mode=TwoWay,StringFormat=0.0,FallbackValue=0.0}" VerticalAlignment="Center" FontSize="44" FontFamily="{StaticResource digital-7}" Foreground="#FFD400" Margin="0 0 12 0">
<mahapps:NumericUpDown.Resources>
@@ -111,7 +111,7 @@
<Button Style="{x:Null}" Grid.Row="2" VerticalAlignment="Bottom" Height="60" Cursor="Hand" Command="{Binding SetCommand}">
<Button.Template>
<ControlTemplate TargetType="Button">
- <Grid Background="#1B1B1B">
+ <Grid Background="{StaticResource GrayBrush280}">
<TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Gainsboro" FontSize="16" FontWeight="SemiBold">SET</TextBlock>
</Grid>
<ControlTemplate.Triggers>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml
index e0da8aa03..90e18d43e 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/DispenserElementEditor.xaml
@@ -170,7 +170,7 @@
</Grid>
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0 0 -65 0">
- <Border Background="#1B1B1B" CornerRadius="3" Padding="3">
+ <Border Background="{StaticResource DarkGrayBrush}" CornerRadius="3" Padding="3">
<mahapps:NumericUpDown BorderThickness="0" Background="Transparent" HideUpDownButtons="True" HasDecimals="False" Minimum="0" Maximum="10000" StringFormat="0" Value="{Binding Speed,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat=0,FallbackValue=5000}" HorizontalAlignment="Center" HorizontalContentAlignment="Center" FontSize="22" VerticalAlignment="Center" Foreground="{StaticResource RedBrush400}" FontFamily="{StaticResource digital-7}"></mahapps:NumericUpDown>
</Border>
<visuals:Knob Width="50" Height="50" TicksHighlightBrush="{StaticResource RedBrush400}" KnobType="MetroDark" TicksWidth="2" Margin="0 5 0 0" TicksHeight="5" Minimum="0" Maximum="5000" Value="{Binding Speed,Mode=TwoWay}" />
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml
index ffeb1f134..190b4d3c8 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/HeaterElementEditor.xaml
@@ -48,7 +48,7 @@
</Grid>
<Grid Grid.Row="1">
- <Border Background="#1B1B1B" Margin="0 3 0 0" CornerRadius="3" Padding="5">
+ <Border Background="{StaticResource DarkGrayBrush}" Margin="0 3 0 0" CornerRadius="3" Padding="5">
<Grid>
<TextBlock Text="{Binding HeaterState.CurrentValue,StringFormat=0.00,FallbackValue='0.00'}" HorizontalAlignment="Right" VerticalAlignment="Center" FontSize="80" FontFamily="{StaticResource digital-7}" Margin="0 0 12 0">
<TextBlock.Style>
@@ -75,7 +75,7 @@
<Image Source="../Images/temperature.png" Margin="0 10 20 10" RenderOptions.BitmapScalingMode="Fant"></Image>
- <Border Background="#1B1B1B" Margin="0 3 0 0" CornerRadius="3" Padding="5" Grid.Column="1">
+ <Border Background="{StaticResource DarkGrayBrush}" Margin="0 3 0 0" CornerRadius="3" Padding="5" Grid.Column="1">
<Grid>
<mahapps:NumericUpDown x:Name="txtSetPoint" InterceptMouseWheel="True" IsHitTestVisible="{Binding IsEditing}" InterceptArrowKeys="True" Background="Transparent" BorderThickness="0" HorizontalContentAlignment="Right" HideUpDownButtons="True" ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Disabled" HasDecimals="True" Minimum="0" Maximum="400" Padding="0" Value="{Binding SetPoint,FallbackValue='0.0',Mode=TwoWay}" VerticalAlignment="Center" FontSize="44" FontFamily="{StaticResource digital-7}" Foreground="#FFD400" Margin="0 0 12 0">
<mahapps:NumericUpDown.Resources>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/JobRunnerElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/JobRunnerElementEditor.xaml
index b57db3d3f..5165e9819 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/JobRunnerElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/JobRunnerElementEditor.xaml
@@ -43,7 +43,7 @@
<!--Content-->
<Grid>
- <Border Padding="10" BorderThickness="1" BorderBrush="{StaticResource DarkGrayBrush}" Background="{StaticResource TransparentBackgroundBrush}" CornerRadius="5">
+ <Border Padding="10" BorderThickness="1" BorderBrush="{StaticResource DarkGrayBrush}" Background="#88FFFFFF" CornerRadius="5">
<DockPanel>
<TextBox Foreground="{StaticResource DarkGrayBrush}" FontSize="14" DockPanel.Dock="Top" Text="{Binding Job.Name}"></TextBox>
<ItemsControl Margin="0 10 0 0" DockPanel.Dock="Top" ItemsSource="{Binding BrushStop.LiquidVolumes}" VerticalAlignment="Center">
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml
index 77cccaf8f..7c3728d1e 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MotorElementEditor.xaml
@@ -154,7 +154,7 @@
</Viewbox>
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0 0 -65 5">
- <Border Background="#1B1B1B" CornerRadius="3" Padding="3">
+ <Border Background="{StaticResource DarkGrayBrush}" CornerRadius="3" Padding="3">
<mahapps:NumericUpDown BorderThickness="0" Background="Transparent" HideUpDownButtons="True" HasDecimals="False" Minimum="0" Maximum="10000" StringFormat="0" Value="{Binding Speed,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat=0,FallbackValue=5000}" HorizontalAlignment="Center" HorizontalContentAlignment="Center" FontSize="22" VerticalAlignment="Center" Foreground="{StaticResource RedBrush400}" FontFamily="{StaticResource digital-7}"></mahapps:NumericUpDown>
</Border>
<visuals:Knob Width="50" Height="50" TicksHighlightBrush="{StaticResource RedBrush400}" KnobType="MetroDark" TicksWidth="2" Margin="0 5 0 0" TicksHeight="5" Minimum="0" Maximum="5000" Value="{Binding Speed,Mode=TwoWay}" />
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ProcessParametersElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ProcessParametersElementEditor.xaml
index b86f52688..3c4373097 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ProcessParametersElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ProcessParametersElementEditor.xaml
@@ -57,8 +57,8 @@
<Grid Margin="0 2" Focusable="False" Background="Transparent" Style="{StaticResource draggableDroppableGrid}" dragAndDrop:DragAndDropService.Drop="OnProcessParametersDropped" dragAndDrop:DragAndDropService.DraggingSurface="{Binding RelativeSource={RelativeSource AncestorType=editors:ParameterizedEditor},Path=DraggingSurface}">
<ContentControl Focusable="False">
<DockPanel Focusable="False">
- <TextBlock Focusable="False" Width="150" FontSize="12" Foreground="#1B1B1B" DockPanel.Dock="Left" IsHitTestVisible="False" Margin="0 5 0 5" Text="{Binding Name}"></TextBlock>
- <mahapps:NumericUpDown FontSize="14" Minimum="0" Margin="0 0 5 0" HorizontalContentAlignment="Left" HideUpDownButtons="True" Maximum="10000" StringFormat="0.0" InterceptArrowKeys="True" InterceptMouseWheel="True" HasDecimals="True" Value="{Binding Value,Mode=TwoWay}" Background="{StaticResource TransparentBackgroundBrush600}"></mahapps:NumericUpDown>
+ <TextBlock Focusable="False" Width="150" FontSize="12" Foreground="{StaticResource DarkGrayBrush}" DockPanel.Dock="Left" IsHitTestVisible="False" Margin="0 5 0 5" Text="{Binding Name}"></TextBlock>
+ <mahapps:NumericUpDown FontSize="14" Minimum="0" Margin="0 0 5 0" HorizontalContentAlignment="Left" HideUpDownButtons="True" Maximum="10000" StringFormat="0.0" InterceptArrowKeys="True" InterceptMouseWheel="True" HasDecimals="True" Value="{Binding Value,Mode=TwoWay}" Background="#6EFFFFFF"></mahapps:NumericUpDown>
</DockPanel>
</ContentControl>
</Grid>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ThreadMotionElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ThreadMotionElementEditor.xaml
index d59a8ddbb..ac440ad64 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ThreadMotionElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ThreadMotionElementEditor.xaml
@@ -68,7 +68,7 @@
</Viewbox>
<StackPanel HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="0 0 -65 5">
- <Border Background="#1B1B1B" CornerRadius="3" Padding="3">
+ <Border Background="{StaticResource DarkGrayBrush}" CornerRadius="3" Padding="3">
<mahapps:NumericUpDown BorderThickness="0" Background="Transparent" HideUpDownButtons="True" HasDecimals="False" Minimum="0" Maximum="10000" StringFormat="0" Value="{Binding Speed,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged,StringFormat=0,FallbackValue=5000}" HorizontalAlignment="Center" HorizontalContentAlignment="Center" FontSize="22" VerticalAlignment="Center" Foreground="{StaticResource RedBrush400}" FontFamily="{StaticResource digital-7}"></mahapps:NumericUpDown>
</Border>
<visuals:Knob Width="50" Height="50" TicksHighlightBrush="{StaticResource RedBrush400}" KnobType="MetroDark" TicksWidth="2" Margin="0 5 0 0" TicksHeight="5" Minimum="0" Maximum="5000" Value="{Binding Speed,Mode=TwoWay}" />
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ValveElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ValveElementEditor.xaml
index 20e4b46ff..59b9fa2af 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ValveElementEditor.xaml
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/ValveElementEditor.xaml
@@ -46,7 +46,7 @@
<Button Margin="8" Cursor="Hand" Command="{Binding SetCommand}" CommandParameter="{Binding TechValve.State1}">
<Button.Style>
<Style TargetType="Button">
- <Setter Property="Background" Value="#3E3E3E"></Setter>
+ <Setter Property="Background" Value="{StaticResource GrayBrush280}"></Setter>
<Setter Property="IsEnabled" Value="True"></Setter>
</Style>
</Button.Style>
@@ -80,7 +80,7 @@
</Button.Template>
</Button>
- <Border Background="#1B1B1B" Margin="8" CornerRadius="3" Padding="5" Grid.Column="1">
+ <Border Background="{StaticResource DarkGrayBrush}" Margin="8" CornerRadius="3" Padding="5" Grid.Column="1">
<StackPanel>
<TextBlock FontFamily="{StaticResource digital-7}" Text="Valve Controller" FontSize="13" Foreground="#E94A4A" HorizontalAlignment="Center"></TextBlock>
<Image Source="../Images/valve.png" RenderOptions.BitmapScalingMode="Fant" Margin="10" Stretch="Uniform" Height="36" />
@@ -90,7 +90,7 @@
<Button Margin="8" Cursor="Hand" Grid.Column="2" Command="{Binding SetCommand}" CommandParameter="{Binding TechValve.State2}">
<Button.Style>
<Style TargetType="Button">
- <Setter Property="Background" Value="#3E3E3E"></Setter>
+ <Setter Property="Background" Value="{StaticResource GrayBrush280}"></Setter>
<Setter Property="IsEnabled" Value="True"></Setter>
</Style>
</Button.Style>
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs
index 8f5c67f96..f6b8a35df 100644
--- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs
+++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs
@@ -41,7 +41,6 @@ using RealTimeGraphX.WPF;
using Tango.Core.ExtensionMethods;
using System.Diagnostics;
using Tango.BL.Builders;
-using Tango.Core;
namespace Tango.MachineStudio.Technician.ViewModels
{
@@ -80,12 +79,6 @@ namespace Tango.MachineStudio.Technician.ViewModels
private DateTime _last_time = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0);
private Machine _machine;
private List<PackColor> _packsColors;
- private int _diagnostics_index = 0;
- private DateTime _diagnosticsStartTime;
- private DateTime _diagnosticsNowTime;
-
- private ProducerConsumerQueue<StartDiagnosticsResponse> _framesQueue;
- private Thread _populateFramesThread;
#region Properties
@@ -120,8 +113,6 @@ namespace Tango.MachineStudio.Technician.ViewModels
{
_selectedTab.IsSelected = true;
}
-
- EnableRenderingForSelectedTabGraphs();
}
}
@@ -318,8 +309,6 @@ namespace Tango.MachineStudio.Technician.ViewModels
/// <param name="notificationProvider">The notification provider.</param>
public MachineTechViewVM(IStudioApplicationManager applicationManager, INotificationProvider notificationProvider, IDiagnosticsFrameProvider diagnosticsFrameProvider, IEventLogger eventLogger)
{
- _framesQueue = new ProducerConsumerQueue<StartDiagnosticsResponse>();
-
Tabs = new ObservableCollection<MachineTechTabVM>();
Tabs.Add(new MachineTechTabVM() { IsSelected = true, Name = "Untitled" });
SelectedTab = Tabs.First();
@@ -422,7 +411,7 @@ namespace Tango.MachineStudio.Technician.ViewModels
PackColor pc = new PackColor();
pc.Index = pack.PackIndex;
pc.Name = pack.LiquidType.Name;
-
+
if (pack.LiquidType.LiquidTypeColor == Colors.Black)
{
pc.Color = Colors.Gray;
@@ -454,51 +443,25 @@ namespace Tango.MachineStudio.Technician.ViewModels
/// <param name="response">The response.</param>
private void DiagnosticsFrameProvider_FrameReceived(object sender, StartDiagnosticsResponse response)
{
- _framesQueue.BlockEnqueue(response);
+ PopulateDiagnosticsData(response);
}
#endregion
#region Populate Diagnostics Data
- private void PopulateFramesThreadMethod()
- {
- while (!ApplicationManager.IsShuttingDown)
- {
- var frame = _framesQueue.BlockDequeue();
- PopulateDiagnosticsData(frame);
- }
- }
-
/// <summary>
/// Populates the diagnostics data to the proper elements.
/// </summary>
/// <param name="data">The data.</param>
private void PopulateDiagnosticsData(StartDiagnosticsResponse data)
{
- if (data.Monitors == null || _machineOperator == null || _machineOperator.DeviceInformation == null) return;
-
- _diagnostics_index++;
- uint interval = _machineOperator.DeviceInformation.DiagnosticsInterval;
+ if (data.Monitors == null) return;
TimeSpan delta_base = DateTime.Now - _start_time;
TimeSpan delta = (DateTime.Now - _last_time);
- _last_time = DateTime.Now;
-
- if (data.ElapsedMilli > 0)
- {
- _diagnosticsNowTime = DateTime.ParseExact(data.DateTime, "MM/dd/yyyy HH:mm:ss.fff", null); //_diagnosticsNowTime.Add(TimeSpan.FromMilliseconds(data.ElapsedMilli));
- //var now = _diagnosticsStartTime.Add(TimeSpan.FromMilliseconds(interval * _diagnostics_index));
- //Debug.WriteLine("DeltaBase Before: " + delta_base);
- delta_base = _diagnosticsNowTime - _start_time;
- //Debug.WriteLine("DeltaBase After: " + delta_base);
-
- //Debug.WriteLine("Delta Before: " + delta);
- delta = TimeSpan.FromMilliseconds(data.ElapsedMilli);
- //Debug.WriteLine("Delta After: " + delta);
- }
-
double delta_mili = delta.TotalMilliseconds;
+ _last_time = DateTime.Now;
if (DateTime.Now > _lastDiagnosticsResponseUpdate.AddMilliseconds(MIN_DIAGNOSTICS_UPDATE_MILI))
{
@@ -516,11 +479,7 @@ namespace Tango.MachineStudio.Technician.ViewModels
if (prop != null)
{
var points = GetDataArray(techMonitor, prop.GetValue(data.Monitors));
-
- if (points.Count > 0)
- {
- sr.PushData(points, delta_base, delta);
- }
+ sr.PushData(points, delta_base, delta);
}
}
@@ -533,20 +492,15 @@ namespace Tango.MachineStudio.Technician.ViewModels
if (prop != null)
{
var points = GetDataMatrix(techMonitor, prop.GetValue(data.Monitors));
- if (points.Count > 0)
- {
- mr.PushData(points, delta_base, delta);
- }
+ mr.PushData(points, delta_base, delta);
}
}
lock (_elementsLock)
{
var elements = Tabs.SelectMany(x => x.Elements).ToList();
- var selectedTabElements = SelectedTab.Elements.ToList();
- //Can be updated only when visible
- foreach (var item in selectedTabElements.Select(x => x.HostedElement as TechItem))
+ foreach (var item in elements.Select(x => x.HostedElement as TechItem))
{
if (item.GetType() == typeof(MonitorItem))
{
@@ -576,79 +530,7 @@ namespace Tango.MachineStudio.Technician.ViewModels
}
}
}
- else if (item.GetType() == typeof(DigitalOutItem))
- {
- DigitalOutItem digitalOutItem = item as DigitalOutItem;
-
- var digitalPin = data.DigitalInterfaceStates.SingleOrDefault(x => x.InterfaceIO == (InterfaceIOs)digitalOutItem.TechIo.Code);
-
- if (digitalPin != null)
- {
- digitalOutItem.EffectiveValue = digitalPin.Value;
- }
- }
- else if (item.GetType() == typeof(DigitalInItem))
- {
- DigitalInItem digitalInItem = item as DigitalInItem;
-
- var digitalPin = data.DigitalInterfaceStates.SingleOrDefault(x => x.InterfaceIO == (InterfaceIOs)digitalInItem.TechIo.Code);
-
- if (digitalPin != null)
- {
- digitalInItem.Value = digitalPin.Value;
- }
- }
- else if (item.GetType() == typeof(HeaterItem))
- {
- HeaterItem heaterItem = item as HeaterItem;
-
- var heaterState = data.HeatersStates.SingleOrDefault(x => x.HeaterType == (HeaterType)heaterItem.TechHeater.Code);
-
- if (heaterState != null)
- {
- heaterItem.HeaterState = heaterState;
- }
- }
- else if (item.GetType() == typeof(ValveItem))
- {
- ValveItem valveItem = item as ValveItem;
-
- var valveState = data.ValvesStates.SingleOrDefault(x => x.ValveType == (ValveType)valveItem.TechValve.Code);
-
- if (valveState != null)
- {
- valveItem.EffectiveState = valveState.State;
- }
- }
- else if (item.GetType() == typeof(BlowerItem))
- {
- BlowerItem blowerItem = item as BlowerItem;
-
- if (data.Monitors.BlowerVoltage.Count > 0)
- {
- blowerItem.EffectiveActive = data.Monitors.BlowerVoltage.Last() > 0;
- }
- }
- else if (item.GetType() == typeof(ControllerItem))
- {
- ControllerItem controllerItem = item as ControllerItem;
-
- if (DateTime.Now > controllerItem.LastUpdateTime.AddMilliseconds(controllerItem.UpdateInterval))
- {
- var componentState = data.ComponentsStates.SingleOrDefault(x => (int)x.Component == controllerItem.TechController.Code);
-
- if (componentState != null)
- {
- controllerItem.EffectiveValue = componentState.Value;
- }
- }
- }
- }
-
- //Must be updated all the time.
- foreach (var item in elements.Select(x => x.HostedElement as TechItem))
- {
- if (item.GetType() == typeof(SingleGraphItem))
+ else if (item.GetType() == typeof(SingleGraphItem))
{
SingleGraphItem graphItem = item as SingleGraphItem;
@@ -662,23 +544,20 @@ namespace Tango.MachineStudio.Technician.ViewModels
{
var points = GetDataArray(graphItem.TechMonitor, prop.GetValue(data.Monitors));
- if (points.Count > 0)
- {
- List<TimeSpanDataPoint> times = new List<TimeSpanDataPoint>();
- var dPoints = points.Select(x => new DoubleDataPoint(x)).ToList();
+ List<TimeSpanDataPoint> times = new List<TimeSpanDataPoint>();
+ var dPoints = points.Select(x => new DoubleDataPoint(x)).ToList();
- for (int i = 0; i < points.Count; i++)
- {
- times.Add(delta_base.Add(TimeSpan.FromMilliseconds((delta_mili / points.Count) * i)));
- }
+ for (int i = 0; i < points.Count; i++)
+ {
+ times.Add(delta_base.Add(TimeSpan.FromMilliseconds((delta_mili / points.Count) * i)));
+ }
- controller.PushData(times, dPoints);
+ controller.PushData(times, dPoints);
- var _graph_recording = _single_graphs_recordings.SingleOrDefault(x => x.Tag == graphItem);
- if (_graph_recording != null)
- {
- _graph_recording.PushData(points, delta_base, delta);
- }
+ var _graph_recording = _single_graphs_recordings.SingleOrDefault(x => x.Tag == graphItem);
+ if (_graph_recording != null)
+ {
+ _graph_recording.PushData(points, delta_base, delta);
}
}
}
@@ -741,82 +620,70 @@ namespace Tango.MachineStudio.Technician.ViewModels
}
}
}
- }
- }
- }
+ else if (item.GetType() == typeof(DigitalOutItem))
+ {
+ DigitalOutItem digitalOutItem = item as DigitalOutItem;
- #endregion
+ var digitalPin = data.DigitalInterfaceStates.SingleOrDefault(x => x.InterfaceIO == (InterfaceIOs)digitalOutItem.TechIo.Code);
- #region Private Methods
+ if (digitalPin != null)
+ {
+ digitalOutItem.EffectiveValue = digitalPin.Value;
+ }
+ }
+ else if (item.GetType() == typeof(DigitalInItem))
+ {
+ DigitalInItem digitalInItem = item as DigitalInItem;
- private void EnableRenderingForSelectedTabGraphs()
- {
- if (SelectedTab != null)
- {
- lock (_elementsLock)
- {
- var elements = Tabs.SelectMany(x => x.Elements).ToList();
+ var digitalPin = data.DigitalInterfaceStates.SingleOrDefault(x => x.InterfaceIO == (InterfaceIOs)digitalInItem.TechIo.Code);
- foreach (var element in elements)
- {
- if (SelectedTab.Elements.Contains(element))
+ if (digitalPin != null)
{
- var item = element.HostedElement as TechItem;
+ digitalInItem.Value = digitalPin.Value;
+ }
+ }
+ else if (item.GetType() == typeof(HeaterItem))
+ {
+ HeaterItem heaterItem = item as HeaterItem;
- if (item != null)
- {
- if (item.GetType() == typeof(SingleGraphItem))
- {
- SingleGraphItem graphItem = item as SingleGraphItem;
+ var heaterState = data.HeatersStates.SingleOrDefault(x => x.HeaterType == (HeaterType)heaterItem.TechHeater.Code);
- TechGraphController controller = null;
+ if (heaterState != null)
+ {
+ heaterItem.HeaterState = heaterState;
+ }
+ }
+ else if (item.GetType() == typeof(ValveItem))
+ {
+ ValveItem valveItem = item as ValveItem;
- if (_singleControllers.TryGetValue(graphItem, out controller))
- {
- controller.DisableRendering = false;
- }
- }
- else if (item.GetType() == typeof(MultiGraphItem))
- {
- MultiGraphItem graphItem = item as MultiGraphItem;
+ var valveState = data.ValvesStates.SingleOrDefault(x => x.ValveType == (ValveType)valveItem.TechValve.Code);
- TechGraphController controller = null;
+ if (valveState != null)
+ {
+ valveItem.EffectiveState = valveState.State;
+ }
+ }
+ else if (item.GetType() == typeof(BlowerItem))
+ {
+ BlowerItem blowerItem = item as BlowerItem;
- if (_multiControllers.TryGetValue(graphItem, out controller))
- {
- controller.DisableRendering = false;
- }
- }
- }
+ if (data.Monitors.BlowerVoltage.Count > 0)
+ {
+ blowerItem.EffectiveActive = data.Monitors.BlowerVoltage.Last() > 0;
}
- else
+ }
+ else if (item.GetType() == typeof(ControllerItem))
+ {
+ ControllerItem controllerItem = item as ControllerItem;
+
+ if (DateTime.Now > controllerItem.LastUpdateTime.AddMilliseconds(controllerItem.UpdateInterval))
{
- var item = element.HostedElement as TechItem;
+ var componentState = data.ComponentsStates.SingleOrDefault(x => (int)x.Component == controllerItem.TechController.Code);
- if (item != null)
+ if (componentState != null)
{
- if (item.GetType() == typeof(SingleGraphItem))
- {
- SingleGraphItem graphItem = item as SingleGraphItem;
-
- TechGraphController controller = null;
-
- if (_singleControllers.TryGetValue(graphItem, out controller))
- {
- controller.DisableRendering = true;
- }
- }
- else if (item.GetType() == typeof(MultiGraphItem))
- {
- MultiGraphItem graphItem = item as MultiGraphItem;
-
- TechGraphController controller = null;
-
- if (_multiControllers.TryGetValue(graphItem, out controller))
- {
- controller.DisableRendering = true;
- }
- }
+ controllerItem.EffectiveValue = componentState.Value;
}
}
}
@@ -824,6 +691,10 @@ namespace Tango.MachineStudio.Technician.ViewModels
}
}
+ #endregion
+
+ #region Private Methods
+
/// <summary>
/// Gets the last data point from a protobuf repeated field.
/// </summary>
@@ -1380,6 +1251,7 @@ namespace Tango.MachineStudio.Technician.ViewModels
catch (Exception ex)
{
LogManager.Log(ex, String.Format("Error executing technician set valve state command on '{0}'.", item.TechName));
+ _eventLogger.Log(ex, String.Format("Error executing technician set valve state command on '{0}'.", item.TechName));
}
};
}
@@ -1400,6 +1272,7 @@ namespace Tango.MachineStudio.Technician.ViewModels
catch (Exception ex)
{
LogManager.Log(ex, $"Error executing SetBlowerState command for blower {item.HardwareBlower.HardwareBlowerType.Name}.");
+ _eventLogger.Log(ex, $"Error executing SetBlowerState command for blower {item.HardwareBlower.HardwareBlowerType.Name}.");
}
};
}
@@ -1420,6 +1293,7 @@ namespace Tango.MachineStudio.Technician.ViewModels
catch (Exception ex)
{
LogManager.Log(ex, $"Error executing SetHeaterState command for heater {item.TechHeater.Name}.");
+ _eventLogger.Log(ex, $"Error executing SetHeaterState command for heater {item.TechHeater.Name}.");
}
};
}
@@ -1516,6 +1390,7 @@ namespace Tango.MachineStudio.Technician.ViewModels
item.HomingProgress = 0;
item.HomingMaximumProgress = 0;
LogManager.Log(ex, String.Format("Error executing technician command '{0}' on item '{1}'.", action, item.TechName));
+ _eventLogger.Log(ex, String.Format("Error executing technician command '{0}' on item '{1}'.", action, item.TechName));
}
};
}
@@ -1613,6 +1488,7 @@ namespace Tango.MachineStudio.Technician.ViewModels
item.HomingProgress = 0;
item.HomingMaximumProgress = 0;
LogManager.Log(ex, String.Format("Error executing technician command '{0}' on item '{1}'.", action, item.TechName));
+ _eventLogger.Log(ex, String.Format("Error executing technician command '{0}' on item '{1}'.", action, item.TechName));
}
};
}
@@ -1766,6 +1642,7 @@ namespace Tango.MachineStudio.Technician.ViewModels
catch (Exception ex)
{
LogManager.Log(ex, String.Format(String.Format("Error executing technician command '{0}' on item '{1}'.", action, item.TechName)));
+ _eventLogger.Log(ex, String.Format("Error executing technician command '{0}' on item '{1}'.", action, item.TechName));
}
};
}
@@ -1849,6 +1726,7 @@ namespace Tango.MachineStudio.Technician.ViewModels
catch (Exception ex)
{
LogManager.Log(ex, String.Format("Error executing technician command '{0}' on item '{1}'.", action, item.TechName));
+ _eventLogger.Log(ex, String.Format("Error executing technician command '{0}' on item '{1}'.", action, item.TechName));
}
};
}
@@ -1869,6 +1747,7 @@ namespace Tango.MachineStudio.Technician.ViewModels
catch (Exception ex)
{
LogManager.Log(ex, String.Format("Error executing technician set digital out command on '{0}'.", item.TechName));
+ _eventLogger.Log(ex, String.Format("Error executing technician set digital out command on '{0}'.", item.TechName));
}
};
}
@@ -1893,6 +1772,7 @@ namespace Tango.MachineStudio.Technician.ViewModels
catch (Exception ex)
{
LogManager.Log(ex, String.Format("Error executing technician set value component command on '{0}'.", item.TechName));
+ _eventLogger.Log(ex, String.Format("Error executing technician set value component command on '{0}'.", item.TechName));
}
};
}
@@ -1918,6 +1798,7 @@ namespace Tango.MachineStudio.Technician.ViewModels
catch (Exception ex)
{
String msg = "Error uploading process parameters:" + Environment.NewLine + parameters.ToJsonString();
+ _eventLogger.Log(ex, msg);
LogManager.Log(ex, msg);
_notification.ShowError("Could not upload process parameters." + Environment.NewLine + ex.Message);
}
@@ -2216,41 +2097,16 @@ namespace Tango.MachineStudio.Technician.ViewModels
{
var to_remove = Tabs.ToList();
- var name = _notification.ShowTextInput("Enter project name", "Project Name", "untitled");
-
- if (String.IsNullOrWhiteSpace(name))
- {
- return;
- }
-
- SaveFileDialog dlg = new SaveFileDialog();
- dlg.Title = "Select Technician Project Location";
- dlg.Filter = "Technician Project File|*.tpf";
- dlg.DefaultExt = ".tpf";
- dlg.FileName = name;
-
- if (!dlg.ShowDialog().Value)
+ if (AddNewTab())
{
- return;
- }
-
- _singleControllers.Clear();
- _multiControllers.Clear();
- _multi_graph_recordings.Clear();
- _multi_monitors_recordings.Clear();
- _single_graphs_recordings.Clear();
- _single_monitors_recordings.Clear();
+ _singleControllers.Clear();
+ _multiControllers.Clear();
- foreach (var tab in to_remove)
- {
- Tabs.Remove(tab);
+ foreach (var tab in to_remove)
+ {
+ Tabs.Remove(tab);
+ }
}
-
- AddNewTab(name);
-
- _lastTechProjectFile = dlg.FileName;
- File.AppendAllText(_lastTechProjectFile, "");
- SaveProject();
}
/// <summary>
@@ -2323,12 +2179,7 @@ namespace Tango.MachineStudio.Technician.ViewModels
public override void OnApplicationReady()
{
- if (_populateFramesThread == null)
- {
- _populateFramesThread = new Thread(PopulateFramesThreadMethod);
- _populateFramesThread.IsBackground = true;
- _populateFramesThread.Start();
- }
+
}
#endregion