diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-01-16 12:17:10 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-01-16 12:17:10 +0200 |
| commit | 0fda2ba3ff49bdc1ffc6833f658e2164af187008 (patch) | |
| tree | 6f3a24d0671ebda50debb8511ab40e0bda0a0df0 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views | |
| parent | 28103646681686bf1b58275d5dbccb92d2b26f9f (diff) | |
| download | Tango-0fda2ba3ff49bdc1ffc6833f658e2164af187008.tar.gz Tango-0fda2ba3ff49bdc1ffc6833f658e2164af187008.zip | |
Embedded RealTimeGraphEx library to solution.
Added graphs to technician view.
Implemented simple sensors data test using Machine Emulator.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views')
8 files changed, 366 insertions, 1 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MainView.xaml index 1337358e1..6b84881fd 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MainView.xaml @@ -5,10 +5,98 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:global="clr-namespace:Tango.MachineStudio.Technician" xmlns:vm="clr-namespace:Tango.MachineStudio.Technician.ViewModels" + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" + xmlns:sharedUI="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:local="clr-namespace:Tango.MachineStudio.Technician.Views" + xmlns:converters="clr-namespace:Tango.MachineStudio.Technician.Converters" mc:Ignorable="d" d:DesignHeight="720" d:DesignWidth="1280" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}" Background="White"> + + <UserControl.Resources> + <ResourceDictionary> + <ResourceDictionary.MergedDictionaries> + <ResourceDictionary Source="../Resources/GraphEx.xaml"></ResourceDictionary> + <ResourceDictionary> + <converters:TransitionLinkConverter x:Key="linkConverter"></converters:TransitionLinkConverter> + </ResourceDictionary> + </ResourceDictionary.MergedDictionaries> + </ResourceDictionary> + </UserControl.Resources> + + <Grid> - <TextBlock>Technician</TextBlock> + <Grid.RowDefinitions> + <RowDefinition Height="50"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + + <Grid Background="#F1F1F1"> + <Grid.Resources> + <Style TargetType="Border" x:Key="glowBorder"> + <Setter Property="Height" Value="2"></Setter> + <Setter Property="Margin" Value="0 0 0 -15"></Setter> + <Setter Property="HorizontalAlignment" Value="Stretch"></Setter> + <Setter Property="Background" Value="{StaticResource AccentColorBrush3}"></Setter> + <Setter Property="CornerRadius" Value="3"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=Button},Path=FontWeight}" Value="Normal"> + <DataTrigger.EnterActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation To="0" Duration="00:00:1" Storyboard.TargetProperty="Opacity"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.EnterActions> + <DataTrigger.ExitActions> + <BeginStoryboard> + <Storyboard> + <DoubleAnimation To="1" Duration="00:00:0.2" Storyboard.TargetProperty="Opacity"></DoubleAnimation> + </Storyboard> + </BeginStoryboard> + </DataTrigger.ExitActions> + </DataTrigger> + </Style.Triggers> + </Style> + </Grid.Resources> + <StackPanel Orientation="Horizontal" Margin="10 0 0 0"> + <Button Width="110" Style="{StaticResource LinkButton}" FontSize="{StaticResource LargeFontSize}" FontWeight="{Binding ElementName=TransitionControl,Path=SelectedControl,Converter={StaticResource linkConverter}, ConverterParameter='Overview'}" VerticalAlignment="Center" Command="{Binding NavigateToViewCommand}" CommandParameter="Overview"> + <StackPanel Orientation="Vertical"> + <TextBlock Text="OVERVIEW"></TextBlock> + <Border Style="{StaticResource glowBorder}"> + </Border> + </StackPanel> + </Button> + <Button IsEnabled="{Binding IsResultsAvailable}" Width="100" Style="{StaticResource LinkButton}" Margin="20 0 0 0" FontSize="{StaticResource LargeFontSize}" VerticalAlignment="Center" FontWeight="{Binding ElementName=TransitionControl,Path=SelectedControl,Converter={StaticResource linkConverter}, ConverterParameter='Motors'}" Command="{Binding NavigateToViewCommand}" CommandParameter="Motors"> + <StackPanel Orientation="Vertical"> + <TextBlock Text="MOTORS"></TextBlock> + <Border Style="{StaticResource glowBorder}"> + </Border> + </StackPanel> + </Button> + <Grid Visibility="{Binding IsDebugViewEnabled,Converter={StaticResource BooleanToVisibilityConverter}}"> + <Button Visibility="{Binding IsDebugViewAttached,Converter={StaticResource BooleanToVisibilityConverter}}" Width="150" Style="{StaticResource LinkButton}" Margin="20 0 0 0" FontSize="{StaticResource LargeFontSize}" VerticalAlignment="Center" FontWeight="{Binding ElementName=TransitionControl,Path=SelectedControl,Converter={StaticResource linkConverter}, ConverterParameter='Sensors'}" Command="{Binding NavigateToViewCommand}" CommandParameter="Sensors"> + <StackPanel Orientation="Vertical"> + <TextBlock Text="SENSORS"></TextBlock> + <Border Style="{StaticResource glowBorder}" > + </Border> + </StackPanel> + </Button> + </Grid> + </StackPanel> + </Grid> + + <sharedUI:MultiTransitionControl Grid.Row="1" x:Name="TransitionControl" x:FieldModifier="public" AlwaysFade="True" TransitionType="Slide" Grid.RowSpan="2"> + <sharedUI:MultiTransitionControl.Controls> + <ContentControl Tag="Overview"> + <local:OverviewView></local:OverviewView> + </ContentControl> + <ContentControl Tag="Motors"> + <local:MotorsView></local:MotorsView> + </ContentControl> + <ContentControl Tag="Sensors"> + <local:SensorsView></local:SensorsView> + </ContentControl> + </sharedUI:MultiTransitionControl.Controls> + </sharedUI:MultiTransitionControl> </Grid> </UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MainView.xaml.cs index 0701fbc50..b07fc597e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MainView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MainView.xaml.cs @@ -20,9 +20,12 @@ namespace Tango.MachineStudio.Technician.Views /// </summary> public partial class MainView : UserControl { + public static MainView Instance { get; set; } + public MainView() { InitializeComponent(); + Instance = this; } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MotorsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MotorsView.xaml new file mode 100644 index 000000000..3fb49d457 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MotorsView.xaml @@ -0,0 +1,12 @@ +<UserControl x:Class="Tango.MachineStudio.Technician.Views.MotorsView" + 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:local="clr-namespace:Tango.MachineStudio.Technician.Views" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300"> + <Grid> + <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="40">MOTORS</TextBlock> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MotorsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MotorsView.xaml.cs new file mode 100644 index 000000000..bd548766c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MotorsView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +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.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.Technician.Views +{ + /// <summary> + /// Interaction logic for MotorsView.xaml + /// </summary> + public partial class MotorsView : UserControl + { + public MotorsView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/OverviewView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/OverviewView.xaml new file mode 100644 index 000000000..3c064346d --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/OverviewView.xaml @@ -0,0 +1,12 @@ +<UserControl x:Class="Tango.MachineStudio.Technician.Views.OverviewView" + 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:local="clr-namespace:Tango.MachineStudio.Technician.Views" + mc:Ignorable="d" + d:DesignHeight="300" d:DesignWidth="300"> + <Grid> + <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" FontSize="40">OVERVIEW</TextBlock> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/OverviewView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/OverviewView.xaml.cs new file mode 100644 index 000000000..aeba42c00 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/OverviewView.xaml.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +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.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.Technician.Views +{ + /// <summary> + /// Interaction logic for OverviewView.xaml + /// </summary> + public partial class OverviewView : UserControl + { + public OverviewView() + { + InitializeComponent(); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml new file mode 100644 index 000000000..2e074ec3c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml @@ -0,0 +1,141 @@ +<UserControl x:Class="Tango.MachineStudio.Technician.Views.SensorsView" + 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:local="clr-namespace:Tango.MachineStudio.Technician.Views" + xmlns:global="clr-namespace:Tango.MachineStudio.Technician" + xmlns:vm="clr-namespace:Tango.MachineStudio.Technician.ViewModels" + 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.Technician.Converters" + mc:Ignorable="d" + d:DesignHeight="720" d:DesignWidth="1280" d:DataContext="{d:DesignInstance Type=vm:SensorsViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.SensorsViewVM}" Background="White"> + + <UserControl.Resources> + <ResourceDictionary> + <ResourceDictionary.MergedDictionaries> + <!--RealTimeGraphEx--> + <ResourceDictionary Source="pack://application:,,,/RealTimeGraphEx;component/Resources/Resources.xaml"></ResourceDictionary> + <ResourceDictionary Source="../Resources/GraphEx.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"> + <Button Click="OnGraphFullScreen" Margin="5" ToolTip="Full Screen" HorizontalAlignment="Right" VerticalAlignment="Top" 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> + </Grid> + </Grid> + </DataTemplate> + </Setter.Value> + </Setter> + </Style.Setters> + </Style> + </ResourceDictionary> + + <ResourceDictionary> + <converters:SecondsToGraphPointsConverter x:Key="secondsToPoints"></converters:SecondsToGraphPointsConverter> + </ResourceDictionary> + </ResourceDictionary.MergedDictionaries> + </ResourceDictionary> + </UserControl.Resources> + + <Grid Margin="10"> + <Grid.RowDefinitions> + <RowDefinition Height="1*"/> + <RowDefinition Height="60"/> + </Grid.RowDefinitions> + + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="1*"/> + <ColumnDefinition Width="1*"/> + <ColumnDefinition Width="1*"/> + </Grid.ColumnDefinitions> + <Grid.RowDefinitions> + <RowDefinition Height="1*"/> + <RowDefinition Height="1*"/> + <RowDefinition Height="1*"/> + </Grid.RowDefinitions> + + <!--Temperature--> + <ContentControl Style="{StaticResource graphContent}" Margin="0 0 5 5" MinHeight="5"> + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="40"/> + <ColumnDefinition Width="438*"/> + </Grid.ColumnDefinitions> + + <Border BorderBrush="{StaticResource AccentColorBrush}" BorderThickness="1 1 0 1"> + <StackPanel Orientation="Horizontal"> + <components:YAxisScroll Interval="6" Graph="{Binding ElementName=graphTemperature}" Width="35" Foreground="{StaticResource MaterialDesignLightForeground}" VerticalOffset="-5" FontSize="8" StringFormat="#0.0"></components:YAxisScroll> + <components:YAxisTicks SmallTickTemplate="{StaticResource graphTicksTemplate}" Width="5" SmallTicks="6" Foreground="{StaticResource MaterialDesignLightForeground}" BigTicks="10" Graph="{Binding ElementName=graphTemperature}"></components:YAxisTicks> + </StackPanel> + </Border> + <Border Grid.Column="1" BorderThickness="1" BorderBrush="{StaticResource borderBrush}" Background="{DynamicResource graphBackground}" Margin="5 0 0 0"> + <graphEx:RealTimeGraphExLineErase x:Name="graphTemperature" Controller="{Binding TemperatureController}" Antialiased="True" RefreshRate="30" MaxPoints="{Binding GraphSeconds,Converter={StaticResource secondsToPoints}, ConverterParameter=10}" Minimum="0" Maximum="255" MarkerColor="{StaticResource graphsMarkerColor}" FillGraph="False" Stroke="DodgerBlue"> + <graphEx:RealTimeGraphExLineErase.Components> + <components:MouseValueToolTip ToolTipTemplate="{StaticResource graphTooltipTemplate}" /> + <components:GridLines Rows="4" Columns="6" GridBrush="{DynamicResource graphGridLinesBrush}"></components:GridLines> + </graphEx:RealTimeGraphExLineErase.Components> + <graphEx:RealTimeGraphExLineErase.InnerContent> + <Grid> + <Label Style="{StaticResource graphLabel}"> + TEMPERATURE + </Label> + </Grid> + </graphEx:RealTimeGraphExLineErase.InnerContent> + </graphEx:RealTimeGraphExLineErase> + </Border> + </Grid> + </ContentControl> + + <!--Pressure--> + <ContentControl Grid.Column="1" Style="{StaticResource graphContent}" Margin="0 0 5 5" MinHeight="5"> + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="40"/> + <ColumnDefinition Width="438*"/> + </Grid.ColumnDefinitions> + + <Border BorderBrush="{StaticResource AccentColorBrush}" BorderThickness="1 1 0 1"> + <StackPanel Orientation="Horizontal"> + <components:YAxisWave Interval="6" Graph="{Binding ElementName=graphPressure}" Width="35" Foreground="{StaticResource MaterialDesignLightForeground}" VerticalOffset="-5" FontSize="8" StringFormat="#0.0"></components:YAxisWave> + <components:YAxisTicks SmallTickTemplate="{StaticResource graphTicksTemplate}" Width="5" SmallTicks="6" Foreground="{StaticResource MaterialDesignLightForeground}" BigTicks="10" Graph="{Binding ElementName=graphPressure}"></components:YAxisTicks> + </StackPanel> + </Border> + <Border Grid.Column="1" BorderThickness="1" BorderBrush="{StaticResource borderBrush}" Background="{DynamicResource graphBackground}" Margin="5 0 0 0"> + <graphEx:RealTimeGraphExWaveScroll x:Name="graphPressure" Controller="{Binding PressureController}" Antialiased="True" RefreshRate="30" MaxPoints="{Binding GraphSeconds,Converter={StaticResource secondsToPoints}, ConverterParameter=10}" Minimum="0" Maximum="255" FillGraph="True" Fill="#70FF0000" Stroke="Red"> + <graphEx:RealTimeGraphExWaveScroll.Components> + <components:MouseValueToolTip ToolTipTemplate="{StaticResource graphTooltipTemplate}" /> + <components:GridLines Rows="4" Columns="6" GridBrush="{DynamicResource graphGridLinesBrush}"></components:GridLines> + </graphEx:RealTimeGraphExWaveScroll.Components> + <graphEx:RealTimeGraphExWaveScroll.InnerContent> + <Grid> + <Label Style="{StaticResource graphLabel}"> + PRESSURE + </Label> + </Grid> + </graphEx:RealTimeGraphExWaveScroll.InnerContent> + </graphEx:RealTimeGraphExWaveScroll> + </Border> + </Grid> + </ContentControl> + </Grid> + + <Grid Grid.Row="1"> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Right"> + <Button Width="140" Height="40" Margin="0 0 10 0">STOP</Button> + <Button Width="140" Height="40">START</Button> + </StackPanel> + </Grid> + </Grid> +</UserControl> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml.cs new file mode 100644 index 000000000..4727a3603 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/SensorsView.xaml.cs @@ -0,0 +1,53 @@ +using Microsoft.Practices.ServiceLocation; +using RealTimeGraphEx.Synchronization; +using System; +using System.Collections.Generic; +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.Imaging; +using System.Windows.Navigation; +using System.Windows.Shapes; + +namespace Tango.MachineStudio.Technician.Views +{ + /// <summary> + /// Interaction logic for DebugView.xaml + /// </summary> + public partial class SensorsView : UserControl + { + private SyncManager _syncManager; + + public SensorsView() + { + InitializeComponent(); + + _syncManager = new SyncManager(); + _syncManager.AddGraph(graphTemperature); + _syncManager.AddGraph(graphPressure); + _syncManager.RefreshRate = 30; + _syncManager.Start(); + } + + private void OnGraphFullScreen(object sender, RoutedEventArgs e) + { + + } + + private void Graph_MouseEnter(object sender, MouseEventArgs e) + { + + } + + private void Graph_MouseLeave(object sender, MouseEventArgs e) + { + + } + } +} |
