diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-12-28 04:00:29 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2020-12-28 04:00:29 +0200 |
| commit | 29241b674e6e747ce64e521446e87596eb66dedd (patch) | |
| tree | 5169b73b62cff50146ca3f110818787b48bcd387 /Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings | |
| parent | 1cb99b7e98491a9064eb4c87b89991b5301528c1 (diff) | |
| download | Tango-29241b674e6e747ce64e521446e87596eb66dedd.tar.gz Tango-29241b674e6e747ce64e521446e87596eb66dedd.zip | |
Implemented lubrication level control per RML for PPC user.
Diffstat (limited to 'Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings')
| -rw-r--r-- | Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs | 64 | ||||
| -rw-r--r-- | Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml | 48 |
2 files changed, 110 insertions, 2 deletions
diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs index 20cfd6bf4..f4bbf6da3 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/ViewModels/MainViewVM.cs @@ -18,6 +18,7 @@ using Tango.Core.ExtensionMethods; using Tango.PPC.Common; using Tango.PPC.Common.Connection; using Tango.PPC.Common.ExternalBridge; +using Tango.PPC.Common.Lubrication; using Tango.PPC.Common.Messages; using Tango.PPC.Common.OS; using Tango.PPC.Common.UWF; @@ -35,6 +36,36 @@ namespace Tango.PPC.MachineSettings.ViewModels private TimeZoneInfo _previousTimeZone; private bool _previousEnableUWF; + #region Classes + + public class RmlLubricationLevelSettings : RmlLubricationLevel + { + public String Name { get; set; } + + public RmlLubricationLevelSettings() + { + + } + + public RmlLubricationLevelSettings(RmlLubricationLevel rmlLevel, String name) + { + RmlGuid = rmlLevel.RmlGuid; + LubricationLevel = rmlLevel.LubricationLevel; + Name = name; + } + + public RmlLubricationLevel ToRmlLubricationLevel() + { + return new RmlLubricationLevel() + { + RmlGuid = RmlGuid, + LubricationLevel = LubricationLevel, + }; + } + } + + #endregion + #region Properties [TangoInject] @@ -189,6 +220,12 @@ namespace Tango.PPC.MachineSettings.ViewModels set { _enableUWF = value; RaisePropertyChangedAuto(); } } + private List<RmlLubricationLevelSettings> _lubricationLevels; + public List<RmlLubricationLevelSettings> LubricationLevels + { + get { return _lubricationLevels; } + set { _lubricationLevels = value; RaisePropertyChangedAuto(); } + } #endregion @@ -213,6 +250,7 @@ namespace Tango.PPC.MachineSettings.ViewModels public MainViewVM() { + LubricationLevels = new List<RmlLubricationLevelSettings>(); SaveCommand = new RelayCommand(Save); DiscardCommand = new RelayCommand(Discard); SynchronizeCommand = new RelayCommand(Synchronize, () => !MachineDataSynchronizer.IsSynchronizing && IsFree); @@ -243,6 +281,7 @@ namespace Tango.PPC.MachineSettings.ViewModels Settings.SynchronizeJobs = SynchronizeJobs; Settings.SynchronizeDiagnostics = SynchronizeDiagnostics; Settings.AutoCheckForUpdates = AutoCheckForUpdates; + Settings.LubricationLevels = LubricationLevels.Where(x => x.LubricationLevel != LubricationLevel.Standard).Select(x => x.ToRmlLubricationLevel()).ToList(); MachineDataSynchronizer.IsEnabled = SynchronizeJobs || SynchronizeDiagnostics; @@ -368,7 +407,7 @@ namespace Tango.PPC.MachineSettings.ViewModels SelectedJobTypes = new SelectedObjectCollection<JobTypes>(Enum.GetValues(typeof(JobTypes)).Cast<JobTypes>().ToObservableCollection(), Settings.SupportedJobTypes.ToObservableCollection()); SelectedColorSpaces = new SelectedObjectCollection<ColorSpaces>(Enum.GetValues(typeof(ColorSpaces)).Cast<ColorSpaces>().Where(x => x.IsUserSpace()).ToObservableCollection(), Settings.SupportedColorSpaces.ToObservableCollection()); - DefaultRML = Adapter.Rmls.SingleOrDefault(x => x.Guid == Settings.DefaultRmlGuid); + DefaultRML = Rmls.SingleOrDefault(x => x.Guid == Settings.DefaultRmlGuid); DefaultSpoolType = Adapter.SpoolTypes.SingleOrDefault(x => x.Guid == Settings.DefaultSpoolTypeGuid); SynchronizeJobs = Settings.SynchronizeJobs; @@ -388,6 +427,29 @@ namespace Tango.PPC.MachineSettings.ViewModels { LogManager.Log(ex, "Error getting UWF status."); } + + try + { + List<RmlLubricationLevelSettings> levels = new List<RmlLubricationLevelSettings>(); + + foreach (var rml in Rmls) + { + RmlLubricationLevel userLevel = Settings.LubricationLevels.FirstOrDefault(x => x.RmlGuid == rml.Guid); + + RmlLubricationLevelSettings rmlLevel = new RmlLubricationLevelSettings(); + rmlLevel.RmlGuid = rml.Guid; + rmlLevel.Name = rml.Name; + rmlLevel.LubricationLevel = userLevel != null ? userLevel.LubricationLevel : LubricationLevel.Standard; + + levels.Add(rmlLevel); + } + + LubricationLevels = levels; + } + catch (Exception ex) + { + LogManager.Log(ex, "Error loading lubrication levels."); + } } private async void OnEnableRemoteAssistanceChanged() diff --git a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml index ba3516be4..baaa4384e 100644 --- a/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml +++ b/Software/Visual_Studio/PPC/Modules/Tango.PPC.MachineSettings/Views/MainView.xaml @@ -6,17 +6,28 @@ xmlns:enumerations="clr-namespace:Tango.BL.Enumerations;assembly=Tango.BL" xmlns:touch="clr-namespace:Tango.Touch.Controls;assembly=Tango.Touch" xmlns:keyboard="clr-namespace:Tango.Touch.Keyboard;assembly=Tango.Touch" - xmlns:sys="clr-namespace:System.Collections;assembly=mscorlib" + xmlns:sys="clr-namespace:System;assembly=mscorlib" xmlns:controls="clr-namespace:Tango.SharedUI.Controls;assembly=Tango.SharedUI" xmlns:vm="clr-namespace:Tango.PPC.MachineSettings.ViewModels" xmlns:connectivity="clr-namespace:Tango.PPC.Common.Connectivity;assembly=Tango.PPC.Common" xmlns:adapters="clr-namespace:Tango.Transport.Adapters;assembly=Tango.Transport" xmlns:global="clr-namespace:Tango.PPC.MachineSettings" xmlns:integrationPMR="clr-namespace:Tango.PMR.Integration;assembly=Tango.PMR" + xmlns:lubrication="clr-namespace:Tango.PPC.Common.Lubrication;assembly=Tango.PPC.Common" xmlns:local="clr-namespace:Tango.PPC.MachineSettings.Views" mc:Ignorable="d" d:DesignHeight="4500" d:DesignWidth="800" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}"> + <UserControl.Resources> + <ObjectDataProvider x:Key="lubricationLevels" MethodName="GetValues" + ObjectType="{x:Type sys:Enum}"> + <ObjectDataProvider.MethodParameters> + <x:Type TypeName="lubrication:LubricationLevel"/> + </ObjectDataProvider.MethodParameters> + </ObjectDataProvider> + </UserControl.Resources> + + <Grid Background="{StaticResource TangoMidBackgroundBrush}" IsEnabled="{Binding IsFree}"> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> @@ -160,6 +171,41 @@ </StackPanel> </touch:TouchExpander> + <!--LUBRICATION--> + <touch:TouchExpander Margin="0 20 0 0" Header="Lubrication Levels" IsExpanded="True" FontSize="{StaticResource TangoExpanderHeaderFontSize}"> + <StackPanel Margin="0 0 10 0"> + <StackPanel Margin="0 40 0 0"> + <TextBlock FontSize="{StaticResource TangoSmallFontSize}" Foreground="{StaticResource TangoGrayTextBrush}">Thread Type</TextBlock> + <touch:TouchComboBox x:Name="lubricationCombo" Margin="0 5 0 0" ItemsSource="{Binding LubricationLevels}" DisplayMemberPath="Name"></touch:TouchComboBox> + </StackPanel> + + <StackPanel Margin="0 20 0 0"> + <TextBlock Foreground="{StaticResource TangoGrayTextBrush}" FontSize="{StaticResource TangoSmallFontSize}" HorizontalAlignment="Center">Level</TextBlock> + <ListBox Margin="0 10 0 0" FontSize="{StaticResource TangoSmallFontSize}" ItemsSource="{Binding Source={StaticResource lubricationLevels}}" SelectedItem="{Binding ElementName=lubricationCombo,Path=SelectedItem.LubricationLevel}" Style="{StaticResource BlankListBox}"> + <ListBox.ItemsPanel> + <ItemsPanelTemplate> + <UniformGrid Columns="5" /> + </ItemsPanelTemplate> + </ListBox.ItemsPanel> + <ListBox.ItemContainerStyle> + <Style TargetType="ListBoxItem" BasedOn="{StaticResource BlankListBoxItem}"> + <Setter Property="ContentTemplate"> + <Setter.Value> + <DataTemplate> + <StackPanel Background="Transparent"> + <touch:TouchRadioButton HorizontalAlignment="Center" Margin="0 0 -8 0" IsChecked="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected}"></touch:TouchRadioButton> + <TextBlock Text="{Binding Converter={StaticResource EnumToDescriptionConverter}}" Margin="0 5 0 0" HorizontalAlignment="Center"></TextBlock> + </StackPanel> + </DataTemplate> + </Setter.Value> + </Setter> + </Style> + </ListBox.ItemContainerStyle> + </ListBox> + </StackPanel> + </StackPanel> + </touch:TouchExpander> + <!--REMOTE ASSISTANCE--> <touch:TouchExpander Margin="0 20 0 0" Header="Remote Assistance" IsExpanded="True" FontSize="{StaticResource TangoExpanderHeaderFontSize}"> <StackPanel> |
