diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-09-25 15:20:42 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2019-09-25 15:20:42 +0300 |
| commit | e6febb2cda232a2c89467690d9e1fbb82423618a (patch) | |
| tree | b2a6c6e2c2d8ce36e5e43b78fbe1672bf7ff7d33 /Software/Visual_Studio/MachineStudio/Modules | |
| parent | f3d5875915904417ac5dddc2e16add4d81b9e393 (diff) | |
| download | Tango-e6febb2cda232a2c89467690d9e1fbb82423618a.tar.gz Tango-e6febb2cda232a2c89467690d9e1fbb82423618a.zip | |
Implemented MultiGraph data series colors from configuration.
Added dispensers & mid-tanks diagnostics monitors.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules')
3 files changed, 96 insertions, 3 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs index c8f0b4681..2d04866d8 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Developer/ViewModels/MainViewVM.cs @@ -887,7 +887,7 @@ namespace Tango.MachineStudio.Developer.ViewModels catch { } } - if (AutoProcessSelection) + if (AutoProcessSelection && IsJobVisible && IsVisible && ActiveJob != null && ActiveJob.Segments != null && !_rml_has_no_cct && !_disable_gamut_check) { try { 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 9b9334355..6011102a2 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 @@ -34,6 +34,33 @@ <!--<Viewbox Stretch="Fill">--> <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>--> + + <Border Margin="0 0 -102 0" HorizontalAlignment="Right" Width="Auto" BorderThickness="1" Background="{StaticResource graphBackgroundDark}" CornerRadius="5" TextElement.FontSize="11" Padding="5"> + <ItemsControl ItemsSource="{Binding ElementName=InnerGraph,Path=Controller.DataSeriesCollection}"> + <ItemsControl.ItemTemplate> + <DataTemplate> + <ToggleButton IsChecked="{Binding IsVisible}" Cursor="Hand"> + <ToggleButton.Template> + <ControlTemplate> + <StackPanel Orientation="Horizontal" Margin="0 2" Background="Transparent"> + <Ellipse Width="10" Height="10" Visibility="{Binding IsVisible,Converter={StaticResource BoolToVisibilityConverter}}"> + <Ellipse.Fill> + <SolidColorBrush Color="{Binding Stroke}" /> + </Ellipse.Fill> + </Ellipse> + <TextBlock Margin="5 0 0 0" Text="{Binding Name}"> + <TextBlock.Foreground> + <SolidColorBrush Color="{Binding Stroke}" /> + </TextBlock.Foreground> + </TextBlock> + </StackPanel> + </ControlTemplate> + </ToggleButton.Template> + </ToggleButton> + </DataTemplate> + </ItemsControl.ItemTemplate> + </ItemsControl> + </Border> </Grid> <!--Content--> 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 8eb792f0d..f6b8a35df 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 @@ -39,6 +39,8 @@ using RealTimeGraphX.DataPoints; using Tango.MachineStudio.Technician.Views; using RealTimeGraphX.WPF; using Tango.Core.ExtensionMethods; +using System.Diagnostics; +using Tango.BL.Builders; namespace Tango.MachineStudio.Technician.ViewModels { @@ -49,6 +51,13 @@ namespace Tango.MachineStudio.Technician.ViewModels /// <seealso cref="Tango.MachineStudio.Common.StudioApplication.IShutdownListener" /> public class MachineTechViewVM : StudioViewModel { + private class PackColor + { + public int Index { get; set; } + public Color Color { get; set; } + public String Name { get; set; } + } + private List<PropertyInfo> _diagnoticsMonitorsDataProperties; private IDiagnosticsFrameProvider _diagnosticsFrameProvider; private Dictionary<SingleGraphItem, TechGraphController> _singleControllers; @@ -68,6 +77,8 @@ namespace Tango.MachineStudio.Technician.ViewModels private DateTime _start_time = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0); private DateTime _last_time = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 0, 0, 0); + private Machine _machine; + private List<PackColor> _packsColors; #region Properties @@ -374,7 +385,7 @@ namespace Tango.MachineStudio.Technician.ViewModels /// </summary> /// <param name="sender">The sender.</param> /// <param name="machine">The machine.</param> - private void ApplicationManager_ConnectedMachineChanged(object sender, IExternalBridgeClient machine) + private async void ApplicationManager_ConnectedMachineChanged(object sender, IExternalBridgeClient machine) { MachineOperator = machine; @@ -384,6 +395,45 @@ namespace Tango.MachineStudio.Technician.ViewModels } ClearAllGraphs(); + + if (machine != null) + { + try + { + using (ObservablesContext db = ObservablesContext.CreateDefault()) + { + _machine = await new MachineBuilder(db).Set(machine.Machine.Guid).WithConfiguration().BuildAsync(); + + _packsColors = new List<PackColor>(); + + foreach (var pack in _machine.Configuration.NoneEmptyIdsPacks.OrderBy(x => x.PackIndex).ToList()) + { + PackColor pc = new PackColor(); + pc.Index = pack.PackIndex; + pc.Name = pack.LiquidType.Name; + + if (pack.LiquidType.LiquidTypeColor == Colors.Black) + { + pc.Color = Colors.Gray; + } + else if (pack.LiquidType.LiquidTypeColor == Colors.Transparent) + { + pc.Color = Colors.White; + } + else + { + pc.Color = pack.LiquidType.LiquidTypeColor; + } + + _packsColors.Add(pc); + } + } + } + catch (Exception ex) + { + LogManager.Log(ex, LogCategory.Warning, "Error loading the connected machine details from db."); + } + } } /// <summary> @@ -543,6 +593,22 @@ namespace Tango.MachineStudio.Technician.ViewModels timesMat.Add(times); } + try + { + if (_packsColors != null) + { + foreach (var pack in _packsColors) + { + controller.DataSeriesCollection[pack.Index].Stroke = pack.Color; + controller.DataSeriesCollection[pack.Index].Name = pack.Name; + } + } + } + catch (Exception ex) + { + Debug.WriteLine($"Error assigning multi graph colors.\n{ex.ToString()}"); + } + controller.PushData(timesMat, dPoints); } @@ -2490,4 +2556,4 @@ namespace Tango.MachineStudio.Technician.ViewModels #endregion } -} +}
\ No newline at end of file |
