aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-10-10 16:55:44 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-10-10 16:55:44 +0300
commit79eb19cbd10785a7dbc972bc0b26817932237419 (patch)
treee36176fc94ce6f26efc89b006d7e6faf7e4398cb /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls
parentdf9197240ba5a643ce1599f36b7e3dd34aad6a60 (diff)
downloadTango-79eb19cbd10785a7dbc972bc0b26817932237419.tar.gz
Tango-79eb19cbd10785a7dbc972bc0b26817932237419.zip
Sign-out works !
Fixed issue where color conversion was busy while not in research module but research module in job view. Added new RealTimeGraphX !
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/IRealTimeGraph.cs28
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml105
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs160
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml91
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml.cs174
5 files changed, 71 insertions, 487 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/IRealTimeGraph.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/IRealTimeGraph.cs
index bf40d459e..dcf2cdf81 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/IRealTimeGraph.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/IRealTimeGraph.cs
@@ -1,5 +1,7 @@
using RealTimeGraphEx;
using RealTimeGraphEx.Controllers;
+using RealTimeGraphX;
+using RealTimeGraphX.WPF.DataSeries;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -13,7 +15,7 @@ namespace Tango.MachineStudio.Common.Controls
/// <summary>
/// Gets or sets the name of the sensor.
/// </summary>
- String SensorName { get; set; }
+ String DisplayName { get; set; }
/// <summary>
/// Gets or sets the tag.
@@ -23,31 +25,11 @@ namespace Tango.MachineStudio.Common.Controls
/// <summary>
/// Gets or sets the sensor units.
/// </summary>
- String SensorUnits { get; set; }
-
- /// <summary>
- /// Occurs when the graph remove button has been pressed.
- /// </summary>
- event EventHandler GraphRemoveButtonPressed;
-
- /// <summary>
- /// Occurs when the graph full screen button has been pressed.
- /// </summary>
- event EventHandler GraphFullScreenButtonPressed;
-
- /// <summary>
- /// Gets or sets the inner real-time graph control.
- /// </summary>
- RealTimeGraphExBase InnerGraph { get; set; }
+ String DisplayUnits { get; set; }
/// <summary>
/// Gets or sets the inner graph controller.
/// </summary>
- GraphControllerBase Controller { get; set; }
-
- /// <summary>
- /// Gets or sets a value indicating whether to enable toolbar buttons.
- /// </summary>
- bool EnableToolBar { get; set; }
+ IGraphController<WpfDataSeries> Controller { get; set; }
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml
index bf2e41afa..b5e809a3e 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml
@@ -5,6 +5,8 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:graphEx="clr-namespace:RealTimeGraphEx.FastGraphs;assembly=RealTimeGraphEx"
+ xmlns:graphX="clr-namespace:RealTimeGraphX.WPF.Surfaces;assembly=RealTimeGraphX.WPF"
+ xmlns:componentsX="clr-namespace:RealTimeGraphX.WPF.Components;assembly=RealTimeGraphX.WPF"
xmlns:components="clr-namespace:RealTimeGraphEx.Components;assembly=RealTimeGraphEx"
xmlns:converters="clr-namespace:Tango.MachineStudio.Common.Converters"
xmlns:local="clr-namespace:Tango.MachineStudio.Common.Controls"
@@ -14,73 +16,50 @@
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
- <!--RealTimeGraphEx-->
- <ResourceDictionary Source="pack://application:,,,/RealTimeGraphEx;component/Resources/Resources.xaml"></ResourceDictionary>
<ResourceDictionary Source="../Resources/MaterialDesign.xaml"></ResourceDictionary>
-
- <ResourceDictionary>
- <Style TargetType="ContentControl" x:Key="graphContent">
- <Style.Setters>
- <Setter Property="ContentTemplate">
- <Setter.Value>
- <DataTemplate>
- <Grid MouseEnter="Graph_MouseEnter" MouseLeave="Graph_MouseLeave" ClipToBounds="True">
- <ContentControl Content="{Binding}"></ContentControl>
- <Grid Opacity="0.8" HorizontalAlignment="Stretch" VerticalAlignment="Top" ClipToBounds="True" Height="35" Margin="0 -35 0 0">
- <StackPanel Orientation="Horizontal" Margin="5" HorizontalAlignment="Right" VerticalAlignment="Top">
- <Button Margin="0 0 5 0" Click="OnGraphFullScreen" ToolTip="Full Screen" Width="24" Height="24" BorderBrush="Transparent" Background="{StaticResource AccentColorBrush}" Style="{StaticResource MaterialDesignFloatingActionAccentButton}" >
- <materialDesign:PackIcon Kind="Fullscreen" HorizontalAlignment="Right" Width="20" Height="20" Foreground="{StaticResource WhiteBrush}" />
- </Button>
- <Button Click="OnGraphRemove" ToolTip="Remove" Width="24" Height="24" BorderBrush="Transparent" Background="#FF7777" Style="{StaticResource MaterialDesignFloatingActionAccentButton}" >
- <materialDesign:PackIcon Kind="CloseCircle" HorizontalAlignment="Right" Width="20" Height="20" Foreground="{StaticResource WhiteBrush}" />
- </Button>
- </StackPanel>
- </Grid>
- </Grid>
- </DataTemplate>
- </Setter.Value>
- </Setter>
- </Style.Setters>
- </Style>
- </ResourceDictionary>
- </ResourceDictionary.MergedDictionaries>
+ </ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
- <Grid>
- <!--Temperature-->
- <ContentControl Style="{StaticResource graphContent}" Margin="0 0 0 0" MinHeight="5">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="40"/>
- <ColumnDefinition Width="438*"/>
- </Grid.ColumnDefinitions>
+ <Grid >
+ <Border Background="{DynamicResource graphBackground}" Padding="20" CornerRadius="5" BorderThickness="1" BorderBrush="DodgerBlue">
+ <Grid>
+ <Grid.RowDefinitions>
+ <RowDefinition Height="41*"/>
+ <RowDefinition Height="30"/>
+ </Grid.RowDefinitions>
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="55"/>
+ <ColumnDefinition Width="438*"/>
+ </Grid.ColumnDefinitions>
+
+ <Border BorderBrush="{StaticResource AccentColorBrush}" Margin="0 1 0 2">
+ <componentsX:GraphAxisControl Foreground="DodgerBlue" Orientation="Vertical" FontSize="10" Surface="{Binding ElementName=Graph}" StringFormat="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=StringFormat}" />
+ </Border>
+ <Border Grid.Column="1" BorderThickness="1" BorderBrush="#43A0E7FF" Margin="1 0 0 0">
+ <Grid>
+
+ <componentsX:GraphGridLines Foreground="#9B545454" />
+
+ <graphX:WpfGraphSurface x:Name="Graph" x:FieldModifier="public">
+
+ </graphX:WpfGraphSurface>
+
+ <Grid>
+ <Label Style="{StaticResource graphLabel}">
+ <StackPanel Orientation="Horizontal">
+ <TextBlock Foreground="Gainsboro" FontSize="11" VerticalAlignment="Center" Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DisplayName,FallbackValue='Dispenser Motor'}"></TextBlock>
+ <TextBlock Foreground="Gray" Margin="10 0 0 0" FontSize="11" FontFamily="Sylfaen Regular" VerticalAlignment="Center" Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DisplayUnits,FallbackValue='(hz)'}"></TextBlock>
+ </StackPanel>
+ </Label>
+ </Grid>
+ </Grid>
+ </Border>
- <Border BorderBrush="{StaticResource AccentColorBrush}" BorderThickness="1 1 0 1" Background="#E1151515">
- <StackPanel Orientation="Horizontal">
- <components:YAxisScroll x:Name="yAxis" Interval="6" Graph="{Binding ElementName=Graph}" Width="35" Foreground="Gainsboro" VerticalOffset="-5" FontSize="8" StringFormat="#0.0"></components:YAxisScroll>
- <components:YAxisTicks x:Name="yAxisTicks" SmallTickTemplate="{StaticResource graphTicksTemplate}" Width="5" SmallTicks="6" Foreground="{StaticResource MaterialDesignLightForeground}" BigTicks="10" Graph="{Binding ElementName=Graph}"></components:YAxisTicks>
- </StackPanel>
- </Border>
- <Border Grid.Column="1" BorderThickness="1" BorderBrush="{StaticResource borderBrush}" Background="{DynamicResource graphBackground}" Margin="1 0 0 0">
- <graphEx:RealTimeGraphExLineScroll x:Name="Graph" x:FieldModifier="public" UseAutoRange="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=UseAutoRange}" Controller="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Controller}" Antialiased="True" RefreshRate="30" FillGraph="False" Stroke="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Color}" Minimum="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Minimum,Mode=TwoWay}" Maximum="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Maximum,Mode=TwoWay}">
- <graphEx:RealTimeGraphExLineScroll.Components>
- <components:MouseValueToolTip ToolTipTemplate="{StaticResource graphTooltipTemplate}" />
- <components:GridLines Rows="6" Columns="6" GridBrush="{DynamicResource graphGridLinesBrush}"></components:GridLines>
- </graphEx:RealTimeGraphExLineScroll.Components>
- <graphEx:RealTimeGraphExLineScroll.InnerContent>
- <Grid>
- <Label Style="{StaticResource graphLabel}">
- <StackPanel Orientation="Horizontal">
- <TextBlock Foreground="Gainsboro" FontSize="11" VerticalAlignment="Center" Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl,AncestorLevel=2},Path=SensorName,FallbackValue='Dispenser Motor'}"></TextBlock>
- <TextBlock Foreground="Gray" Margin="10 0 0 0" FontSize="11" FontFamily="Sylfaen Regular" VerticalAlignment="Center" Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl,AncestorLevel=2},Path=SensorUnits,FallbackValue='(hz)'}"></TextBlock>
- </StackPanel>
- </Label>
- </Grid>
- </graphEx:RealTimeGraphExLineScroll.InnerContent>
- </graphEx:RealTimeGraphExLineScroll>
- </Border>
- </Grid>
- </ContentControl>
+ <Border BorderBrush="{StaticResource AccentColorBrush}" Grid.Row="1" Grid.Column="1" Margin="3 0 2 0">
+ <componentsX:GraphAxisControl Foreground="DodgerBlue" Orientation="Horizontal" FontSize="10" Surface="{Binding ElementName=Graph}" StringFormat="hh\:mm\:ss" />
+ </Border>
+ </Grid>
+ </Border>
</Grid>
</UserControl>
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs
index 2341c21c1..f82196fed 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs
@@ -16,6 +16,8 @@ using System.Windows.Navigation;
using System.Windows.Shapes;
using RealTimeGraphEx;
using RealTimeGraphEx.Controllers;
+using RealTimeGraphX;
+using RealTimeGraphX.WPF.DataSeries;
namespace Tango.MachineStudio.Common.Controls
{
@@ -24,166 +26,52 @@ namespace Tango.MachineStudio.Common.Controls
/// </summary>
public partial class RealTimeGraphControl : UserControl, IRealTimeGraph
{
- private Grid headerGrid;
-
#region Properties
- /// <summary>
- /// Gets or sets the name of the sensor.
- /// </summary>
- public String SensorName
- {
- get { return (String)GetValue(SensorNameProperty); }
- set { SetValue(SensorNameProperty, value); }
- }
- public static readonly DependencyProperty SensorNameProperty =
- DependencyProperty.Register("SensorName", typeof(String), typeof(RealTimeGraphControl), new PropertyMetadata(null));
-
- /// <summary>
- /// Gets or sets the sensor units.
- /// </summary>
- public String SensorUnits
- {
- get { return (String)GetValue(SensorUnitsProperty); }
- set { SetValue(SensorUnitsProperty, value); }
- }
- public static readonly DependencyProperty SensorUnitsProperty =
- DependencyProperty.Register("SensorUnits", typeof(String), typeof(RealTimeGraphControl), new PropertyMetadata(null));
-
-
-
- public double Minimum
+ public String DisplayName
{
- get { return (double)GetValue(MinimumProperty); }
- set { SetValue(MinimumProperty, value); }
+ get { return (String)GetValue(DisplayNameProperty); }
+ set { SetValue(DisplayNameProperty, value); }
}
- public static readonly DependencyProperty MinimumProperty =
- DependencyProperty.Register("Minimum", typeof(double), typeof(RealTimeGraphControl), new PropertyMetadata(0.0));
-
+ public static readonly DependencyProperty DisplayNameProperty =
+ DependencyProperty.Register("DisplayName", typeof(String), typeof(RealTimeGraphControl), new PropertyMetadata(null));
-
- public double Maximum
+ public String DisplayUnits
{
- get { return (double)GetValue(MaximumProperty); }
- set { SetValue(MaximumProperty, value); }
+ get { return (String)GetValue(DisplayUnitsProperty); }
+ set { SetValue(DisplayUnitsProperty, value); }
}
- public static readonly DependencyProperty MaximumProperty =
- DependencyProperty.Register("Maximum", typeof(double), typeof(RealTimeGraphControl), new PropertyMetadata(100.0));
-
-
+ public static readonly DependencyProperty DisplayUnitsProperty =
+ DependencyProperty.Register("DisplayUnits", typeof(String), typeof(RealTimeGraphControl), new PropertyMetadata(null));
- public Color Color
+ public String StringFormat
{
- get { return (Color)GetValue(ColorProperty); }
- set { SetValue(ColorProperty, value); }
+ get { return (String)GetValue(StringFormatProperty); }
+ set { SetValue(StringFormatProperty, value); }
}
- public static readonly DependencyProperty ColorProperty =
- DependencyProperty.Register("Color", typeof(Color), typeof(RealTimeGraphControl), new PropertyMetadata(Colors.DodgerBlue));
+ public static readonly DependencyProperty StringFormatProperty =
+ DependencyProperty.Register("StringFormat", typeof(String), typeof(RealTimeGraphControl), new PropertyMetadata("0.0"));
- public bool UseAutoRange
+ public IGraphController<WpfDataSeries> Controller
{
- get { return (bool)GetValue(UseAutoRangeProperty); }
- set { SetValue(UseAutoRangeProperty, value); }
+ get { return (IGraphController<WpfDataSeries>)GetValue(ControllerProperty); }
+ set { SetValue(ControllerProperty, value); }
}
- public static readonly DependencyProperty UseAutoRangeProperty =
- DependencyProperty.Register("UseAutoRange", typeof(bool), typeof(RealTimeGraphControl), new PropertyMetadata(false));
-
-
+ public static readonly DependencyProperty ControllerProperty =
+ DependencyProperty.Register("Controller", typeof(IGraphController<WpfDataSeries>), typeof(RealTimeGraphControl), new PropertyMetadata(null,(d,e) => (d as RealTimeGraphControl).OnControllerChanged()));
- public void InvalidateGraph()
+ private void OnControllerChanged()
{
- InnerGraph.Clear();
- yAxis.Render(InnerGraph);
- yAxisTicks.Render(InnerGraph);
+ Controller.Output.Output.ConnectOutput(Graph);
}
- /// <summary>
- /// Gets or sets the inner real-time graph control.
- /// </summary>
- public RealTimeGraphExBase InnerGraph { get; set; }
-
- /// <summary>
- /// Gets or sets the inner graph controller.
- /// </summary>
- public GraphControllerBase Controller { get; set; }
-
-
- private bool _enableToolbar;
- /// <summary>
- /// Gets or sets a value indicating whether to enable toolbar buttons.
- /// </summary>
- public bool EnableToolBar
- {
- get { return _enableToolbar; }
- set
- {
- _enableToolbar = value;
-
- if (!value)
- {
- if (headerGrid != null)
- {
- ThicknessAnimation ani = new ThicknessAnimation();
- ani.To = new Thickness(0, -35, 0, 0);
- ani.Duration = TimeSpan.FromSeconds(0.2);
- headerGrid.BeginAnimation(Grid.MarginProperty, ani);
- }
- }
- }
- }
-
-
- #endregion
-
- #region Events
-
- public event EventHandler GraphRemoveButtonPressed;
- public event EventHandler GraphFullScreenButtonPressed;
-
#endregion
public RealTimeGraphControl()
{
InitializeComponent();
- EnableToolBar = true;
- InnerGraph = Graph;
- Controller = new GraphController();
}
-
- private void OnGraphFullScreen(object sender, RoutedEventArgs e)
- {
- GraphFullScreenButtonPressed?.Invoke(this, new EventArgs());
- }
-
- private void Graph_MouseEnter(object sender, MouseEventArgs e)
- {
- if (EnableToolBar)
- {
- Grid mainGrid = sender as Grid;
- headerGrid = mainGrid.Children.OfType<Grid>().ToList().First();
- ThicknessAnimation ani = new ThicknessAnimation();
- ani.To = new Thickness(0, 0, 0, 0);
- ani.Duration = TimeSpan.FromSeconds(0.2);
- headerGrid.BeginAnimation(Grid.MarginProperty, ani);
- }
- }
-
- private void Graph_MouseLeave(object sender, MouseEventArgs e)
- {
- Grid mainGrid = sender as Grid;
- headerGrid = mainGrid.Children.OfType<Grid>().ToList().First();
- ThicknessAnimation ani = new ThicknessAnimation();
- ani.To = new Thickness(0, -35, 0, 0);
- ani.Duration = TimeSpan.FromSeconds(0.2);
- headerGrid.BeginAnimation(Grid.MarginProperty, ani);
- }
-
- private void OnGraphRemove(object sender, RoutedEventArgs e)
- {
- GraphRemoveButtonPressed?.Invoke(this, new EventArgs());
- }
-
}
}
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml
deleted file mode 100644
index 4976739e4..000000000
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml
+++ /dev/null
@@ -1,91 +0,0 @@
-<UserControl x:Class="Tango.MachineStudio.Common.Controls.RealTimeGraphMultiControl"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- 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:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
- xmlns:graphEx="clr-namespace:RealTimeGraphEx.FastGraphs;assembly=RealTimeGraphEx"
- xmlns:components="clr-namespace:RealTimeGraphEx.Components;assembly=RealTimeGraphEx"
- xmlns:converters="clr-namespace:Tango.MachineStudio.Common.Converters"
- xmlns:local="clr-namespace:Tango.MachineStudio.Common.Controls"
- mc:Ignorable="d"
- d:DesignHeight="150" d:DesignWidth="300">
-
- <UserControl.Resources>
- <ResourceDictionary>
- <ResourceDictionary.MergedDictionaries>
- <!--RealTimeGraphEx-->
- <ResourceDictionary Source="pack://application:,,,/RealTimeGraphEx;component/Resources/Resources.xaml"></ResourceDictionary>
- <ResourceDictionary Source="../Resources/MaterialDesign.xaml"></ResourceDictionary>
-
- <ResourceDictionary>
- <Style TargetType="ContentControl" x:Key="graphContent">
- <Style.Setters>
- <Setter Property="ContentTemplate">
- <Setter.Value>
- <DataTemplate>
- <Grid MouseEnter="Graph_MouseEnter" MouseLeave="Graph_MouseLeave" ClipToBounds="True">
- <ContentControl Content="{Binding}"></ContentControl>
- <Grid Opacity="0.8" HorizontalAlignment="Stretch" VerticalAlignment="Top" ClipToBounds="True" Height="35" Margin="0 -35 0 0">
- <StackPanel Orientation="Horizontal" Margin="5" HorizontalAlignment="Right" VerticalAlignment="Top">
- <Button Margin="0 0 5 0" Click="OnGraphFullScreen" ToolTip="Full Screen" Width="24" Height="24" BorderBrush="Transparent" Background="{StaticResource AccentColorBrush}" Style="{StaticResource MaterialDesignFloatingActionAccentButton}" >
- <materialDesign:PackIcon Kind="Fullscreen" HorizontalAlignment="Right" Width="20" Height="20" Foreground="{StaticResource WhiteBrush}" />
- </Button>
- <Button Click="OnGraphRemove" ToolTip="Remove" Width="24" Height="24" BorderBrush="Transparent" Background="#FF7777" Style="{StaticResource MaterialDesignFloatingActionAccentButton}" >
- <materialDesign:PackIcon Kind="CloseCircle" HorizontalAlignment="Right" Width="20" Height="20" Foreground="{StaticResource WhiteBrush}" />
- </Button>
- </StackPanel>
- </Grid>
- </Grid>
- </DataTemplate>
- </Setter.Value>
- </Setter>
- </Style.Setters>
- </Style>
- </ResourceDictionary>
- </ResourceDictionary.MergedDictionaries>
- </ResourceDictionary>
- </UserControl.Resources>
-
- <Grid>
- <!--Temperature-->
- <ContentControl Style="{StaticResource graphContent}" Margin="0 0 0 0" MinHeight="5">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="40"/>
- <ColumnDefinition Width="438*"/>
- </Grid.ColumnDefinitions>
-
- <Border BorderBrush="{StaticResource AccentColorBrush}" BorderThickness="1 1 0 1" Background="#E1151515">
- <StackPanel Orientation="Horizontal">
- <components:YAxisScroll x:Name="yAxis" Interval="6" Graph="{Binding ElementName=Graph}" Width="35" Foreground="Gainsboro" VerticalOffset="-5" FontSize="8" StringFormat="#0.0"></components:YAxisScroll>
- <components:YAxisTicks x:Name="yAxisTicks" SmallTickTemplate="{StaticResource graphTicksTemplate}" Width="5" SmallTicks="6" Foreground="{StaticResource MaterialDesignLightForeground}" BigTicks="10" Graph="{Binding ElementName=Graph}"></components:YAxisTicks>
- </StackPanel>
- </Border>
- <Border Grid.Column="1" BorderThickness="1" BorderBrush="{StaticResource borderBrush}" Background="{DynamicResource graphBackground}" Margin="1 0 0 0">
- <graphEx:RealTimeGraphExMultiLineScroll x:Name="Graph" x:FieldModifier="public" UseAutoRange="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=UseAutoRange}" Controller="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Controller}" Antialiased="True" RefreshRate="30" FillGraph="False" Minimum="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Minimum,Mode=TwoWay}" Maximum="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=Maximum,Mode=TwoWay}" Stroke="DodgerBlue">
- <graphEx:RealTimeGraphExMultiLineScroll.Components>
- <components:MouseValueToolTip ToolTipTemplate="{StaticResource graphTooltipTemplate}" />
- <components:GridLines Rows="6" Columns="6" GridBrush="{DynamicResource graphGridLinesBrush}"></components:GridLines>
- </graphEx:RealTimeGraphExMultiLineScroll.Components>
- <graphEx:RealTimeGraphExMultiLineScroll.InnerContent>
- <Grid>
- <Label Style="{StaticResource graphLabel}">
- <StackPanel Orientation="Horizontal">
- <TextBlock VerticalAlignment="Center" FontSize="11" Foreground="Gainsboro" Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl,AncestorLevel=2},Path=SensorName,FallbackValue='Dispensers Motors'}"></TextBlock>
- <TextBlock Foreground="Gray" Margin="10 0 0 0" FontSize="11" FontFamily="Sylfaen Regular" VerticalAlignment="Center" Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl,AncestorLevel=2},Path=SensorUnits,FallbackValue='(hz)'}"></TextBlock>
- </StackPanel>
- </Label>
- </Grid>
- </graphEx:RealTimeGraphExMultiLineScroll.InnerContent>
- </graphEx:RealTimeGraphExMultiLineScroll>
- </Border>
-
- <Border Grid.Column="2" Margin="5 0 0 0" HorizontalAlignment="Right" Opacity="0.8">
- <components:YAxisLegends VerticalAlignment="Center" Margin="0 0 5 0" Graph="{Binding ElementName=Graph}" Width="70" FlowDirection="RightToLeft" LegendTemplate="{StaticResource graphLegendTemplate}">
- </components:YAxisLegends>
- </Border>
- </Grid>
- </ContentControl>
- </Grid>
-</UserControl>
diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml.cs
deleted file mode 100644
index 21054d94e..000000000
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphMultiControl.xaml.cs
+++ /dev/null
@@ -1,174 +0,0 @@
-using RealTimeGraphEx;
-using RealTimeGraphEx.Controllers;
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-using System.Windows.Controls;
-using System.Windows.Data;
-using System.Windows.Documents;
-using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Animation;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
-
-namespace Tango.MachineStudio.Common.Controls
-{
- /// <summary>
- /// Interaction logic for RealTimeGraphControl.xaml
- /// </summary>
- public partial class RealTimeGraphMultiControl : UserControl , IRealTimeGraph
- {
- private Grid headerGrid;
-
- #region Properties
-
- /// <summary>
- /// Gets or sets the name of the sensor.
- /// </summary>
- public String SensorName
- {
- get { return (String)GetValue(SensorNameProperty); }
- set { SetValue(SensorNameProperty, value); }
- }
- public static readonly DependencyProperty SensorNameProperty =
- DependencyProperty.Register("SensorName", typeof(String), typeof(RealTimeGraphMultiControl), new PropertyMetadata(null));
-
- /// <summary>
- /// Gets or sets the sensor units.
- /// </summary>
- public String SensorUnits
- {
- get { return (String)GetValue(SensorUnitsProperty); }
- set { SetValue(SensorUnitsProperty, value); }
- }
- public static readonly DependencyProperty SensorUnitsProperty =
- DependencyProperty.Register("SensorUnits", typeof(String), typeof(RealTimeGraphMultiControl), new PropertyMetadata(null));
-
- public double Minimum
- {
- get { return (double)GetValue(MinimumProperty); }
- set { SetValue(MinimumProperty, value); }
- }
- public static readonly DependencyProperty MinimumProperty =
- DependencyProperty.Register("Minimum", typeof(double), typeof(RealTimeGraphMultiControl), new PropertyMetadata(0.0));
-
-
-
- public double Maximum
- {
- get { return (double)GetValue(MaximumProperty); }
- set { SetValue(MaximumProperty, value); }
- }
- public static readonly DependencyProperty MaximumProperty =
- DependencyProperty.Register("Maximum", typeof(double), typeof(RealTimeGraphMultiControl), new PropertyMetadata(100.0));
-
-
-
- public bool UseAutoRange
- {
- get { return (bool)GetValue(UseAutoRangeProperty); }
- set { SetValue(UseAutoRangeProperty, value); }
- }
- public static readonly DependencyProperty UseAutoRangeProperty =
- DependencyProperty.Register("UseAutoRange", typeof(bool), typeof(RealTimeGraphMultiControl), new PropertyMetadata(false));
-
-
-
- public void InvalidateGraph()
- {
- InnerGraph.Clear();
- yAxis.Render(InnerGraph);
- yAxisTicks.Render(InnerGraph);
- }
-
- /// <summary>
- /// Gets or sets the inner real-time graph control.
- /// </summary>
- public RealTimeGraphExBase InnerGraph { get; set; }
-
- /// <summary>
- /// Gets or sets the inner graph controller.
- /// </summary>
- public GraphControllerBase Controller { get; set; }
-
- private bool _enableToolbar;
- /// <summary>
- /// Gets or sets a value indicating whether to enable toolbar buttons.
- /// </summary>
- public bool EnableToolBar
- {
- get { return _enableToolbar; }
- set
- {
- _enableToolbar = value;
-
- if (!value)
- {
- if (headerGrid != null)
- {
- ThicknessAnimation ani = new ThicknessAnimation();
- ani.To = new Thickness(0, -35, 0, 0);
- ani.Duration = TimeSpan.FromSeconds(0.2);
- headerGrid.BeginAnimation(Grid.MarginProperty, ani);
- }
- }
- }
- }
-
- #endregion
-
- #region Events
-
- public event EventHandler GraphRemoveButtonPressed;
- public event EventHandler GraphFullScreenButtonPressed;
-
- #endregion
-
- public RealTimeGraphMultiControl()
- {
- InitializeComponent();
- EnableToolBar = true;
- InnerGraph = Graph;
- Controller = new GraphMultiController();
- }
-
- private void OnGraphFullScreen(object sender, RoutedEventArgs e)
- {
- GraphFullScreenButtonPressed?.Invoke(this, new EventArgs());
- }
-
- private void Graph_MouseEnter(object sender, MouseEventArgs e)
- {
- if (EnableToolBar)
- {
- Grid mainGrid = sender as Grid;
- headerGrid = mainGrid.Children.OfType<Grid>().ToList().First();
- ThicknessAnimation ani = new ThicknessAnimation();
- ani.To = new Thickness(0, 0, 0, 0);
- ani.Duration = TimeSpan.FromSeconds(0.2);
- headerGrid.BeginAnimation(Grid.MarginProperty, ani);
- }
- }
-
- private void Graph_MouseLeave(object sender, MouseEventArgs e)
- {
- Grid mainGrid = sender as Grid;
- headerGrid = mainGrid.Children.OfType<Grid>().ToList().First();
- ThicknessAnimation ani = new ThicknessAnimation();
- ani.To = new Thickness(0, -35, 0, 0);
- ani.Duration = TimeSpan.FromSeconds(0.2);
- headerGrid.BeginAnimation(Grid.MarginProperty, ani);
- }
-
- private void OnGraphRemove(object sender, RoutedEventArgs e)
- {
- GraphRemoveButtonPressed?.Invoke(this, new EventArgs());
- }
- }
-}