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 | |
| 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')
25 files changed, 891 insertions, 8 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/DBModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/DBModule.cs index 4f751d9da..c433a4cd4 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/DBModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.DB/DBModule.cs @@ -17,10 +17,8 @@ namespace Tango.MachineStudio.DB /// <seealso cref="Tango.MachineStudio.Common.IStudioModule" /> public class DBModule : IStudioModule { - /// <summary> - /// The is initialized - /// </summary> private bool _isInitialized; + private bool _isLoaded; /// <summary> /// Gets the module name. @@ -53,6 +51,11 @@ namespace Tango.MachineStudio.DB public Permissions Permission => Permissions.RunDataBaseModule; /// <summary> + /// Sets a value indicating whether this module is loaded. + /// </summary> + public bool IsLoaded { get => _isLoaded; set => _isLoaded = value; } + + /// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. /// </summary> /// <exception cref="NotImplementedException"></exception> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModule.cs index c3d351468..4401245a9 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/DeveloperModule.cs @@ -15,6 +15,7 @@ namespace Tango.MachineStudio.Developer public class DeveloperModule : IStudioModule { private bool _isInitialized; + private bool _isLoaded; public string Name => "Developer"; @@ -26,6 +27,11 @@ namespace Tango.MachineStudio.Developer public bool IsInitialized => _isInitialized; + /// <summary> + /// Sets a value indicating whether this module is loaded. + /// </summary> + public bool IsLoaded { get => _isLoaded; set => _isLoaded = value; } + public Permissions Permission => Permissions.RunDeveloperModule; public void Dispose() diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs index ca13bd350..8fbac790f 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.MachineDesigner/MachineDesignerModule.cs @@ -18,6 +18,8 @@ namespace Tango.MachineStudio.MachineDesigner /// <seealso cref="Tango.MachineStudio.Common.IStudioModule" /> public class MachineDesignerModule : IStudioModule { + private bool _isLoaded; + /// <summary> /// Gets the module name. /// </summary> @@ -34,6 +36,11 @@ namespace Tango.MachineStudio.MachineDesigner public BitmapSource Image => ResourceHelper.GetImageFromResources("Images/machine-designer-module.jpg"); /// <summary> + /// Sets a value indicating whether this module is loaded. + /// </summary> + public bool IsLoaded { get => _isLoaded; set => _isLoaded = value; } + + /// <summary> /// Gets the module entry point view. /// </summary> public FrameworkElement MainView => new MainView(); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModule.cs index 23214cf55..8b072ea46 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Stubs/StubsModule.cs @@ -18,6 +18,8 @@ namespace Tango.MachineStudio.Stubs /// <seealso cref="Tango.MachineStudio.Common.IStudioModule" /> public class StubsModule : IStudioModule { + private bool _isLoaded; + /// <summary> /// Gets the module name. /// </summary> @@ -39,6 +41,11 @@ namespace Tango.MachineStudio.Stubs public FrameworkElement MainView => new MainView(); /// <summary> + /// Sets a value indicating whether this module is loaded. + /// </summary> + public bool IsLoaded { get => _isLoaded; set => _isLoaded = value; } + + /// <summary> /// Gets the permission required to see and load this module. /// </summary> public Permissions Permission => Permissions.RunSynchronizationModule; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/SynchronizationModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/SynchronizationModule.cs index f6381a482..4a753b05e 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/SynchronizationModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/SynchronizationModule.cs @@ -18,9 +18,7 @@ namespace Tango.MachineStudio.Synchronization /// <seealso cref="Tango.MachineStudio.Common.IStudioModule" /> public class SynchronizationModule : IStudioModule { - /// <summary> - /// The is initialized - /// </summary> + private bool _isLoaded; private bool _isInitialized; /// <summary> @@ -44,6 +42,11 @@ namespace Tango.MachineStudio.Synchronization public FrameworkElement MainView => new MainView(); /// <summary> + /// Sets a value indicating whether this module is loaded. + /// </summary> + public bool IsLoaded { get => _isLoaded; set => _isLoaded = value; } + + /// <summary> /// Gets a value indicating whether this module has been initialized. /// </summary> public bool IsInitialized => _isInitialized; diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/MainViewVM.cs index 48a5c64bd..21d76d7d7 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Synchronization/ViewModels/MainViewVM.cs @@ -22,7 +22,7 @@ namespace Tango.MachineStudio.Synchronization.ViewModels MainViewLogger logger = new MainViewLogger(); logger.NewLog += (output) => { - Log += output + Environment.NewLine; + //Log += output + Environment.NewLine; }; LogManager.RegisterLogger(logger); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/SecondsToGraphPointsConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/SecondsToGraphPointsConverter.cs new file mode 100644 index 000000000..3120c44a6 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/SecondsToGraphPointsConverter.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Data; + +namespace Tango.MachineStudio.Technician.Converters +{ + public class SecondsToGraphPointsConverter : IValueConverter + { + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + double arrLength = double.Parse(parameter.ToString()); + return Helpers.GraphsMaxPointsHelper.GetMaxPoints(arrLength); + } + + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + return value; + } + } +}
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/TransitionLinkConverter.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/TransitionLinkConverter.cs new file mode 100644 index 000000000..d67f3a259 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Converters/TransitionLinkConverter.cs @@ -0,0 +1,55 @@ +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; + +namespace Tango.MachineStudio.Technician.Converters +{ + /// <summary> + /// Binding converter for converting TransitionControl child Tag to text style. + /// </summary> + /// <remarks> + /// This converter is used by the patient page tabs, changing the selected tab text style to bold/normal. + /// </remarks> + public class TransitionLinkConverter : IValueConverter + { + /// <summary> + /// Converts a ContentControl to font style. + /// </summary> + /// <param name="value">Content control.</param> + /// <param name="targetType"></param> + /// <param name="parameter"></param> + /// <param name="culture"></param> + /// <returns>Font style.</returns> + public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + ContentControl control = value as ContentControl; + + if (control != null && control.Tag != null && control.Tag.ToString().ToLower() == parameter.ToString().ToLower()) + { + return FontWeights.Bold; + } + else + { + return FontWeights.Normal; + } + } + + /// <summary> + /// Not Implemented. + /// </summary> + /// <param name="value"></param> + /// <param name="targetType"></param> + /// <param name="parameter"></param> + /// <param name="culture"></param> + /// <returns></returns> + public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) + { + return value; + } + } +}
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsMaxPointsHelper.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsMaxPointsHelper.cs new file mode 100644 index 000000000..87aab5967 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Helpers/GraphsMaxPointsHelper.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Settings; + +namespace Tango.MachineStudio.Technician.Helpers +{ + public static class GraphsMaxPointsHelper + { + public static int GetMaxPoints(double arrLength) + { + try + { + double seconds = SettingsManager.Default.MachineStudio.TechnicianModule.GraphsDuration; + double pullRate = SettingsManager.Default.MachineStudio.TechnicianModule.GraphsPullingInterval; + return (int)(((pullRate * arrLength * 10 * seconds) * (10 / pullRate)) * 0.65); + } + catch (Exception) + { + return 300; + } + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationManager.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationManager.cs new file mode 100644 index 000000000..f473776d1 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationManager.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.MachineStudio.Technician.Views; + +namespace Tango.MachineStudio.Technician.Navigation +{ + public class TechNavigationManager + { + public void NavigateTo(TechNavigationView view) + { + MainView.Instance.TransitionControl.AutoNavigate(view.ToString()); + } + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationView.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationView.cs new file mode 100644 index 000000000..27d9fb09b --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Navigation/TechNavigationView.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Tango.MachineStudio.Technician.Navigation +{ + public enum TechNavigationView + { + Overview, + Motors, + Sensors, + } +} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Resources/GraphEx.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Resources/GraphEx.xaml new file mode 100644 index 000000000..85cccc2dd --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Resources/GraphEx.xaml @@ -0,0 +1,126 @@ +<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:sys="clr-namespace:System;assembly=mscorlib" + xmlns:local="clr-namespace:Tango.MachineStudio.Technician.Resources"> + + <FontFamily x:Key="FontName">Segoe UI</FontFamily> + <FontFamily x:Key="NotesFont">Lucida Console</FontFamily> + + <sys:Double x:Key="ExtraExtraLargeFontSize">28</sys:Double> + <sys:Double x:Key="ExtraLargeFontSize">26</sys:Double> + <sys:Double x:Key="LargeFontSize">20</sys:Double> + <sys:Double x:Key="MediumFontSize">16</sys:Double> + <sys:Double x:Key="SmallFontSize">14</sys:Double> + <sys:Double x:Key="MiniFontSize">12</sys:Double> + <sys:Double x:Key="TinyFontSize">9</sys:Double> + + <!--Colors--> + <Color x:Key="borderColor">Silver</Color> + <Color x:Key="graphGridLinesColor">#FFE9E9E9</Color> + <Color x:Key="graphsMarkerColor">Gray</Color> + <Color x:Key="materialColor">#03A9F4</Color> + + + <!--Brushes--> + <SolidColorBrush x:Key="borderBrush" Color="{StaticResource borderColor}"></SolidColorBrush> + <SolidColorBrush x:Key="graphGridLinesBrush" Color="{StaticResource graphGridLinesColor}"></SolidColorBrush> + <SolidColorBrush x:Key="BlackBrush" Color="#545454"></SolidColorBrush> + + <SolidColorBrush x:Key="graphGridLinesLightBrush" Color="{StaticResource graphGridLinesColor}"></SolidColorBrush> + <SolidColorBrush x:Key="graphGridLinesDarkBrush" Color="#FF2E2E2E"></SolidColorBrush> + + <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" x:Key="graphBackgroundLight"> + <GradientStop Color="White"/> + <GradientStop Color="#FFE9E9E9" Offset="1"/> + </LinearGradientBrush> + + <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" x:Key="graphBackgroundDark"> + <GradientStop Color="Black"/> + <GradientStop Color="#FF333333" Offset="1"/> + </LinearGradientBrush> + + <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" x:Key="graphBackground"> + <GradientStop Color="White"/> + <GradientStop Color="#FFE9E9E9" Offset="1"/> + </LinearGradientBrush> + + <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" x:Key="graphLabelBackground" Opacity="0.7"> + <GradientStop Color="White"/> + <GradientStop Color="#FFD9D9D9" Offset="1"/> + </LinearGradientBrush> + + <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0" x:Key="graphLegendBackground" Opacity="0.7"> + <GradientStop Color="#FFE9E9E9"/> + <GradientStop Color="#FFBDBDBD" Offset="1"/> + </LinearGradientBrush> + + <SolidColorBrush Color="#FFF1F1F1" x:Key="topBarBackgroundBrush"></SolidColorBrush> + + <!--Navigation Link Button--> + <Style x:Key="LinkButton" TargetType="Button"> + <Setter Property="Stylus.IsPressAndHoldEnabled" Value="False"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Button"> + <TextBlock FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}"> + <ContentPresenter /></TextBlock> + </ControlTemplate> + </Setter.Value> + </Setter> + <Setter Property="Foreground" Value="{StaticResource BlackBrush}" /> + <Style.Triggers> + <Trigger Property="IsEnabled" Value="False"> + <Setter Property="Opacity" Value="0.5"></Setter> + </Trigger> + <Trigger Property="IsMouseOver" Value="true"> + <Setter Property="Foreground" Value="{StaticResource AccentColorBrush}" /> + </Trigger> + <EventTrigger RoutedEvent="TouchUp"> + <BeginStoryboard> + <Storyboard> + <ColorAnimation Storyboard.TargetProperty="Foreground.Color" Duration="0" To="{StaticResource BlackColor}"></ColorAnimation> + </Storyboard> + </BeginStoryboard> + </EventTrigger> + </Style.Triggers> + </Style> + <!--Navigation Link Button--> + + + <!--Graph Label--> + <Style x:Key="graphLabel" TargetType="Label"> + <Style.Setters> + <Setter Property="IsHitTestVisible" Value="False"></Setter> + <Setter Property="Margin" Value="-1 -1 0 0"></Setter> + <Setter Property="HorizontalAlignment" Value="Left"></Setter> + <Setter Property="VerticalAlignment" Value="Top"></Setter> + <Setter Property="Padding" Value="0"></Setter> + <Setter Property="ContentTemplate"> + <Setter.Value> + <DataTemplate> + <Border Width="Auto" Padding="0 0 20 0" Height="25" BorderBrush="{StaticResource AccentColorBrush}" BorderThickness="1" CornerRadius="0 0 30 0" Background="{StaticResource graphLabelBackground}" > + <TextBlock Margin="5 0 0 0" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="{StaticResource TinyFontSize}" Text="{Binding}"></TextBlock> + </Border> + </DataTemplate> + </Setter.Value> + </Setter> + </Style.Setters> + </Style> + <!--Graph Label--> + + + <!--Graph Ticks Template--> + <DataTemplate x:Key="graphTicksTemplate"> + <Ellipse Width="3" Height="3" Margin="0 0 0 0" Fill="{StaticResource AccentColorBrush}"></Ellipse> + </DataTemplate> + <!--Graph Ticks Template--> + + <DataTemplate x:Key="graphTooltipTemplate"> + <Border CornerRadius="5" BorderThickness="1" BorderBrush="White" Padding="8" MinWidth="50" Margin="20 0 20 0"> + <Border.Background> + <SolidColorBrush Color="Black" Opacity="0.5"></SolidColorBrush> + </Border.Background> + <TextBlock Foreground="White" FontSize="10" HorizontalAlignment="Center" TextAlignment="Center" Text="{Binding StringFormat='0.000'}"></TextBlock> + </Border> + </DataTemplate> +</ResourceDictionary>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj index 2c5df42fc..097917fef 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Tango.MachineStudio.Technician.csproj @@ -77,15 +77,46 @@ <Reference Include="PresentationFramework" /> </ItemGroup> <ItemGroup> + <Compile Include="Converters\SecondsToGraphPointsConverter.cs" /> + <Compile Include="Converters\TransitionLinkConverter.cs" /> + <Compile Include="Helpers\GraphsMaxPointsHelper.cs" /> + <Compile Include="Navigation\TechNavigationView.cs" /> + <Compile Include="Navigation\TechNavigationManager.cs" /> <Compile Include="TechnicianModule.cs" /> <Compile Include="ViewModelLocator.cs" /> <Compile Include="ViewModels\MainViewVM.cs" /> + <Compile Include="ViewModels\SensorsViewVM.cs" /> + <Compile Include="Views\MotorsView.xaml.cs"> + <DependentUpon>MotorsView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\OverviewView.xaml.cs"> + <DependentUpon>OverviewView.xaml</DependentUpon> + </Compile> + <Compile Include="Views\SensorsView.xaml.cs"> + <DependentUpon>SensorsView.xaml</DependentUpon> + </Compile> <Compile Include="Views\MainView.xaml.cs"> <DependentUpon>MainView.xaml</DependentUpon> </Compile> <Compile Include="..\..\..\Versioning\GlobalVersionInfo.cs"> <Link>GlobalVersionInfo.cs</Link> </Compile> + <Page Include="Resources\GraphEx.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\MotorsView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\OverviewView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> + <Page Include="Views\SensorsView.xaml"> + <SubType>Designer</SubType> + <Generator>MSBuild:Compile</Generator> + </Page> <Page Include="Views\MainView.xaml"> <SubType>Designer</SubType> <Generator>MSBuild:Compile</Generator> @@ -117,6 +148,10 @@ </None> </ItemGroup> <ItemGroup> + <ProjectReference Include="..\..\..\SideChains\RealTimeGraphEx\RealTimeGraphEx.csproj"> + <Project>{b9ae25d6-be35-492f-9079-21a7f3e6f7cc}</Project> + <Name>RealTimeGraphEx</Name> + </ProjectReference> <ProjectReference Include="..\..\..\Tango.Core\Tango.Core.csproj"> <Project>{a34ee0f0-649d-41c8-8489-b6f1cc6924ee}</Project> <Name>Tango.Core</Name> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs index a4eaff71e..b715b6710 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechnicianModule.cs @@ -14,6 +14,10 @@ namespace Tango.MachineStudio.Technician { public class TechnicianModule : IStudioModule { + private bool _isLoaded; + + public event EventHandler<bool> IsLoadedChanged; + public string Name => "Technician"; public string Description => "Provides access to low level machine components by exposing diagnostics and profiling tools."; @@ -26,6 +30,16 @@ namespace Tango.MachineStudio.Technician public bool IsInitialized => true; + /// <summary> + /// Sets a value indicating whether this module is loaded. + /// </summary> + public bool IsLoaded + { + get { return _isLoaded; } + set { _isLoaded = value; IsLoadedChanged?.Invoke(this, value); } + } + + public void Dispose() { diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModelLocator.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModelLocator.cs index f922d5ec4..e7fea686d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModelLocator.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModelLocator.cs @@ -1,6 +1,7 @@ using GalaSoft.MvvmLight; using GalaSoft.MvvmLight.Ioc; using Microsoft.Practices.ServiceLocation; +using Tango.MachineStudio.Technician.Navigation; using Tango.MachineStudio.Technician.ViewModels; namespace Tango.MachineStudio.Technician @@ -17,7 +18,13 @@ namespace Tango.MachineStudio.Technician static ViewModelLocator() { ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default); + SimpleIoc.Default.Register<MainViewVM>(); + SimpleIoc.Default.Register<SensorsViewVM>(); + + SimpleIoc.Default.Unregister<TechNavigationManager>(); + + SimpleIoc.Default.Register<TechNavigationManager, TechNavigationManager>(); } public static MainViewVM MainViewVM @@ -27,5 +34,13 @@ namespace Tango.MachineStudio.Technician return ServiceLocator.Current.GetInstance<MainViewVM>(); } } + + public static SensorsViewVM SensorsViewVM + { + get + { + return ServiceLocator.Current.GetInstance<SensorsViewVM>(); + } + } } }
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MainViewVM.cs index c715af6cb..68852fe20 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MainViewVM.cs @@ -3,12 +3,39 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; +using Tango.Core.Commands; +using Tango.MachineStudio.Technician.Navigation; using Tango.SharedUI; namespace Tango.MachineStudio.Technician.ViewModels { public class MainViewVM : ViewModel { + private TechNavigationManager _navigation; + #region Constructors + + public MainViewVM(TechNavigationManager navigationManager) + { + _navigation = navigationManager; + NavigateToViewCommand = new RelayCommand<string>(NavigateToView); + } + + #endregion + + #region Commands + + public RelayCommand<String> NavigateToViewCommand { get; set; } + + #endregion + + #region Private Methods + + private void NavigateToView(string view) + { + _navigation.NavigateTo((TechNavigationView)Enum.Parse(typeof(TechNavigationView), view, true)); + } + + #endregion } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/SensorsViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/SensorsViewVM.cs new file mode 100644 index 000000000..cb3114f4c --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/SensorsViewVM.cs @@ -0,0 +1,139 @@ +using RealTimeGraphEx.Controllers; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Integration.Operators; +using Tango.Logging; +using Tango.MachineStudio.Common.Modules; +using Tango.MachineStudio.Common.StudioApplication; +using Tango.PMR.Diagnostics; +using Tango.Settings; +using Tango.SharedUI; + +namespace Tango.MachineStudio.Technician.ViewModels +{ + public class SensorsViewVM : ViewModel + { + private List<GraphControllerBase> _controllers; + + public IStudioApplicationManager ApplicationManager { get; set; } + + private IMachineOperator _machineOperator; + public IMachineOperator MachineOperator + { + get { return _machineOperator; } + set { _machineOperator = value; RaisePropertyChangedAuto(); } + } + + public SensorsViewVM(IStudioApplicationManager applicationManager, IStudioModuleLoader moduleLoader) + { + ApplicationManager = applicationManager; + ApplicationManager.ConnectedMachineChanged += ApplicationManager_ConnectedMachineChanged; + + InitializeConnectedMachine(ApplicationManager.ConnectedMachine); + + if (!DesignMode) + { + //Set graphs FIFO capacity by seconds (this will be converted to MaxPoints by the view). + GraphSeconds = SettingsManager.Default.MachineStudio.TechnicianModule.GraphsDuration; + + _controllers = new List<GraphControllerBase>(); + + TemperatureController = new GraphController(); + PressureController = new GraphController(); + + _controllers.Add(TemperatureController); + _controllers.Add(PressureController); + + var module = moduleLoader.UserModules.SingleOrDefault(x => x is TechnicianModule) as TechnicianModule; + + if (module != null) + { + module.IsLoadedChanged += Module_IsLoadedChanged; + } + } + } + + private void Module_IsLoadedChanged(object sender, bool loaded) + { + //_controllers.ForEach(x => x.ChangeRenderMode(loaded)); + } + + private void ApplicationManager_ConnectedMachineChanged(object sender, Integration.Services.IExternalBridgeClient machineOperator) + { + InitializeConnectedMachine(machineOperator); + } + + private void MachineOperator_SensorsDataAvailable(object sender, PushSensorsResponse data) + { + TemperatureController.PushData(data.Temperature.ToArray().Select(Convert.ToDouble).ToArray()); + PressureController.PushData(data.Temperature.ToArray().Select(Convert.ToDouble).ToArray()); + } + + private void InitializeConnectedMachine(IMachineOperator machineOperator) + { + MachineOperator = machineOperator; + + if (MachineOperator != null) + { + MachineOperator.EnableSensorsUpdate = true; + MachineOperator.SensorsDataAvailable -= MachineOperator_SensorsDataAvailable; + MachineOperator.SensorsDataAvailable += MachineOperator_SensorsDataAvailable; + } + } + + #region Graphs Controllers + + private GraphController _temperatureController; + /// <summary> + /// Gets or sets the temperature sensor graph controller . + /// </summary> + public GraphController TemperatureController + { + get { return _temperatureController; } + set { _temperatureController = value; RaisePropertyChanged(nameof(TemperatureController)); } + } + + private GraphController _pressureController; + /// <summary> + /// Gets or sets the pressure sensor graph controller . + /// </summary> + public GraphController PressureController + { + get { return _pressureController; } + set { _pressureController = value; RaisePropertyChanged(nameof(PressureController)); } + } + + #endregion + + private int _graphSeconds; + /// <summary> + /// Gets or sets the graphs number of seconds to complete FIFO capacity. + /// </summary> + public int GraphSeconds + { + get { return _graphSeconds; } + set { _graphSeconds = value; RaisePropertyChanged(nameof(GraphSeconds)); } + } + + /// <summary> + /// Clears the graphs. + /// </summary> + public void ClearGraphs() + { + _controllers.ForEach(x => x.Clear()); + } + + /// <summary> + /// Creates a dummy list with default value of -1000 (used to fill graphs buffer). + /// </summary> + /// <param name="count">List length.</param> + /// <returns></returns> + private List<double> CreateDummyList(int count) + { + return Enumerable.Repeat<double>(-1000, count + 1).ToList(); + } + } +} 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) + { + + } + } +} |
