diff options
| author | Avi Levkovich <avi@twine-s.com> | 2019-04-17 12:28:59 +0300 |
|---|---|---|
| committer | Avi Levkovich <avi@twine-s.com> | 2019-04-17 12:28:59 +0300 |
| commit | b8489b32eb989c7aa81ec01ad558ccfb7674389c (patch) | |
| tree | fc676997551d4d0dd23242340589ba026a18db16 /Software/Visual_Studio/MachineStudio/Modules | |
| parent | 8f8bae1c76df24a33d972145182335a84eb55c8d (diff) | |
| parent | 028e41fc21fecee05c8db707382db586b26e6537 (diff) | |
| download | Tango-b8489b32eb989c7aa81ec01ad558ccfb7674389c.tar.gz Tango-b8489b32eb989c7aa81ec01ad558ccfb7674389c.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules')
15 files changed, 129 insertions, 152 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Graph/WpfGraphController.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Graph/WpfGraphController.cs deleted file mode 100644 index 63ce7035e..000000000 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Graph/WpfGraphController.cs +++ /dev/null @@ -1,36 +0,0 @@ -using RealTimeGraphX; -using RealTimeGraphX.DataPoints; -using RealTimeGraphX.Renderers; -using RealTimeGraphX.WPF.DataSeries; -using RealTimeGraphX.WPF.Painters; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Media; - -namespace Tango.MachineStudio.ColorCapture.Graph -{ - public class WpfGraphController : GraphControllerBase<WpfDataSeries, DoubleDataPoint, DoubleDataPoint> - { - public WpfGraphController(int refreshRate = 50) - { - AddDataSeries(new WpfDataSeries() - { - StrokeThickness = 1, - Stroke = Colors.DodgerBlue, - }); - - var renderer = new GraphScrollingRenderer<WpfDataSeries, DoubleDataPoint, DoubleDataPoint>() - { - RefreshRate = TimeSpan.FromMilliseconds(refreshRate) - }; - - var painter = new WpfScrollingGraphPainter(); - - ConnectOutput(renderer); - renderer.ConnectOutput(painter); - } - } -} diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Tango.MachineStudio.ColorCapture.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Tango.MachineStudio.ColorCapture.csproj index c30520f13..b399d9971 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Tango.MachineStudio.ColorCapture.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Tango.MachineStudio.ColorCapture.csproj @@ -100,7 +100,6 @@ <Compile Include="ColorLabModule.cs" /> <Compile Include="Controls\ColorMatrixControl.cs" /> <Compile Include="Controls\IndexedUniformGrid.cs" /> - <Compile Include="Graph\WpfGraphController.cs" /> <Compile Include="Models\BenchmarkItem.cs" /> <Compile Include="Models\CaptureConfig.cs" /> <Compile Include="Models\CaptureItem.cs" /> @@ -139,12 +138,12 @@ <Project>{37e4ceab-b54b-451f-b535-04cf7da9c459}</Project> <Name>ColorMine</Name> </ProjectReference> - <ProjectReference Include="..\..\..\SideChains\RealTimeGraphX.WPF\RealTimeGraphX.WPF.csproj"> - <Project>{99d233c5-fee7-418e-9c25-d4584cb52e28}</Project> + <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\RealTimeGraphX.csproj"> - <Project>{6d55a3b8-46d3-493a-a143-aebd2b98d683}</Project> + <ProjectReference Include="..\..\..\SideChains\RealTimeGraphX-master\RealTimeGraphX\RealTimeGraphX.csproj"> + <Project>{f13a489c-80ee-4cd0-bdd4-92d959215646}</Project> <Name>RealTimeGraphX</Name> </ProjectReference> <ProjectReference Include="..\..\..\Tango.BL\Tango.BL.csproj"> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModels/MainViewVM.cs index 5ea5747d5..31eec0871 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/ViewModels/MainViewVM.cs @@ -2,6 +2,8 @@ using ColorMine.ColorSpaces.Comparisons; using Microsoft.Win32; using Microsoft.WindowsAPICodePack.Dialogs; +using RealTimeGraphX.DataPoints; +using RealTimeGraphX.WPF; using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -16,7 +18,6 @@ using Tango.Core; using Tango.Core.Commands; using Tango.CSV; using Tango.Logging; -using Tango.MachineStudio.ColorCapture.Graph; using Tango.MachineStudio.ColorCapture.Models; using Tango.MachineStudio.Common; using Tango.MachineStudio.Common.Notifications; @@ -106,7 +107,7 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels public double DeltaE { get; set; } - public WpfGraphController CaptureDeltaEController { get; set; } + public WpfGraphController<DoubleDataPoint, DoubleDataPoint> CaptureDeltaEController { get; set; } public RelayCommand ToggleCameraCommand { get; set; } @@ -169,7 +170,11 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels Benchmarks = new ObservableCollection<BenchmarkItem>(); _cardDetector = new CardDetector(); ToggleCameraCommand = new RelayCommand(ToggleCamera); - CaptureDeltaEController = new WpfGraphController(); + CaptureDeltaEController = new WpfGraphController<DoubleDataPoint, DoubleDataPoint>(); + CaptureDeltaEController.DataSeriesCollection.Add(new WpfGraphDataSeries() + { + Stroke = System.Windows.Media.Colors.DodgerBlue, + }); CaptureDeltaEController.Range.AutoY = true; CaptureDeltaEController.Range.MaximumX = 1000; @@ -461,6 +466,11 @@ namespace Tango.MachineStudio.ColorCapture.ViewModels } } + if (double.IsInfinity(DeltaE)) + { + DeltaE = 0; + } + CaptureDeltaEController.PushData(_sampleCounter++, DeltaE); } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml index ba8e3f281..afdac7e18 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml @@ -9,12 +9,11 @@ xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI" xmlns:vm="clr-namespace:Tango.MachineStudio.ColorCapture.ViewModels" xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" - xmlns:graphX="clr-namespace:RealTimeGraphX.WPF.Surfaces;assembly=RealTimeGraphX.WPF" - xmlns:componentsX="clr-namespace:RealTimeGraphX.WPF.Components;assembly=RealTimeGraphX.WPF" + xmlns:commonControls="clr-namespace:Tango.MachineStudio.Common.Controls;assembly=Tango.MachineStudio.Common" xmlns:controls="clr-namespace:Tango.MachineStudio.ColorCapture.Controls" xmlns:sharedControls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:tcc="clr-namespace:Tango.TCC.BL;assembly=Tango.TCC.BL" - xmlns:realtimeGraphX="clr-namespace:RealTimeGraphX.WPF.Surfaces;assembly=RealTimeGraphX.WPF" + xmlns:realtimeGraphX="clr-namespace:RealTimeGraphX.WPF;assembly=RealTimeGraphX.WPF" xmlns:global="clr-namespace:Tango.MachineStudio.ColorCapture" xmlns:local="clr-namespace:Tango.MachineStudio.ColorCapture.Views" mc:Ignorable="d" @@ -435,14 +434,14 @@ </Grid.ColumnDefinitions> <Border Margin="0 1 0 2"> - <componentsX:GraphAxisControl Orientation="Vertical" Foreground="{StaticResource Accent}" FontSize="12" Surface="{Binding ElementName=Graph}" StringFormat="Δ 0.00;-#" /> + <realtimeGraphX:WpfGraphAxisControl Orientation="Vertical" Foreground="{StaticResource Accent}" FontSize="12" Controller="{Binding CaptureDeltaEController}" StringFormat="Δ 0.00;-#" /> </Border> <Border Grid.Column="1" BorderThickness="1" BorderBrush="{StaticResource Accent}" Margin="1 0 0 0" Background="{StaticResource LightBackground}"> <Grid> - <componentsX:GraphGridLines Foreground="#3E3E3E" /> + <realtimeGraphX:WpfGraphGridLines Foreground="#3E3E3E" /> - <graphX:WpfGraphSurface x:Name="Graph"></graphX:WpfGraphSurface> + <realtimeGraphX:WpfGraphSurface Controller="{Binding CaptureDeltaEController}"></realtimeGraphX:WpfGraphSurface> </Grid> </Border> </Grid> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml.cs index 05b5daf7e..aa7ff5d49 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.ColorCapture/Views/MainView.xaml.cs @@ -29,7 +29,6 @@ namespace Tango.MachineStudio.ColorCapture.Views Loaded += (_, __) => { _vm = DataContext as MainViewVM; - _vm.CaptureDeltaEController.Output.Output.ConnectOutput(Graph); }; } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj index 190e8d0fe..cd00557b1 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/Tango.MachineStudio.Developer.csproj @@ -196,10 +196,6 @@ <Project>{37e4ceab-b54b-451f-b535-04cf7da9c459}</Project> <Name>ColorMine</Name> </ProjectReference> - <ProjectReference Include="..\..\..\SideChains\RealTimeGraphEx\RealTimeGraphEx.csproj"> - <Project>{b9ae25d6-be35-492f-9079-21a7f3e6f7cc}</Project> - <Name>RealTimeGraphEx</Name> - </ProjectReference> <ProjectReference Include="..\..\..\SideChains\Tango.AutoComplete\Tango.AutoComplete.csproj"> <Project>{BB2ABB74-BA58-4812-83AA-EC8171F42DF4}</Project> <Name>Tango.AutoComplete</Name> @@ -361,7 +357,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <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> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml index 22fd8eaa8..9b9334355 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/MultiGraphElementEditor.xaml @@ -32,7 +32,7 @@ <!--Content--> <Grid> <!--<Viewbox Stretch="Fill">--> - <controls:RealTimeGraphControl x:Name="InnerGraph" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}" x:FieldModifier="public" DisplayName="{Binding TechMonitor.Description}" DisplayUnits="{Binding TechMonitor.Units}" StringFormat="{Binding DecimalPlaces,Converter={StaticResource DecimalPlacesToStringFormatConverter}}" /> + <controls:WpfGraphControl x:Name="InnerGraph" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}" x:FieldModifier="public" DisplayName="{Binding TechMonitor.Description}" DisplayUnits="{Binding TechMonitor.Units}" StringFormat="{Binding DecimalPlaces,Converter={StaticResource DecimalPlacesToStringFormatConverter}}" /> <!--</Viewbox>--> </Grid> <!--Content--> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml index ca2481de6..622ddfa8b 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Editors/SingleGraphElementEditor.xaml @@ -32,9 +32,9 @@ <!--Content--> <Grid> <!--<Viewbox Stretch="Fill">--> - <controls:RealTimeGraphControl x:Name="InnerGraph" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}" x:FieldModifier="public" DisplayName="{Binding TechMonitor.Description}" DisplayUnits="{Binding TechMonitor.Units}" StringFormat="{Binding DecimalPlaces,Converter={StaticResource DecimalPlacesToStringFormatConverter}}"> + <controls:WpfGraphControl x:Name="InnerGraph" IsHitTestVisible="{Binding RelativeSource={RelativeSource AncestorType=local:ElementsEditor},Path=IsEditable,Converter={StaticResource BooleanInverseConverter}}" x:FieldModifier="public" DisplayName="{Binding TechMonitor.Description}" DisplayUnits="{Binding TechMonitor.Units}" StringFormat="{Binding DecimalPlaces,Converter={StaticResource DecimalPlacesToStringFormatConverter}}"> - </controls:RealTimeGraphControl> + </controls:WpfGraphControl> <!--</Viewbox>--> </Grid> <!--Content--> 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 7e6f4e111..ff45bcbf9 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 @@ -522,16 +522,12 @@ </None> </ItemGroup> <ItemGroup> - <ProjectReference Include="..\..\..\SideChains\RealTimeGraphEx\RealTimeGraphEx.csproj"> - <Project>{b9ae25d6-be35-492f-9079-21a7f3e6f7cc}</Project> - <Name>RealTimeGraphEx</Name> - </ProjectReference> - <ProjectReference Include="..\..\..\SideChains\RealTimeGraphX.WPF\RealTimeGraphX.WPF.csproj"> - <Project>{99d233c5-fee7-418e-9c25-d4584cb52e28}</Project> + <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\RealTimeGraphX.csproj"> - <Project>{6d55a3b8-46d3-493a-a143-aebd2b98d683}</Project> + <ProjectReference Include="..\..\..\SideChains\RealTimeGraphX-master\RealTimeGraphX\RealTimeGraphX.csproj"> + <Project>{f13a489c-80ee-4cd0-bdd4-92d959215646}</Project> <Name>RealTimeGraphX</Name> </ProjectReference> <ProjectReference Include="..\..\..\Tango.BL\Tango.BL.csproj"> @@ -728,7 +724,7 @@ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <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> </Project>
\ No newline at end of file diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechGraphController.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechGraphController.cs index 28c75f79f..ca132095c 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechGraphController.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechGraphController.cs @@ -1,8 +1,7 @@ using RealTimeGraphX; using RealTimeGraphX.DataPoints; using RealTimeGraphX.Renderers; -using RealTimeGraphX.WPF.DataSeries; -using RealTimeGraphX.WPF.Painters; +using RealTimeGraphX.WPF; using System; using System.Collections.Generic; using System.Linq; @@ -11,19 +10,11 @@ using System.Threading.Tasks; namespace Tango.MachineStudio.Technician { - public class TechGraphController : GraphControllerBase<WpfDataSeries, TimeSpanDataPoint, DoubleDataPoint> + public class TechGraphController : WpfGraphController<TimeSpanDataPoint, DoubleDataPoint> { public TechGraphController(int refreshRate = 50) { - var renderer = new GraphScrollingRenderer<WpfDataSeries, TimeSpanDataPoint, DoubleDataPoint>() - { - RefreshRate = TimeSpan.FromMilliseconds(refreshRate) - }; - - var painter = new WpfScrollingGraphPainter(); - - ConnectOutput(renderer); - renderer.ConnectOutput(painter); + RefreshRate = TimeSpan.FromMilliseconds(50); } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs index 377738d09..1412175a0 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/MultiGraphItem.cs @@ -1,4 +1,5 @@ using RealTimeGraphX.DataPoints; +using RealTimeGraphX.WPF; using System; using System.Collections.Generic; using System.Linq; @@ -213,7 +214,7 @@ namespace Tango.MachineStudio.Technician.TechItems { if (Editor != null) { - var controller = Editor.InnerGraph.Controller; + var controller = Editor.InnerGraph.Controller as WpfGraphController<TimeSpanDataPoint,DoubleDataPoint>; controller.Range.MaximumX = new TimeSpanDataPoint(TimeSpan.FromSeconds(_duration)); controller.Range.MinimumY = new DoubleDataPoint(_min); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs index 808dadb68..8ccd5e718 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/TechItems/SingleGraphItem.cs @@ -1,4 +1,5 @@ using RealTimeGraphX.DataPoints; +using RealTimeGraphX.WPF; using System; using System.Collections.Generic; using System.Linq; @@ -217,7 +218,7 @@ namespace Tango.MachineStudio.Technician.TechItems { if (Editor != null) { - var controller = Editor.InnerGraph.Controller; + var controller = Editor.InnerGraph.Controller as WpfGraphController<TimeSpanDataPoint, DoubleDataPoint>; ; controller.Range.MaximumX = new TimeSpanDataPoint(TimeSpan.FromSeconds(_duration)); controller.Range.MinimumY = new DoubleDataPoint(_min); diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs index e78047563..72e43d7b0 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/ViewModels/MachineTechViewVM.cs @@ -1,6 +1,5 @@ using Google.Protobuf.Collections; using Microsoft.Win32; -using RealTimeGraphEx.Controllers; using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -36,9 +35,9 @@ using Tango.MachineStudio.Technician.Models; using Tango.Logging; using Microsoft.WindowsAPICodePack.Dialogs; using RealTimeGraphX; -using RealTimeGraphX.WPF.DataSeries; using RealTimeGraphX.DataPoints; using Tango.MachineStudio.Technician.Views; +using RealTimeGraphX.WPF; namespace Tango.MachineStudio.Technician.ViewModels { @@ -1024,7 +1023,7 @@ namespace Tango.MachineStudio.Technician.ViewModels var editor = element as SingleGraphElementEditor; TechGraphController controller = new TechGraphController(); - controller.AddDataSeries(new WpfDataSeries() + controller.DataSeriesCollection.Add(new WpfGraphDataSeries() { Stroke = Colors.DodgerBlue, }); @@ -1043,7 +1042,7 @@ namespace Tango.MachineStudio.Technician.ViewModels for (int i = 0; i < graphItem.TechMonitor.ChannelCount; i++) { - controller.AddDataSeries(new WpfDataSeries() + controller.DataSeriesCollection.Add(new WpfGraphDataSeries() { Stroke = ColorHelper.GetRandomColor(), Name = graphItem.TechMonitor.Name.First() + (i + 1).ToString(), @@ -1437,7 +1436,7 @@ namespace Tango.MachineStudio.Technician.ViewModels controller.Range.MaximumY = item.TechMonitor.Max; controller.Range.MaximumX = TimeSpan.FromSeconds(10); - controller.AddDataSeries(new WpfDataSeries() + controller.DataSeriesCollection.Add(new WpfGraphDataSeries() { Stroke = Colors.DodgerBlue, }); @@ -1498,7 +1497,7 @@ namespace Tango.MachineStudio.Technician.ViewModels for (int i = 0; i < item.TechMonitor.ChannelCount; i++) { - controller.AddDataSeries(new WpfDataSeries() + controller.DataSeriesCollection.Add(new WpfGraphDataSeries() { Stroke = ColorHelper.GetRandomColor(), Name = item.TechMonitor.Name.First() + (i + 1).ToString(), diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml index 92e2b292a..8820fcd4d 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml @@ -26,9 +26,9 @@ <localConverters:SecondsToTimeSpanConverter x:Key="SecondsToTimeSpanConverter" /> <DataTemplate x:Key="TabTemplate"> - <Grid> - <Grid.Style> - <Style TargetType="Grid"> + <Border IsVisibleChanged="Border_IsVisibleChanged"> + <Border.Style> + <Style TargetType="Border"> <Setter Property="Visibility" Value="Visible"></Setter> <Style.Triggers> <DataTrigger Binding="{Binding IsSelected}" Value="False"> @@ -36,12 +36,13 @@ </DataTrigger> </Style.Triggers> </Style> - </Grid.Style> - <Grid.ColumnDefinitions> - <ColumnDefinition Width="1*"/> - <ColumnDefinition Width="Auto"/> - </Grid.ColumnDefinitions> - <editors:ElementsEditor + </Border.Style> + <Grid> + <Grid.ColumnDefinitions> + <ColumnDefinition Width="1*"/> + <ColumnDefinition Width="Auto"/> + </Grid.ColumnDefinitions> + <editors:ElementsEditor x:Name="editor" Elements="{Binding Elements}" Loaded="Editor_Loaded" @@ -61,63 +62,64 @@ BorderBrush="#1EA9FF" BorderThickness="1"> - <editors:ElementsEditor.Style> - <Style TargetType="editors:ElementsEditor"> - <Setter Property="IsEditable" Value="True"></Setter> - <Style.Triggers> - <DataTrigger Binding="{Binding ElementName=listMode,Path=SelectedIndex}" Value="1"> - <Setter Property="IsEditable" Value="False"></Setter> - </DataTrigger> - </Style.Triggers> - </Style> - </editors:ElementsEditor.Style> + <editors:ElementsEditor.Style> + <Style TargetType="editors:ElementsEditor"> + <Setter Property="IsEditable" Value="True"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding ElementName=listMode,Path=SelectedIndex}" Value="1"> + <Setter Property="IsEditable" Value="False"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </editors:ElementsEditor.Style> - <editors:ElementsEditor.ContextMenu> - <ContextMenu DataContext="{Binding Path=PlacementTarget, RelativeSource={RelativeSource Self}}"> - <MenuItem Header="Cut (Ctrl+X)" Command="{Binding CutCommand}" MinWidth="210"> - <MenuItem.Icon> - <fa:ImageAwesome Icon="Cut" Width="16" /> - </MenuItem.Icon> - </MenuItem> - <MenuItem Header="Copy (Ctrl+C)" Command="{Binding CopyCommand}"> - <MenuItem.Icon> - <fa:ImageAwesome Icon="Copy" Width="16" /> - </MenuItem.Icon> - </MenuItem> - <MenuItem Header="Paste (Ctrl+V)" Command="{Binding PasteCommand}"> - <MenuItem.Icon> - <fa:ImageAwesome Icon="Paste" Width="16" /> - </MenuItem.Icon> - </MenuItem> - <Separator/> - <MenuItem Header="Undo (Ctrl+Z)" Command="{Binding UndoCommand}"> - <MenuItem.Icon> - <fa:ImageAwesome Icon="Undo" Width="16" /> - </MenuItem.Icon> - </MenuItem> - <MenuItem Header="Redo (Ctrl+Y)" Command="{Binding RedoCommand}"> - <MenuItem.Icon> - <fa:ImageAwesome Icon="RotateRight" Width="16"></fa:ImageAwesome> - </MenuItem.Icon> - </MenuItem> - <Separator/> - <MenuItem Header="Delete (DELETE)" Command="{Binding DeleteCommand}"> - <MenuItem.Icon> - <fa:ImageAwesome Icon="Recycle" Width="16" /> - </MenuItem.Icon> - </MenuItem> - <Separator/> - <MenuItem Header="Select All (Ctrl+A)" Command="{Binding SelectAllCommand}"> - <MenuItem.Icon> - <fa:ImageAwesome Icon="Th" Width="16" /> - </MenuItem.Icon> - </MenuItem> - </ContextMenu> - </editors:ElementsEditor.ContextMenu> - </editors:ElementsEditor> + <editors:ElementsEditor.ContextMenu> + <ContextMenu DataContext="{Binding Path=PlacementTarget, RelativeSource={RelativeSource Self}}"> + <MenuItem Header="Cut (Ctrl+X)" Command="{Binding CutCommand}" MinWidth="210"> + <MenuItem.Icon> + <fa:ImageAwesome Icon="Cut" Width="16" /> + </MenuItem.Icon> + </MenuItem> + <MenuItem Header="Copy (Ctrl+C)" Command="{Binding CopyCommand}"> + <MenuItem.Icon> + <fa:ImageAwesome Icon="Copy" Width="16" /> + </MenuItem.Icon> + </MenuItem> + <MenuItem Header="Paste (Ctrl+V)" Command="{Binding PasteCommand}"> + <MenuItem.Icon> + <fa:ImageAwesome Icon="Paste" Width="16" /> + </MenuItem.Icon> + </MenuItem> + <Separator/> + <MenuItem Header="Undo (Ctrl+Z)" Command="{Binding UndoCommand}"> + <MenuItem.Icon> + <fa:ImageAwesome Icon="Undo" Width="16" /> + </MenuItem.Icon> + </MenuItem> + <MenuItem Header="Redo (Ctrl+Y)" Command="{Binding RedoCommand}"> + <MenuItem.Icon> + <fa:ImageAwesome Icon="RotateRight" Width="16"></fa:ImageAwesome> + </MenuItem.Icon> + </MenuItem> + <Separator/> + <MenuItem Header="Delete (DELETE)" Command="{Binding DeleteCommand}"> + <MenuItem.Icon> + <fa:ImageAwesome Icon="Recycle" Width="16" /> + </MenuItem.Icon> + </MenuItem> + <Separator/> + <MenuItem Header="Select All (Ctrl+A)" Command="{Binding SelectAllCommand}"> + <MenuItem.Icon> + <fa:ImageAwesome Icon="Th" Width="16" /> + </MenuItem.Icon> + </MenuItem> + </ContextMenu> + </editors:ElementsEditor.ContextMenu> + </editors:ElementsEditor> - <Slider Grid.Column="1" Orientation="Vertical" Margin="5" Maximum="3" Minimum="0.2" Value="{Binding ElementName=editor,Path=ScaleFactor}"></Slider> - </Grid> + <Slider Grid.Column="1" Orientation="Vertical" Margin="5" Maximum="3" Minimum="0.2" Value="{Binding ElementName=editor,Path=ScaleFactor}"></Slider> + </Grid> + </Border> </DataTemplate> </UserControl.Resources> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml.cs index 694debd26..e4ebe2424 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml.cs @@ -23,11 +23,14 @@ namespace Tango.MachineStudio.Technician.Views public partial class MachineTechView : UserControl { private MachineTechViewVM _vm; + private Dictionary<Border, UIElement> _tabs_content; public MachineTechView() { InitializeComponent(); + _tabs_content = new Dictionary<Border, UIElement>(); + this.Loaded += (x, y) => { _vm = DataContext as MachineTechViewVM; @@ -67,5 +70,22 @@ namespace Tango.MachineStudio.Technician.Views (editor.UndoRedoStatesProvider as ElementsEditorUndoRedoStatesProvider).StateExecuted += MachineTechView_StateExecuted; } + + private void Border_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e) + { + Border border = sender as Border; + if (border.Visibility != Visibility.Visible) + { + _tabs_content[border] = border.Child; + border.Child = null; + } + else + { + if (_tabs_content.ContainsKey(border)) + { + border.Child = _tabs_content[border]; + } + } + } } } |
