aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2019-04-15 12:06:30 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2019-04-15 12:06:30 +0300
commit3c5f32456c72b26497c05bb35fd64e3c77c6b0f5 (patch)
tree4d6b489f02e147e89c23871011512a51daa478fa /Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls
parent85a6112d2e1eac554cc4cbdfa31cca91d87e6ded (diff)
downloadTango-3c5f32456c72b26497c05bb35fd64e3c77c6b0f5.tar.gz
Tango-3c5f32456c72b26497c05bb35fd64e3c77c6b0f5.zip
Now using the latest RealTimeGraphX library! + infinity check!
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls')
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/IRealTimeGraph.cs35
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml65
-rw-r--r--Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/WpfGraphControl.cs (renamed from Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs)83
3 files changed, 47 insertions, 136 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
deleted file mode 100644
index dcf2cdf81..000000000
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/IRealTimeGraph.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using RealTimeGraphEx;
-using RealTimeGraphEx.Controllers;
-using RealTimeGraphX;
-using RealTimeGraphX.WPF.DataSeries;
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Tango.MachineStudio.Common.Controls
-{
- public interface IRealTimeGraph
- {
- /// <summary>
- /// Gets or sets the name of the sensor.
- /// </summary>
- String DisplayName { get; set; }
-
- /// <summary>
- /// Gets or sets the tag.
- /// </summary>
- Object Tag { get; set; }
-
- /// <summary>
- /// Gets or sets the sensor units.
- /// </summary>
- String DisplayUnits { get; set; }
-
- /// <summary>
- /// Gets or sets the inner graph controller.
- /// </summary>
- 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
deleted file mode 100644
index b5e809a3e..000000000
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml
+++ /dev/null
@@ -1,65 +0,0 @@
-<UserControl x:Class="Tango.MachineStudio.Common.Controls.RealTimeGraphControl"
- 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: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"
- mc:Ignorable="d"
- d:DesignHeight="150" d:DesignWidth="300">
-
- <UserControl.Resources>
- <ResourceDictionary>
- <ResourceDictionary.MergedDictionaries>
- <ResourceDictionary Source="../Resources/MaterialDesign.xaml"></ResourceDictionary>
- </ResourceDictionary.MergedDictionaries>
- </ResourceDictionary>
- </UserControl.Resources>
-
- <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}" 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/WpfGraphControl.cs
index f82196fed..68db76cd5 100644
--- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/RealTimeGraphControl.xaml.cs
+++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.Common/Controls/WpfGraphControl.cs
@@ -1,6 +1,6 @@
-using System;
+using RealTimeGraphX;
+using System;
using System.Collections.Generic;
-using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -10,68 +10,79 @@ 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;
-using RealTimeGraphEx;
-using RealTimeGraphEx.Controllers;
-using RealTimeGraphX;
-using RealTimeGraphX.WPF.DataSeries;
namespace Tango.MachineStudio.Common.Controls
{
- /// <summary>
- /// Interaction logic for RealTimeGraphControl.xaml
- /// </summary>
- public partial class RealTimeGraphControl : UserControl, IRealTimeGraph
+ public class WpfGraphControl : Control
{
- #region Properties
-
- public String DisplayName
+ /// <summary>
+ /// Gets or sets the graph controller.
+ /// </summary>
+ public IGraphController Controller
{
- get { return (String)GetValue(DisplayNameProperty); }
- set { SetValue(DisplayNameProperty, value); }
+ get { return (IGraphController)GetValue(ControllerProperty); }
+ set { SetValue(ControllerProperty, value); }
}
- public static readonly DependencyProperty DisplayNameProperty =
- DependencyProperty.Register("DisplayName", typeof(String), typeof(RealTimeGraphControl), new PropertyMetadata(null));
+ public static readonly DependencyProperty ControllerProperty =
+ DependencyProperty.Register("Controller", typeof(IGraphController), typeof(WpfGraphControl), new PropertyMetadata(null));
- public String DisplayUnits
- {
- get { return (String)GetValue(DisplayUnitsProperty); }
- set { SetValue(DisplayUnitsProperty, value); }
- }
- public static readonly DependencyProperty DisplayUnitsProperty =
- DependencyProperty.Register("DisplayUnits", typeof(String), typeof(RealTimeGraphControl), new PropertyMetadata(null));
+ /// <summary>
+ /// Gets or sets the string format of the y-axis.
+ /// </summary>
public String StringFormat
{
get { return (String)GetValue(StringFormatProperty); }
set { SetValue(StringFormatProperty, value); }
}
public static readonly DependencyProperty StringFormatProperty =
- DependencyProperty.Register("StringFormat", typeof(String), typeof(RealTimeGraphControl), new PropertyMetadata("0.0"));
+ DependencyProperty.Register("StringFormat", typeof(String), typeof(WpfGraphControl), new PropertyMetadata("0.0"));
+ /// <summary>
+ /// Gets or sets the display name.
+ /// </summary>
+ public String DisplayName
+ {
+ get { return (String)GetValue(DisplayNameProperty); }
+ set { SetValue(DisplayNameProperty, value); }
+ }
+ public static readonly DependencyProperty DisplayNameProperty =
+ DependencyProperty.Register("DisplayName", typeof(String), typeof(WpfGraphControl), new PropertyMetadata(null));
+
- public IGraphController<WpfDataSeries> Controller
+ /// <summary>
+ /// Gets or sets the display units.
+ /// </summary>
+ public String DisplayUnits
{
- get { return (IGraphController<WpfDataSeries>)GetValue(ControllerProperty); }
- set { SetValue(ControllerProperty, value); }
+ get { return (String)GetValue(DisplayUnitsProperty); }
+ set { SetValue(DisplayUnitsProperty, value); }
}
- public static readonly DependencyProperty ControllerProperty =
- DependencyProperty.Register("Controller", typeof(IGraphController<WpfDataSeries>), typeof(RealTimeGraphControl), new PropertyMetadata(null,(d,e) => (d as RealTimeGraphControl).OnControllerChanged()));
+ public static readonly DependencyProperty DisplayUnitsProperty =
+ DependencyProperty.Register("DisplayUnits", typeof(String), typeof(WpfGraphControl), new PropertyMetadata(null));
- private void OnControllerChanged()
+ /// <summary>
+ /// Gets or sets the graph label visibility.
+ /// </summary>
+ public Visibility GraphLabelVisibility
{
- Controller.Output.Output.ConnectOutput(Graph);
+ get { return (Visibility)GetValue(GraphLabelVisibilityProperty); }
+ set { SetValue(GraphLabelVisibilityProperty, value); }
}
+ public static readonly DependencyProperty GraphLabelVisibilityProperty =
+ DependencyProperty.Register("GraphLabelVisibility", typeof(Visibility), typeof(WpfGraphControl), new PropertyMetadata(Visibility.Visible));
- #endregion
- public RealTimeGraphControl()
+ /// <summary>
+ /// Initializes the <see cref="WpfGraphControl"/> class.
+ /// </summary>
+ static WpfGraphControl()
{
- InitializeComponent();
+ DefaultStyleKeyProperty.OverrideMetadata(typeof(WpfGraphControl), new FrameworkPropertyMetadata(typeof(WpfGraphControl)));
}
}
}