diff options
| author | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2023-06-20 16:40:58 +0300 |
|---|---|---|
| committer | Victoria Plitt <Victoria.Plitt@twine-s.com> | 2023-06-20 16:40:58 +0300 |
| commit | a5de87ea9863c6e7053e09ed1c2eabf58285af48 (patch) | |
| tree | f39ec628a4857a1e3e103cc47c91bbadaa67bcd2 /Software | |
| parent | a495866908071d2204c8eab85dc0163308c5e53e (diff) | |
| download | Tango-a5de87ea9863c6e7053e09ed1c2eabf58285af48.tar.gz Tango-a5de87ea9863c6e7053e09ed1c2eabf58285af48.zip | |
PPC. Added Real Time Graph
Diffstat (limited to 'Software')
19 files changed, 589 insertions, 8 deletions
diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml index bdcf675e3..38a5b91b2 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/App.xaml @@ -20,6 +20,7 @@ <ResourceDictionary Source="Resources/Colors.xaml"></ResourceDictionary> <ResourceDictionary Source="Resources/Fonts.xaml"></ResourceDictionary> <ResourceDictionary Source="Resources/Styles.xaml"></ResourceDictionary> + <ResourceDictionary Source="Resources/Graphs.xaml" /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/StatisticTabToVisibilityConverter.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/StatisticTabToVisibilityConverter.cs new file mode 100644 index 000000000..06c75a999 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Converters/StatisticTabToVisibilityConverter.cs @@ -0,0 +1,28 @@ +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 static Tango.PPC.UI.ViewModels.MachineStatusViewVM; + +namespace Tango.PPC.UI.Converters +{ + public class StatisticTabToVisibilityConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + { + StatisticTab selected = (StatisticTab)Enum.Parse(typeof(StatisticTab), parameter.ToString()); + StatisticTab statTab = (StatisticTab)value; + + return statTab.Equals(selected) ? Visibility.Visible : Visibility.Hidden; + } + + public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) + { + throw new NotImplementedException(); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Graphs/GraphHelper.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Graphs/GraphHelper.cs new file mode 100644 index 000000000..d06ed042a --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Graphs/GraphHelper.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Windows; +using System.Windows.Media; + +namespace Tango.PPC.UI.Graphs +{ + public static class GraphHelper + { + public enum GraphColor + { + White, + Red, + Yellow, + Green, + Orange + } + + public static Color GetGraphColor(GraphColor graphColor) + { + return (Color)Application.Current.Resources[$"Tango_RealTimeGraph_{graphColor.ToString()}"]; + } + + public static Brush GetGraphBrush(GraphColor graphColor) + { + return new SolidColorBrush(GetGraphColor(graphColor)); + } + + public static Color GetGraphStrokeColor() + { + return (Color)Application.Current.Resources["Tango_RealTimeGraph_ForegroundColor"]; + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Graphs/RealTimeGraph.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Graphs/RealTimeGraph.cs new file mode 100644 index 000000000..303b18892 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Graphs/RealTimeGraph.cs @@ -0,0 +1,149 @@ +using RealTimeGraphX; +using System; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Media; + +namespace Tango.PPC.UI.Graphs +{ + public class RealTimeGraph : Control + { + /// <summary> + /// Gets or sets the graph controller. + /// </summary> + public IGraphController Controller + { + get { return (IGraphController)GetValue(ControllerProperty); } + set { SetValue(ControllerProperty, value); } + } + public static readonly DependencyProperty ControllerProperty = + DependencyProperty.Register("Controller", typeof(IGraphController), typeof(RealTimeGraph), 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(RealTimeGraph), 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(RealTimeGraph), new PropertyMetadata(null)); + + + /// <summary> + /// Gets or sets the display units. + /// </summary> + public String DisplayUnits + { + get { return (String)GetValue(DisplayUnitsProperty); } + set { SetValue(DisplayUnitsProperty, value); } + } + public static readonly DependencyProperty DisplayUnitsProperty = + DependencyProperty.Register("DisplayUnits", typeof(String), typeof(RealTimeGraph), new PropertyMetadata(null)); + + /// <summary> + /// Gets or sets the graph label visibility. + /// </summary> + public Visibility GraphLabelVisibility + { + get { return (Visibility)GetValue(GraphLabelVisibilityProperty); } + set { SetValue(GraphLabelVisibilityProperty, value); } + } + public static readonly DependencyProperty GraphLabelVisibilityProperty = + DependencyProperty.Register("GraphLabelVisibility", typeof(Visibility), typeof(RealTimeGraph), new PropertyMetadata(Visibility.Visible)); + + + /// <summary> + /// Gets or sets the vertical ticks. + /// </summary> + public int VerticalTicks + { + get { return (int)GetValue(VerticalTicksProperty); } + set { SetValue(VerticalTicksProperty, value); } + } + public static readonly DependencyProperty VerticalTicksProperty = + DependencyProperty.Register("VerticalTicks", typeof(int), typeof(RealTimeGraph), new PropertyMetadata(10)); + + + /// <summary> + /// Gets or sets the horizontal ticks. + /// </summary> + public int HorizontalTicks + { + get { return (int)GetValue(HorizontalTicksProperty); } + set { SetValue(HorizontalTicksProperty, value); } + } + public static readonly DependencyProperty HorizontalTicksProperty = + DependencyProperty.Register("HorizontalTicks", typeof(int), typeof(RealTimeGraph), new PropertyMetadata(10)); + + public Brush GridLinesBrush + { + get { return (Brush)GetValue(GridLinesBrushProperty); } + set { SetValue(GridLinesBrushProperty, value); } + } + public static readonly DependencyProperty GridLinesBrushProperty = + DependencyProperty.Register("GridLinesBrush", typeof(Brush), typeof(RealTimeGraph), new PropertyMetadata(null)); + + public Visibility HorizontalAxisVisibility + { + get { return (Visibility)GetValue(HorizontalAxisVisibilityProperty); } + set { SetValue(HorizontalAxisVisibilityProperty, value); } + } + public static readonly DependencyProperty HorizontalAxisVisibilityProperty = + DependencyProperty.Register("HorizontalAxisVisibility", typeof(Visibility), typeof(RealTimeGraph), new PropertyMetadata(Visibility.Visible)); + + public Visibility VerticalAxisVisibility + { + get { return (Visibility)GetValue(VerticalAxisVisibilityProperty); } + set { SetValue(VerticalAxisVisibilityProperty, value); } + } + public static readonly DependencyProperty VerticalAxisVisibilityProperty = + DependencyProperty.Register("VerticalAxisVisibility", typeof(Visibility), typeof(RealTimeGraph), new PropertyMetadata(Visibility.Visible)); + + public Visibility CurrentValueVisibility + { + get { return (Visibility)GetValue(CurrentValueVisibilityProperty); } + set { SetValue(CurrentValueVisibilityProperty, value); } + } + public static readonly DependencyProperty CurrentValueVisibilityProperty = + DependencyProperty.Register("CurrentValueVisibility", typeof(Visibility), typeof(RealTimeGraph), new PropertyMetadata(Visibility.Collapsed)); + + public double CurrentValueFontSize + { + get { return (double)GetValue(CurrentValueFontSizeProperty); } + set { SetValue(CurrentValueFontSizeProperty, value); } + } + public static readonly DependencyProperty CurrentValueFontSizeProperty = + DependencyProperty.Register("CurrentValueFontSize", typeof(double), typeof(RealTimeGraph), new PropertyMetadata(25.0)); + + public Thickness CurrentValueMargin + { + get { return (Thickness)GetValue(CurrentValueMarginProperty); } + set { SetValue(CurrentValueMarginProperty, value); } + } + public static readonly DependencyProperty CurrentValueMarginProperty = + DependencyProperty.Register("CurrentValueMargin", typeof(Thickness), typeof(RealTimeGraph), new PropertyMetadata(new Thickness(20))); + + /// <summary> + /// Initializes the <see cref="RealTimeGraph"/> class. + /// </summary> + static RealTimeGraph() + { + DefaultStyleKeyProperty.OverrideMetadata(typeof(RealTimeGraph), new FrameworkPropertyMetadata(typeof(RealTimeGraph))); + } + } +} diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Graphs/RealTimeGraph.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Graphs/RealTimeGraph.xaml new file mode 100644 index 000000000..8844f9627 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Graphs/RealTimeGraph.xaml @@ -0,0 +1,106 @@ +<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:realTimeGraphX="clr-namespace:RealTimeGraphX.WPF;assembly=RealTimeGraphX.WPF" + xmlns:local="clr-namespace:Tango.PPC.UI.Graphs"> + + <BitmapImage x:Key="PPC_Screw" UriSource="../Images/screw.png" /> + + <Style TargetType="{x:Type local:RealTimeGraph}"> + <Setter Property="BorderThickness" Value="1"></Setter> + <Setter Property="BorderBrush" Value="{StaticResource Tango_RealTimeGraph_OuterBorderBrush}"></Setter> + <Setter Property="Padding" Value="20 20 30 20"></Setter> + <Setter Property="FontSize" Value="11"></Setter> + <Setter Property="Foreground" Value="{StaticResource Tango_RealTimeGraph_ForegroundBrush}"></Setter> + <Setter Property="Background" Value="{StaticResource Tango_RealTimeGraph_BackgroundBrush}"></Setter> + <Setter Property="GridLinesBrush" Value="{StaticResource Tango_RealTimeGraph_GridLinesBrush}"></Setter> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type local:RealTimeGraph}"> + <Grid> + <Border Background="{TemplateBinding Background}" + BorderBrush="{TemplateBinding BorderBrush}" + BorderThickness="{TemplateBinding BorderThickness}" + CornerRadius="5" + Padding="{TemplateBinding Padding}"> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="1*"/> + <RowDefinition Height="Auto"/> + </Grid.RowDefinitions> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto"/> + <ColumnDefinition Width="1*"/> + </Grid.ColumnDefinitions> + + <Grid Grid.Column="1"> + <realTimeGraphX:WpfGraphGridLines Controller="{TemplateBinding Controller}" Foreground="{TemplateBinding GridLinesBrush}" /> + <realTimeGraphX:WpfGraphSurface x:Name="surface" Controller="{TemplateBinding Controller}" BorderThickness="1 0 0 1" BorderBrush="{StaticResource Tango_RealTimeGraph_InnerBorderBrush}" /> + </Grid> + + <realTimeGraphX:WpfGraphAxisControl Width="70" Visibility="{TemplateBinding VerticalAxisVisibility}" Orientation="Vertical" Controller="{TemplateBinding Controller}" StringFormat="{TemplateBinding StringFormat}" Ticks="{TemplateBinding VerticalTicks}" /> + <realTimeGraphX:WpfGraphAxisControl Height="35" Visibility="{TemplateBinding HorizontalAxisVisibility}" Orientation="Horizontal" Controller="{TemplateBinding Controller}" Grid.Column="1" Grid.Row="1" Ticks="{TemplateBinding HorizontalTicks}" StringFormat="hh\:mm\:ss"/> + </Grid> + </Border> + <Image HorizontalAlignment="Left" VerticalAlignment="Top" Margin="8" Source="{StaticResource PPC_Screw}" RenderOptions.BitmapScalingMode="Fant" Width="10" Height="10" /> + <Image HorizontalAlignment="Right" VerticalAlignment="Top" Margin="8" Source="{StaticResource PPC_Screw}" RenderOptions.BitmapScalingMode="Fant" Width="10" Height="10" /> + + <Image HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="8" Source="{StaticResource PPC_Screw}" RenderOptions.BitmapScalingMode="Fant" Width="10" Height="10" /> + <Image HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="8" Source="{StaticResource PPC_Screw}" RenderOptions.BitmapScalingMode="Fant" Width="10" Height="10" /> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + + <Style TargetType="{x:Type local:RealTimeGraph}" x:Key="PPC_RealTimeGraph_Flat"> + <Setter Property="BorderThickness" Value="1"></Setter> + <Setter Property="BorderBrush" Value="{StaticResource Tango_RealTimeGraph_OuterBorderBrush}"></Setter> + <Setter Property="Padding" Value="0"></Setter> + <Setter Property="FontSize" Value="11"></Setter> + <Setter Property="Foreground" Value="{StaticResource Tango_RealTimeGraph_ForegroundBrush}"></Setter> + <Setter Property="Background" Value="Transparent"></Setter> + <Setter Property="GridLinesBrush" Value="{StaticResource Tango_RealTimeGraph_GridLinesBrush}"></Setter> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="{x:Type local:RealTimeGraph}"> + <Grid> + <Border Background="{TemplateBinding Background}" + BorderBrush="{TemplateBinding BorderBrush}" + BorderThickness="{TemplateBinding BorderThickness}" + Padding="{TemplateBinding Padding}"> + <Grid> + <Grid.RowDefinitions> + <RowDefinition Height="1*"/> + <RowDefinition Height="Auto"/> + </Grid.RowDefinitions> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="Auto"/> + <ColumnDefinition Width="1*"/> + </Grid.ColumnDefinitions> + + <Grid Grid.Column="1" ClipToBounds="True"> + <realTimeGraphX:WpfGraphGridLines Controller="{TemplateBinding Controller}" Foreground="{TemplateBinding GridLinesBrush}" Rows="5" Columns="0"/> + <realTimeGraphX:WpfGraphSurface Margin="-2 0 0 0" x:Name="surface" Controller="{TemplateBinding Controller}" BorderThickness="0 0 0 0" BorderBrush="{StaticResource Tango_RealTimeGraph_InnerBorderBrush}" /> + </Grid> + + <realTimeGraphX:WpfGraphAxisControl Width="30" Visibility="{TemplateBinding VerticalAxisVisibility}" Orientation="Vertical" Controller="{TemplateBinding Controller}" StringFormat="{TemplateBinding StringFormat}" Ticks="{TemplateBinding VerticalTicks}" /> + <realTimeGraphX:WpfGraphAxisControl Height="38" Visibility="{TemplateBinding HorizontalAxisVisibility}" Orientation="Horizontal" Controller="{TemplateBinding Controller}" Grid.Column="1" Grid.Row="1" Ticks="{TemplateBinding HorizontalTicks}" StringFormat="hh\:mm"/> + </Grid> + </Border> + + <Viewbox IsHitTestVisible="False" Stretch="Uniform" Margin="{TemplateBinding CurrentValueMargin}" Visibility="{TemplateBinding CurrentValueVisibility}"> + <Grid Width="200" Height="200"> + <!--<Ellipse Stroke="#38FFFFFF" StrokeThickness="20" />--> + + <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> + <TextBlock Opacity="0.8" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="SemiBold" FontSize="{TemplateBinding CurrentValueFontSize}" Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent},Path=Controller.DataSeriesCollection[0].CurrentValue}"></TextBlock> + </StackPanel> + </Grid> + </Viewbox> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + +</ResourceDictionary>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/motor.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/motor.png Binary files differnew file mode 100644 index 000000000..8401a8e30 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/motor.png diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/pr_data.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/pr_data.png Binary files differnew file mode 100644 index 000000000..ebd02a99b --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/pr_data.png diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/pressure.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/pressure.png Binary files differnew file mode 100644 index 000000000..12ade5d92 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/pressure.png diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/temperature.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/temperature.png Binary files differnew file mode 100644 index 000000000..de9b042c4 --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/Overview Icons/temperature.png diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/screw.png b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/screw.png Binary files differnew file mode 100644 index 000000000..46a8134fe --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Images/screw.png diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Resources/Graphs.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Resources/Graphs.xaml new file mode 100644 index 000000000..67047cf1f --- /dev/null +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Resources/Graphs.xaml @@ -0,0 +1,8 @@ +<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:local="clr-namespace:Tango.PPC.UI.Resources"> + <ResourceDictionary.MergedDictionaries> + <ResourceDictionary Source="pack://application:,,,/Tango.PPC.UI;component/Graphs/RealTimeGraph.xaml" /> + </ResourceDictionary.MergedDictionaries> + +</ResourceDictionary>
\ No newline at end of file diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj index a3ec9667f..e2d447be5 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Tango.PPC.UI.csproj @@ -176,6 +176,7 @@ <Compile Include="Converters\ProgressLengthSpoolConverter.cs" /> <Compile Include="Converters\ProgressUnitSpoolConverter.cs" /> <Compile Include="Converters\ProgressWeightSpoolConverter.cs" /> + <Compile Include="Converters\StatisticTabToVisibilityConverter.cs" /> <Compile Include="Dialogs\BitResultsView.xaml.cs"> <DependentUpon>BitResultsView.xaml</DependentUpon> </Compile> @@ -236,6 +237,8 @@ </Compile> <Compile Include="Dialogs\FirmwareUpgradeFromFileViewVM.cs" /> <Compile Include="Dialogs\UpdateFromFileViewVM.cs" /> + <Compile Include="Graphs\GraphHelper.cs" /> + <Compile Include="Graphs\RealTimeGraph.cs" /> <Compile Include="Helpers\DpiHelper.cs" /> <Compile Include="InternalModule.cs" /> <Compile Include="Models\MachineOverviewErrorStates.cs" /> @@ -409,6 +412,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Graphs\RealTimeGraph.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="MainWindow.xaml"> <Generator>MSBuild:Compile</Generator> <SubType>Designer</SubType> @@ -433,6 +440,10 @@ <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> </Page> + <Page Include="Resources\Graphs.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Resources\Styles.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -627,6 +638,11 @@ <Resource Include="Images\Overview Icons\Feeder4.png" /> <Resource Include="Manifests\eureka_debug.xml" /> <Resource Include="Images\Overview Icons\JericanRemoved.png" /> + <Resource Include="Images\Overview Icons\motor.png" /> + <Resource Include="Images\Overview Icons\pressure.png" /> + <Resource Include="Images\Overview Icons\pr_data.png" /> + <Resource Include="Images\Overview Icons\temperature.png" /> + <Resource Include="Images\screw.png" /> <Content Include="Intro.wmv" /> <Content Include="Manifests\release.xml" /> <Content Include="Manifests\debug.xml" /> @@ -648,6 +664,14 @@ <None Include="App.config" /> </ItemGroup> <ItemGroup> + <ProjectReference Include="..\..\SideChains\RealTimeGraphX-master\RealTimeGraphX.WPF\RealTimeGraphX.WPF.csproj"> + <Project>{6b9774f7-960d-438e-ad81-c6b9be328d50}</Project> + <Name>RealTimeGraphX.WPF</Name> + </ProjectReference> + <ProjectReference Include="..\..\SideChains\RealTimeGraphX-master\RealTimeGraphX\RealTimeGraphX.csproj"> + <Project>{f13a489c-80ee-4cd0-bdd4-92d959215646}</Project> + <Name>RealTimeGraphX</Name> + </ProjectReference> <ProjectReference Include="..\..\Tango.AnimatedGif\Tango.AnimatedGif.csproj"> <Project>{d129789c-3096-4d0b-8dd7-fe24a4df4b21}</Project> <Name>Tango.AnimatedGif</Name> @@ -964,7 +988,7 @@ if $(ConfigurationName) == Eureka copy /Y "$(ProjectDir)Intro.wmv" "$(TargetDir) </PropertyGroup> <ProjectExtensions> <VisualStudio> - <UserProperties BuildVersion_StartDate="2000/1/1" BuildVersion_UseGlobalSettings="False" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" /> + <UserProperties BuildVersion_AssemblyInfoFilename="Properties\AssemblyInfo.cs" BuildVersion_UpdateAssemblyVersion="True" BuildVersion_BuildVersioningStyle="None.None.Increment.TimeStamp" BuildVersion_UseGlobalSettings="False" BuildVersion_StartDate="2000/1/1" /> </VisualStudio> </ProjectExtensions> <Import Project="..\..\packages\WPFMediaKit.2.2.0\build\WPFMediaKit.targets" Condition="Exists('..\..\packages\WPFMediaKit.2.2.0\build\WPFMediaKit.targets')" /> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs index 2563cb331..103084e11 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/ViewModels/MachineStatusViewVM.cs @@ -20,11 +20,27 @@ using System.Timers; using System.Windows.Threading; using System.Diagnostics; using Tango.PMR.Printing; +using System.ComponentModel; +using RealTimeGraphX.WPF; +using RealTimeGraphX.DataPoints; +using Tango.PPC.UI.Graphs; namespace Tango.PPC.UI.ViewModels { public class MachineStatusViewVM : PPCViewModel { + public enum StatisticTab + { + [Description("Production Data")] + Productiondata = 0, + [Description("Temperature")] + Temperature = 1, + [Description("Pressure")] + Pressure = 2, + [Description("Motor")] + Motor = 3 + } + #region Properties [TangoInject] @@ -227,6 +243,70 @@ namespace Tango.PPC.UI.ViewModels RaisePropertyChangedAuto();} } + private int _selectedStatisticTabIndex; + /// <summary> + /// Gets or sets the index of the selected category. + /// </summary> + public int SelectedStatisticTabIndex + { + get { return _selectedStatisticTabIndex; } + set + { + if (_selectedStatisticTabIndex != value) + { + _selectedStatisticTabIndex = value; + RaisePropertyChangedAuto(); + switch (_selectedStatisticTabIndex) + { + case 0: + { + SelectedStatisticTab = StatisticTab.Productiondata; + break; + } + case 1: + { + SelectedStatisticTab = StatisticTab.Temperature; + break; + } + case 2: + { + SelectedStatisticTab = StatisticTab.Pressure; + break; + } + case 3: + { + SelectedStatisticTab = StatisticTab.Motor; + break; + } + } + } + } + } + + private StatisticTab _selectedStatisticTab; + /// <summary> + /// Gets or sets the selected category. + /// </summary> + /// + public StatisticTab SelectedStatisticTab + { + get + { + return _selectedStatisticTab; + } + set + { + if (_selectedStatisticTab != value) + { + _selectedStatisticTab = value; + RaisePropertyChangedAuto(); + } + _selectedStatisticTabIndex = _selectedStatisticTab.ToInt32(); + RaisePropertyChanged(nameof(SelectedStatisticTabIndex)); + } + } + + public WpfGraphController<DateTimeDataPoint, DoubleDataPoint> JobController { get; set; } #endregion @@ -278,6 +358,9 @@ namespace Tango.PPC.UI.ViewModels MachineErrorStates = new MachineOverviewErrorStates(); IsExpandedNotifications = false; + SelectedStatisticTabIndex = 0; + + JobController = CreateController(CreateSeries("Total", GraphHelper.GraphColor.Green)); } public override void OnApplicationReady() @@ -613,6 +696,35 @@ namespace Tango.PPC.UI.ViewModels } } + private WpfGraphController<DateTimeDataPoint, DoubleDataPoint> CreateController(params WpfGraphDataSeries[] seriesCollection) + { + var controller = new WpfGraphController<DateTimeDataPoint, DoubleDataPoint>(); + + foreach (var series in seriesCollection) + { + controller.DataSeriesCollection.Add(series); + } + + controller.Range.AutoY = true; + controller.Range.MaximumY = 100; + controller.Range.MinimumY = 0; + controller.Range.MaximumX = new DateTime(0).AddMinutes(30); + + controller.RefreshRate = TimeSpan.FromMilliseconds(300000);//5 min + + return controller; + } + + private WpfGraphDataSeries CreateSeries(String name, GraphHelper.GraphColor fill) + { + WpfGraphDataSeries series = new WpfGraphDataSeries(); + series.Name = name; + series.Fill = GraphHelper.GetGraphBrush(fill); + series.StrokeThickness = 1; + series.Stroke = GraphHelper.GetGraphStrokeColor(); + return series; + } + #endregion } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml index 1445337ad..9e766fffc 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml @@ -12,6 +12,7 @@ xmlns:localConverters="clr-namespace:Tango.PPC.UI.Converters" xmlns:global="clr-namespace:Tango.PPC.UI" xmlns:models="clr-namespace:Tango.PPC.UI.Models" + xmlns:graphs="clr-namespace:Tango.PPC.UI.Graphs" xmlns:local="clr-namespace:Tango.PPC.UI.Views" mc:Ignorable="d" d:DesignHeight="1280" d:DesignWidth="932" d:DataContext="{d:DesignInstance Type=vm:MachineStatusViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MachineStatusViewVM}"> @@ -25,6 +26,7 @@ <localConverters:LiquidTypeToBrushConverter x:Key="LiquidTypeToBrushConverter"/> <localConverters:MidTankLevelToElementRectConverter x:Key="MidTankLevelToElementRectConverter"/> <localConverters:ProgressUnitSpoolConverter x:Key="ProgressUnitSpoolConverter"/> + <localConverters:StatisticTabToVisibilityConverter x:Key="StatisticTabToVisibilityConverter"/> <Style x:Key="LinkRoundButtonStyle" TargetType="{x:Type touch:TouchButton}"> <Setter Property="Background" Value="{StaticResource TangoMidAccentBrush}"></Setter> @@ -346,6 +348,10 @@ </Border> </DataTemplate> + <Style x:Key="DynamicResolutionGraph" TargetType="graphs:RealTimeGraph" BasedOn="{StaticResource {x:Type graphs:RealTimeGraph}}"> + <Setter Property="VerticalTicks" Value="5"></Setter> + </Style> + </UserControl.Resources> <Grid Width="998" Height="1123"> <Grid > @@ -1203,6 +1209,64 @@ </StackPanel> <Border VerticalAlignment="Bottom" Height="2" Background="{StaticResource TangoLightBorderBrush}" Margin="0 0 0 0" CornerRadius="2"></Border> </Grid> + <Grid Grid.Row="3" x:Name="StatRealGraph" Margin="0 8 0 0"> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="186"></ColumnDefinition> + <ColumnDefinition Width="32"></ColumnDefinition> + <ColumnDefinition Width="1*"></ColumnDefinition> + </Grid.ColumnDefinitions> + + <touch:TouchNavigationLinks BorderBrush="{StaticResource TangoDividerBrush}" BorderThickness="0 0 0 0" x:Name="navigationSTLinks" HorizontalContentAlignment="Left" + SelectedIndex="{Binding SelectedStatisticTabIndex,Mode=TwoWay}" VerticalAlignment="Bottom" Margin="0,10,0,20" Padding="0 0 0 0" + FontSize="{StaticResource TangoNavigationLinksFontSize}" LineThickness="0" PreviewTouchDown="NavigationSTLinks_PreviewTouchDown" PreviewMouseDown="NavigationSTLinks_PreviewMouseDown"> + + <DockPanel HorizontalAlignment="Stretch"> + <Image DockPanel.Dock="Left" Source="../Images/Overview Icons/pr_data.png" Stretch="UniformToFill" VerticalAlignment="Top" HorizontalAlignment="Left" Width="32" Height="32"/> + <TextBlock HorizontalAlignment="Left" Margin="12 0 0 0" FontSize="{StaticResource TangoDefaultFontSize}" VerticalAlignment="Center">Production Data</TextBlock> + </DockPanel> + <DockPanel HorizontalAlignment="Stretch" IsEnabled="False" Margin="0 12 0 0"> + <Image DockPanel.Dock="Left" Source="../Images/Overview Icons/temperature.png" Stretch="UniformToFill" VerticalAlignment="Top" HorizontalAlignment="Left" Width="32" Height="32"/> + <TextBlock HorizontalAlignment="Left" Margin="12 0 0 0" FontSize="{StaticResource TangoDefaultFontSize}" VerticalAlignment="Center" Foreground="{StaticResource TangoDisabledForegroundBrush}">Temperature</TextBlock> + </DockPanel> + <DockPanel HorizontalAlignment="Stretch" IsEnabled="False"> + <Image DockPanel.Dock="Left" Source="../Images/Overview Icons/pressure.png" Stretch="UniformToFill" VerticalAlignment="Top" HorizontalAlignment="Left" Width="32" Height="32"/> + <TextBlock HorizontalAlignment="Left" Margin="12 0 0 0" FontSize="{StaticResource TangoDefaultFontSize}" VerticalAlignment="Center" Foreground="{StaticResource TangoDisabledForegroundBrush}">Pressure</TextBlock> + </DockPanel> + <DockPanel HorizontalAlignment="Stretch" IsEnabled="False" > + <Image DockPanel.Dock="Left" Source="../Images/Overview Icons/motor.png" Stretch="UniformToFill" VerticalAlignment="Top" HorizontalAlignment="Left" Width="32" Height="32"/> + <TextBlock HorizontalAlignment="Left" Margin="12 0 0 0" FontSize="{StaticResource TangoDefaultFontSize}" VerticalAlignment="Center" Foreground="{StaticResource TangoDisabledForegroundBrush}">Motor</TextBlock> + </DockPanel> + <touch:TouchNavigationLinks.Style> + <Style TargetType="{x:Type touch:TouchNavigationLinks}"> + <Setter Property="ItemsPanel"> + <Setter.Value> + <ItemsPanelTemplate> + <UniformGrid Rows="4" /> + </ItemsPanelTemplate> + </Setter.Value> + </Setter> + </Style> + </touch:TouchNavigationLinks.Style> + + </touch:TouchNavigationLinks> + <Grid Grid.Column="1" Margin="0 40 0 0"> + <Rectangle Width="20" Height="2" Fill="{StaticResource TangoBlackInkBrush}" VerticalAlignment="Top" Margin="0 0 0 0" ></Rectangle> + <!--<Rectangle Width="2" Height="138" Margin="20 0 0 0" Fill="{StaticResource TangoBlackInkBrush}" VerticalAlignment="Top" ></Rectangle>--> + <Rectangle Margin="20 0 0 0" VerticalAlignment="Top" Fill="{StaticResource TangoBlackInkBrush}" Height="2" Width="138" HorizontalAlignment="Stretch"> + <Rectangle.LayoutTransform> + <TransformGroup> + <RotateTransform Angle="90"/> + </TransformGroup> + </Rectangle.LayoutTransform> + </Rectangle> + </Grid> + <Grid Grid.Column="2" x:Name="StatGrid" Margin="0,0,0.4,0"> + <Grid Visibility="{Binding SelectedStatisticTab,Converter={StaticResource StatisticTabToVisibilityConverter},ConverterParameter='Productiondata'}"> + <graphs:RealTimeGraph Style="{StaticResource PPC_RealTimeGraph_Flat}" Controller="{Binding JobController}" Background="Transparent" StringFormat="0" GridLinesBrush="red" BorderBrush="Transparent" + VerticalAxisVisibility="Visible" HorizontalAxisVisibility="Visible" VerticalTicks =" 5"/> + </Grid> + </Grid> + </Grid> </Grid> </Grid> </Grid> diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml.cs b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml.cs index 2ee98bc2b..e49e062b7 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml.cs +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/Views/MachineStatusView.xaml.cs @@ -57,5 +57,15 @@ namespace Tango.PPC.UI.Views { _timer.Stop(); } + + private void NavigationSTLinks_PreviewTouchDown(object sender, TouchEventArgs e) + { + e.Handled = true; + } + + private void NavigationSTLinks_PreviewMouseDown(object sender, MouseButtonEventArgs e) + { + e.Handled = true; + } } } diff --git a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest index d72e75011..efc5f8179 100644 --- a/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest +++ b/Software/Visual_Studio/PPC/Tango.PPC.UI/app.manifest @@ -16,7 +16,7 @@ Remove this element if your application requires this virtualization for backwards compatibility. --> - <requestedExecutionLevel level="requireAdministrator" uiAccess="false" /> + <!--<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />--> </requestedPrivileges> </security> </trustInfo> diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNavigationLinks.cs b/Software/Visual_Studio/Tango.Touch/Controls/TouchNavigationLinks.cs index 3a0d3de9e..5fb4496e0 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNavigationLinks.cs +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNavigationLinks.cs @@ -24,7 +24,18 @@ namespace Tango.Touch.Controls private const string PART_Rectangle = "PART_Rectangle"; private Line _line; private Object _lastSelectedItem; + + public int LineThickness + { + get { return (int)GetValue(LineThicknessProperty); } + set { SetValue(LineThicknessProperty, value); } + } + + // Using a DependencyProperty as the backing store for LineThickness. This enables animation, styling, binding, etc... + public static readonly DependencyProperty LineThicknessProperty = + DependencyProperty.Register("LineThickness", typeof(int), typeof(TouchNavigationLinks), new PropertyMetadata(3)); + static TouchNavigationLinks() { DefaultStyleKeyProperty.OverrideMetadata(typeof(TouchNavigationLinks), new FrameworkPropertyMetadata(typeof(TouchNavigationLinks))); @@ -48,12 +59,14 @@ namespace Tango.Touch.Controls private void MoveLineToSelectedItem() { - if (SelectedItem != null) + if (SelectedItem != null ) { + if(SelectedItem is UIElement && ((UIElement)SelectedItem).IsEnabled == false) + return; var container = ItemContainerGenerator.ContainerFromItem(SelectedItem) as FrameworkElement; - + ContentPresenter presenter = container.FindChild<ContentPresenter>().FindChild<ContentPresenter>(); - + if (presenter != null) { Point relativePoint = presenter.TransformToAncestor(this).Transform(new Point(0, 0)); @@ -87,8 +100,9 @@ namespace Tango.Touch.Controls _line.BeginAnimation(Line.X2Property, aniX2); } } + _lastSelectedItem = SelectedItem; } - + _lastSelectedItem = SelectedItem; } } diff --git a/Software/Visual_Studio/Tango.Touch/Controls/TouchNavigationLinks.xaml b/Software/Visual_Studio/Tango.Touch/Controls/TouchNavigationLinks.xaml index 599dfdf7c..2b8b4ff03 100644 --- a/Software/Visual_Studio/Tango.Touch/Controls/TouchNavigationLinks.xaml +++ b/Software/Visual_Studio/Tango.Touch/Controls/TouchNavigationLinks.xaml @@ -37,10 +37,11 @@ <Setter Property="BorderThickness" Value="1"/> <Setter Property="MinHeight" Value="40"></Setter> <Setter Property="FocusVisualStyle" Value="{x:Null}"/> + <Setter Property="IsEnabled" Value="true"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ListBoxItem}"> - <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true"> + <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true" IsEnabled="{TemplateBinding IsEnabled}"> <components:Ripple CornerRadius="5" RippleBrush="{StaticResource TangoRippleDarkBrush}"> <StackPanel Orientation="Horizontal"> <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> @@ -77,7 +78,7 @@ <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true"> <StackPanel> <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="Stretch"/> - <Line x:Name="PART_Rectangle" X1="0" X2="0" Y1="0" Y2="0" Margin="0 5 0 -3" Stroke="{StaticResource TangoPrimaryAccentBrush}" StrokeThickness="3" HorizontalAlignment="Stretch"></Line> + <Line x:Name="PART_Rectangle" X1="0" X2="0" Y1="0" Y2="0" Margin="0 5 0 -3" Stroke="{StaticResource TangoPrimaryAccentBrush}" StrokeThickness="{Binding RelativeSource={RelativeSource AncestorType=local:TouchNavigationLinks},Path=LineThickness}" HorizontalAlignment="Stretch"></Line> </StackPanel> </Border> </ControlTemplate> diff --git a/Software/Visual_Studio/Tango.Touch/Resources/Colors.xaml b/Software/Visual_Studio/Tango.Touch/Resources/Colors.xaml index 283e69b45..1dc2090aa 100644 --- a/Software/Visual_Studio/Tango.Touch/Resources/Colors.xaml +++ b/Software/Visual_Studio/Tango.Touch/Resources/Colors.xaml @@ -60,6 +60,17 @@ <Color x:Key="TangoPanelMaskColorLight">#55FFFFFF</Color> <Color x:Key="TangoMenuPanelDarkColor">#000131</Color> + <Color x:Key="Tango_RealTimeGraph_White">#18FFFFFF</Color> + <Color x:Key="Tango_RealTimeGraph_Red">#B6FF6F6F</Color> + <Color x:Key="Tango_RealTimeGraph_Yellow">#BBFFB84B</Color> + <Color x:Key="Tango_RealTimeGraph_Green">#B958C13B</Color> + <Color x:Key="Tango_RealTimeGraph_Orange">#BBFA9252</Color> + + <Color x:Key="Tango_RealTimeGraph_ForegroundColor">#7C98B3</Color> + <Color x:Key="Tango_RealTimeGraph_OuterBorderColor">#202020</Color> + <Color x:Key="Tango_RealTimeGraph_InnerBorderColor">#505050</Color> + <Color x:Key="Tango_RealTimeGraph_GridLinesColor">#303030</Color> + <!--Brushes--> <SolidColorBrush x:Key="TangoPrimaryBackgroundBrush" Color="{StaticResource TangoPrimaryBackgroundColor}"></SolidColorBrush> <SolidColorBrush x:Key="TangoMidBackgroundBrush" Color="{StaticResource TangoMidBackgroundColor}"></SolidColorBrush> @@ -128,4 +139,21 @@ <SolidColorBrush x:Key="TangoPowerMenuOpenedBackgroundBrush" Color="{StaticResource TangoPowerMenuOpenedBackgroundColor}"></SolidColorBrush> <SolidColorBrush x:Key="TangoMenuPanelDarkBrush" Color="{StaticResource TangoMenuPanelDarkColor}"></SolidColorBrush> + + <SolidColorBrush x:Key="Tango_RealTimeGraph_ForegroundBrush" Color="{StaticResource Tango_RealTimeGraph_ForegroundColor}" /> + <SolidColorBrush x:Key="Tango_RealTimeGraph_OuterBorderBrush" Color="{StaticResource Tango_RealTimeGraph_OuterBorderColor}" /> + <SolidColorBrush x:Key="Tango_RealTimeGraph_InnerBorderBrush" Color="{StaticResource Tango_RealTimeGraph_InnerBorderColor}" /> + <SolidColorBrush x:Key="Tango_RealTimeGraph_GridLinesBrush" Color="{StaticResource Tango_RealTimeGraph_GridLinesColor}" /> + + <LinearGradientBrush x:Key="Tango_RealTimeGraph_BackgroundBrush" EndPoint="0.5,1" StartPoint="0.5,0" > + <GradientStop Color="#202020"/> + <GradientStop Color="#FF333333" Offset="1"/> + </LinearGradientBrush> + + <SolidColorBrush x:Key="Tango_RealTimeGraph_WhiteBrush" Color="{StaticResource Tango_RealTimeGraph_White}"></SolidColorBrush> + <SolidColorBrush x:Key="Tango_RealTimeGraph_RedBrush" Color="{StaticResource Tango_RealTimeGraph_Red}"></SolidColorBrush> + <SolidColorBrush x:Key="Tango_RealTimeGraph_YellowBrush" Color="{StaticResource Tango_RealTimeGraph_Yellow}"></SolidColorBrush> + <SolidColorBrush x:Key="Tango_RealTimeGraph_GreenBrush" Color="{StaticResource Tango_RealTimeGraph_Green}"></SolidColorBrush> + <SolidColorBrush x:Key="Tango_RealTimeGraph_OrangeBrush" Color="{StaticResource Tango_RealTimeGraph_Orange}"></SolidColorBrush> + </ResourceDictionary>
\ No newline at end of file |
