diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-06-04 18:54:32 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-06-04 18:54:32 +0300 |
| commit | df9cd86ffccb0bd477ab7deb9d22c3bc0f908257 (patch) | |
| tree | c51cf0b7a56401a3df13f5e3b9c5b923a0d88a5b | |
| parent | 583c1a2cf5cb065e3f17c1bfe0f4464b82e0ee4e (diff) | |
| download | Tango-df9cd86ffccb0bd477ab7deb9d22c3bc0f908257.tar.gz Tango-df9cd86ffccb0bd477ab7deb9d22c3bc0f908257.zip | |
Added USB baud rate to integration settings.
Implemented copy params/clone on hardware versions module.
4 files changed, 306 insertions, 69 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs index 305d7a37f..f91badebe 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/ViewModels/MainViewVM.cs @@ -10,6 +10,7 @@ using Tango.MachineStudio.Common.Notifications; using Tango.SharedUI; using Tango.BL; using Tango.SharedUI.Components; +using System.Runtime.CompilerServices; namespace Tango.MachineStudio.HardwareDesigner.ViewModels { @@ -142,17 +143,53 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels public RelayCommand NewCommand { get; set; } + public RelayCommand CloneCommand { get; set; } + + public RelayCommand CopyParametersCommand { get; set; } + public MainViewVM(INotificationProvider notification) { _notification = notification; Adapter = ObservablesEntitiesAdapter.Instance; - SaveCommand = new RelayCommand(Save, () => CurrentVersion != null); + SaveCommand = new RelayCommand(Save, () => SelectedVersion != null); NewCommand = new RelayCommand(New); - DeleteCommand = new RelayCommand(Delete, () => !_isNew && CurrentVersion != null); + DeleteCommand = new RelayCommand(Delete, () => !_isNew && SelectedVersion != null); CurrentVersion = new HardwareVersion(); CreateTemplate(CurrentVersion); + + CopyParametersCommand = new RelayCommand(CopyParameters,(x) => SelectedVersion != null && SelectedHardwareObjectType != null); + CloneCommand = new RelayCommand(CloneCurrentVersion, () => SelectedVersion != null); + } + + private void CopyParameters(object obj) + { + IObservableEntity source = obj.GetType().GetProperty("Data").GetValue(obj) as IObservableEntity; + IObservableEntity target = null; + + if (source is HardwareMotorType) + { + target = CurrentVersion.HardwareMotors.SingleOrDefault(x => x.HardwareMotorType == source); + } + else if (source is HardwareDancerType) + { + target = CurrentVersion.HardwareDancers.SingleOrDefault(x => x.HardwareDancerType == source); + } + else if (source is HardwarePidControlType) + { + target = CurrentVersion.HardwarePidControls.SingleOrDefault(x => x.HardwarePidControlType == source); + } + else if (source is HardwareWinderType) + { + target = CurrentVersion.HardwareWinders.SingleOrDefault(x => x.HardwareWinderType == source); + } + else if (source is HardwareSpeedSensorType) + { + target = CurrentVersion.HardwareSpeedSensors.SingleOrDefault(x => x.HardwareSpeedSensorType == source); + } + + target.MapPrimitivesTo(SelectedHardwareObject); } private void OnSelectedHardwareObjectTypeChanged() @@ -452,6 +489,50 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels } } + private async void CloneCurrentVersion() + { + if (CurrentVersion != null) + { + String name = _notification.ShowTextInput("Enter new hardware configuration name", "Name", CurrentVersion.Name + " - Copy"); + + if (!String.IsNullOrWhiteSpace(name)) + { + using (_notification.PushTaskItem("Cloning hardware configuration...")) + { + await Task.Factory.StartNew(() => + { + var realVersion = CurrentVersion.Clone(); + realVersion.Name = name; + realVersion.Version = 1; + + realVersion.HardwareMotors.ToList().Where(x => !SelectedMotorTypes.Contains(x.HardwareMotorType)).ToList().ForEach(x => realVersion.HardwareMotors.Remove(x)); + realVersion.HardwareDancers.ToList().Where(x => !SelectedDancerTypes.Contains(x.HardwareDancerType)).ToList().ForEach(x => realVersion.HardwareDancers.Remove(x)); + realVersion.HardwarePidControls.ToList().Where(x => !SelectedPidControlTypes.Contains(x.HardwarePidControlType)).ToList().ForEach(x => realVersion.HardwarePidControls.Remove(x)); + realVersion.HardwareWinders.ToList().Where(x => !SelectedWinderTypes.Contains(x.HardwareWinderType)).ToList().ForEach(x => realVersion.HardwareWinders.Remove(x)); + realVersion.HardwareSpeedSensors.ToList().Where(x => !SelectedSpeedSensorTypes.Contains(x.HardwareSpeedSensorType)).ToList().ForEach(x => realVersion.HardwareSpeedSensors.Remove(x)); + + realVersion.HardwareMotors.ToList().ForEach(x => x.HardwareVersionGuid = realVersion.Guid); + realVersion.HardwareDancers.ToList().ForEach(x => x.HardwareVersionGuid = realVersion.Guid); + realVersion.HardwarePidControls.ToList().ForEach(x => x.HardwareVersionGuid = realVersion.Guid); + realVersion.HardwareWinders.ToList().ForEach(x => x.HardwareVersionGuid = realVersion.Guid); + realVersion.HardwareSpeedSensors.ToList().ForEach(x => x.HardwareVersionGuid = realVersion.Guid); + + realVersion.HardwareMotors.ToList().ForEach(x => x.HardwareVersion = realVersion); + realVersion.HardwareDancers.ToList().ForEach(x => x.HardwareVersion = realVersion); + realVersion.HardwarePidControls.ToList().ForEach(x => x.HardwareVersion = realVersion); + realVersion.HardwareWinders.ToList().ForEach(x => x.HardwareVersion = realVersion); + realVersion.HardwareSpeedSensors.ToList().ForEach(x => x.HardwareVersion = realVersion); + + Adapter.Context.HardwareVersions.Add(realVersion); + realVersion.Save(Adapter.Context); + + SelectedVersion = Adapter.HardwareVersions.SingleOrDefault(x => x.Guid == realVersion.Guid); + }); + } + } + } + } + private void Delete() { if (_notification.ShowQuestion("Are you sure you want to delete this hardware version?")) @@ -464,5 +545,11 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels } } } + + protected override void RaisePropertyChangedAuto([CallerMemberName] string caller = null) + { + base.RaisePropertyChangedAuto(caller); + InvalidateRelayCommands(); + } } } diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/MainView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/MainView.xaml index 361ea79b7..e22b0e71a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/MainView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/MainView.xaml @@ -19,6 +19,22 @@ <UserControl.Resources> <converters:DoubleToIntConverter x:Key="DoubleToIntConverter" /> <converters:NullObjectToBooleanConverter x:Key="NullObjectToBooleanConverter" /> + + <Style TargetType="ListBox" x:Key="typesList" BasedOn="{StaticResource {x:Type ListBox}}"> + <Setter Property="FontSize" Value="14"></Setter> + <Setter Property="ItemContainerStyle"> + <Setter.Value> + <Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}"> + <Setter Property="FontWeight" Value="Normal"></Setter> + <Style.Triggers> + <Trigger Property="IsSelected" Value="True"> + <Setter Property="FontWeight" Value="Bold"></Setter> + </Trigger> + </Style.Triggers> + </Style> + </Setter.Value> + </Setter> + </Style> </UserControl.Resources> <Grid> @@ -62,13 +78,36 @@ <Image VerticalAlignment="Center" Source="../Images/engine.png" Width="32"></Image> <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" FontSize="18" FontWeight="SemiBold">MOTORS</TextBlock> </StackPanel> - <ListBox ItemsSource="{Binding MotorTypes}" Margin="60 15" SelectedItem="{Binding SelectedHardwareObjectType}"> + <ListBox Style="{StaticResource typesList}" HorizontalContentAlignment="Stretch" ItemsSource="{Binding MotorTypes}" Margin="60 15" SelectedItem="{Binding SelectedHardwareObjectType}"> <ListBox.ItemTemplate> <DataTemplate DataType="{x:Type entities:HardwareMotorType}"> - <StackPanel Orientation="Horizontal"> - <CheckBox VerticalAlignment="Center" IsChecked="{Binding IsSelected}"></CheckBox> - <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding Data.Description}"></TextBlock> - </StackPanel> + <DockPanel> + <Button DockPanel.Dock="Right" Cursor="Hand" Foreground="DimGray" Height="20" FontSize="10" ToolTip="Copy this item parameters to the selected item" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.CopyParametersCommand}" CommandParameter="{Binding}"> + <Button.Style> + <Style TargetType="Button" BasedOn="{StaticResource MaterialDesignFlatButton}"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.SelectedHardwareObjectType.Data.ObjectType.BaseType}" Value="{x:Type entities:HardwareMotorType}"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected}" Value="True"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Button.Style> + <Button.Content> + <StackPanel Orientation="Horizontal"> + <TextBlock VerticalAlignment="Center">Copy Parameters</TextBlock> + <materialDesign:PackIcon Margin="10 0 0 0" VerticalAlignment="Center" Kind="ArrowRight" Width="16" Height="16" /> + </StackPanel> + </Button.Content> + </Button> + <StackPanel Orientation="Horizontal"> + <CheckBox VerticalAlignment="Center" IsChecked="{Binding IsSelected}"></CheckBox> + <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding Data.Description}"></TextBlock> + </StackPanel> + </DockPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> @@ -77,13 +116,36 @@ <Image VerticalAlignment="Center" Source="../Images/compass.png" Width="32"></Image> <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" FontSize="18" FontWeight="SemiBold">DANCERS</TextBlock> </StackPanel> - <ListBox ItemsSource="{Binding DancerTypes}" Margin="60 15" SelectedItem="{Binding SelectedHardwareObjectType}"> + <ListBox Style="{StaticResource typesList}" HorizontalContentAlignment="Stretch" ItemsSource="{Binding DancerTypes}" Margin="60 15" SelectedItem="{Binding SelectedHardwareObjectType}"> <ListBox.ItemTemplate> <DataTemplate DataType="{x:Type entities:HardwareDancerType}"> - <StackPanel Orientation="Horizontal"> - <CheckBox VerticalAlignment="Center" IsChecked="{Binding IsSelected}"></CheckBox> - <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding Data.Description}"></TextBlock> - </StackPanel> + <DockPanel> + <Button DockPanel.Dock="Right" Cursor="Hand" Foreground="DimGray" Height="20" FontSize="10" ToolTip="Copy this item parameters to the selected item" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.CopyParametersCommand}" CommandParameter="{Binding}"> + <Button.Style> + <Style TargetType="Button" BasedOn="{StaticResource MaterialDesignFlatButton}"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.SelectedHardwareObjectType.Data.ObjectType.BaseType}" Value="{x:Type entities:HardwareDancerType}"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected}" Value="True"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Button.Style> + <Button.Content> + <StackPanel Orientation="Horizontal"> + <TextBlock VerticalAlignment="Center">Copy Parameters</TextBlock> + <materialDesign:PackIcon Margin="10 0 0 0" VerticalAlignment="Center" Kind="ArrowRight" Width="16" Height="16" /> + </StackPanel> + </Button.Content> + </Button> + <StackPanel Orientation="Horizontal"> + <CheckBox VerticalAlignment="Center" IsChecked="{Binding IsSelected}"></CheckBox> + <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding Data.Description}"></TextBlock> + </StackPanel> + </DockPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> @@ -92,13 +154,36 @@ <Image VerticalAlignment="Center" Source="../Images/balance.png" Width="32"></Image> <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" FontSize="18" FontWeight="SemiBold">PID CONTROLS</TextBlock> </StackPanel> - <ListBox ItemsSource="{Binding PidControlTypes}" Margin="60 15" SelectedItem="{Binding SelectedHardwareObjectType}"> + <ListBox Style="{StaticResource typesList}" HorizontalContentAlignment="Stretch" ItemsSource="{Binding PidControlTypes}" Margin="60 15" SelectedItem="{Binding SelectedHardwareObjectType}"> <ListBox.ItemTemplate> <DataTemplate DataType="{x:Type entities:HardwarePidControlType}"> - <StackPanel Orientation="Horizontal"> - <CheckBox VerticalAlignment="Center" IsChecked="{Binding IsSelected}"></CheckBox> - <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding Data.Description}"></TextBlock> - </StackPanel> + <DockPanel> + <Button DockPanel.Dock="Right" Cursor="Hand" Foreground="DimGray" Height="20" FontSize="10" ToolTip="Copy this item parameters to the selected item" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.CopyParametersCommand}" CommandParameter="{Binding}"> + <Button.Style> + <Style TargetType="Button" BasedOn="{StaticResource MaterialDesignFlatButton}"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.SelectedHardwareObjectType.Data.ObjectType.BaseType}" Value="{x:Type entities:HardwarePidControlType}"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected}" Value="True"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Button.Style> + <Button.Content> + <StackPanel Orientation="Horizontal"> + <TextBlock VerticalAlignment="Center">Copy Parameters</TextBlock> + <materialDesign:PackIcon Margin="10 0 0 0" VerticalAlignment="Center" Kind="ArrowRight" Width="16" Height="16" /> + </StackPanel> + </Button.Content> + </Button> + <StackPanel Orientation="Horizontal"> + <CheckBox VerticalAlignment="Center" IsChecked="{Binding IsSelected}"></CheckBox> + <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding Data.Description}"></TextBlock> + </StackPanel> + </DockPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> @@ -107,32 +192,78 @@ <Image VerticalAlignment="Center" Source="../Images/thread.png" Width="32"></Image> <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" FontSize="18" FontWeight="SemiBold">WINDERS</TextBlock> </StackPanel> - <ListBox ItemsSource="{Binding WinderTypes}" Margin="60 15" SelectedItem="{Binding SelectedHardwareObjectType}"> + <ListBox Style="{StaticResource typesList}" HorizontalContentAlignment="Stretch" ItemsSource="{Binding WinderTypes}" Margin="60 15" SelectedItem="{Binding SelectedHardwareObjectType}"> <ListBox.ItemTemplate> <DataTemplate DataType="{x:Type entities:HardwareWinderType}"> - <StackPanel Orientation="Horizontal"> - <CheckBox VerticalAlignment="Center" IsChecked="{Binding IsSelected}"></CheckBox> - <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding Data.Description}"></TextBlock> - </StackPanel> + <DockPanel> + <Button DockPanel.Dock="Right" Cursor="Hand" Foreground="DimGray" Height="20" FontSize="10" ToolTip="Copy this item parameters to the selected item" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.CopyParametersCommand}" CommandParameter="{Binding}"> + <Button.Style> + <Style TargetType="Button" BasedOn="{StaticResource MaterialDesignFlatButton}"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.SelectedHardwareObjectType.Data.ObjectType.BaseType}" Value="{x:Type entities:HardwareWinderType}"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected}" Value="True"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Button.Style> + <Button.Content> + <StackPanel Orientation="Horizontal"> + <TextBlock VerticalAlignment="Center">Copy Parameters</TextBlock> + <materialDesign:PackIcon Margin="10 0 0 0" VerticalAlignment="Center" Kind="ArrowRight" Width="16" Height="16" /> + </StackPanel> + </Button.Content> + </Button> + <StackPanel Orientation="Horizontal"> + <CheckBox VerticalAlignment="Center" IsChecked="{Binding IsSelected}"></CheckBox> + <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding Data.Description}"></TextBlock> + </StackPanel> + </DockPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> - <StackPanel Orientation="Horizontal" Margin="0 20 0 0"> - <Image VerticalAlignment="Center" Source="../Images/speed.png" Width="32"></Image> - <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" FontSize="18" FontWeight="SemiBold">SPEED SENSORS</TextBlock> - </StackPanel> - <ListBox ItemsSource="{Binding SpeedSensorTypes}" Margin="60 15" SelectedItem="{Binding SelectedHardwareObjectType}"> - <ListBox.ItemTemplate> - <DataTemplate DataType="{x:Type entities:HardwareSpeedSensorType}"> - <StackPanel Orientation="Horizontal"> - <CheckBox VerticalAlignment="Center" IsChecked="{Binding IsSelected}"></CheckBox> - <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding Data.Description}"></TextBlock> - </StackPanel> - </DataTemplate> - </ListBox.ItemTemplate> - </ListBox> - </StackPanel> + <StackPanel Orientation="Horizontal" Margin="0 20 0 0"> + <Image VerticalAlignment="Center" Source="../Images/speed.png" Width="32"></Image> + <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" FontSize="18" FontWeight="SemiBold">SPEED SENSORS</TextBlock> + </StackPanel> + <ListBox Style="{StaticResource typesList}" HorizontalContentAlignment="Stretch" ItemsSource="{Binding SpeedSensorTypes}" Margin="60 15" SelectedItem="{Binding SelectedHardwareObjectType}"> + <ListBox.ItemTemplate> + <DataTemplate DataType="{x:Type entities:HardwareSpeedSensorType}"> + <DockPanel> + <Button DockPanel.Dock="Right" Cursor="Hand" Foreground="DimGray" Height="20" FontSize="10" ToolTip="Copy this item parameters to the selected item" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.CopyParametersCommand}" CommandParameter="{Binding}"> + <Button.Style> + <Style TargetType="Button" BasedOn="{StaticResource MaterialDesignFlatButton}"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DataContext.SelectedHardwareObjectType.Data.ObjectType.BaseType}" Value="{x:Type entities:HardwareSpeedSensorType}"> + <Setter Property="Visibility" Value="Visible"></Setter> + </DataTrigger> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected}" Value="True"> + <Setter Property="Visibility" Value="Collapsed"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Button.Style> + <Button.Content> + <StackPanel Orientation="Horizontal"> + <TextBlock VerticalAlignment="Center">Copy Parameters</TextBlock> + <materialDesign:PackIcon Margin="10 0 0 0" VerticalAlignment="Center" Kind="ArrowRight" Width="16" Height="16" /> + </StackPanel> + </Button.Content> + </Button> + <StackPanel Orientation="Horizontal"> + <CheckBox VerticalAlignment="Center" IsChecked="{Binding IsSelected}"></CheckBox> + <TextBlock Margin="10 0 0 0" VerticalAlignment="Center" Text="{Binding Data.Description}"></TextBlock> + </StackPanel> + </DockPanel> + </DataTemplate> + </ListBox.ItemTemplate> + </ListBox> + </StackPanel> </ScrollViewer> </Grid> @@ -165,37 +296,39 @@ <StackPanel> <Grid> <Expander HorizontalAlignment="Stretch" Header="Component Properties" IsExpanded="True"> - <editors:ParameterizedEditor ParameterizedObject="{Binding SelectedHardwareObject}" Padding="10"> - <editors:ParameterizedEditor.ItemsPanel> - <ItemsPanelTemplate> - <StackPanel></StackPanel> - </ItemsPanelTemplate> - </editors:ParameterizedEditor.ItemsPanel> - <editors:ParameterizedEditor.DoubleTemplate> - <DataTemplate> - <DockPanel> - <mahApps:NumericUpDown DockPanel.Dock="Right" Background="Transparent" BorderThickness="0 0 0 0" Value="{Binding Value,UpdateSourceTrigger=PropertyChanged}" HasDecimals="True" HorizontalContentAlignment="Center" Width="100" /> - <TextBlock Text="{Binding Name}" VerticalAlignment="Center"></TextBlock> - </DockPanel> - </DataTemplate> - </editors:ParameterizedEditor.DoubleTemplate> - <editors:ParameterizedEditor.Int32Template> - <DataTemplate> - <DockPanel> - <mahApps:NumericUpDown DockPanel.Dock="Right" Background="Transparent" BorderThickness="0 0 0 0" Value="{Binding Value,Converter={StaticResource DoubleToIntConverter},UpdateSourceTrigger=PropertyChanged}" HasDecimals="False" HorizontalContentAlignment="Center" Width="100" /> - <TextBlock Text="{Binding Name}" VerticalAlignment="Center"></TextBlock> - </DockPanel> - </DataTemplate> - </editors:ParameterizedEditor.Int32Template> - <editors:ParameterizedEditor.BooleanTemplate> - <DataTemplate> - <DockPanel Margin="0 5 0 0"> - <ToggleButton DockPanel.Dock="Right" Width="100" IsChecked="{Binding Value}" HorizontalAlignment="Right" /> - <TextBlock Text="{Binding Name}" VerticalAlignment="Center"></TextBlock> - </DockPanel> - </DataTemplate> - </editors:ParameterizedEditor.BooleanTemplate> - </editors:ParameterizedEditor> + <StackPanel> + <editors:ParameterizedEditor ParameterizedObject="{Binding SelectedHardwareObject}" Padding="10"> + <editors:ParameterizedEditor.ItemsPanel> + <ItemsPanelTemplate> + <StackPanel></StackPanel> + </ItemsPanelTemplate> + </editors:ParameterizedEditor.ItemsPanel> + <editors:ParameterizedEditor.DoubleTemplate> + <DataTemplate> + <DockPanel> + <mahApps:NumericUpDown DockPanel.Dock="Right" Background="Transparent" BorderThickness="0 0 0 0" Value="{Binding Value,UpdateSourceTrigger=PropertyChanged}" HasDecimals="True" HorizontalContentAlignment="Center" Width="100" /> + <TextBlock Text="{Binding Name}" VerticalAlignment="Center"></TextBlock> + </DockPanel> + </DataTemplate> + </editors:ParameterizedEditor.DoubleTemplate> + <editors:ParameterizedEditor.Int32Template> + <DataTemplate> + <DockPanel> + <mahApps:NumericUpDown DockPanel.Dock="Right" Background="Transparent" BorderThickness="0 0 0 0" Value="{Binding Value,Converter={StaticResource DoubleToIntConverter},UpdateSourceTrigger=PropertyChanged}" HasDecimals="False" HorizontalContentAlignment="Center" Width="100" /> + <TextBlock Text="{Binding Name}" VerticalAlignment="Center"></TextBlock> + </DockPanel> + </DataTemplate> + </editors:ParameterizedEditor.Int32Template> + <editors:ParameterizedEditor.BooleanTemplate> + <DataTemplate> + <DockPanel Margin="0 5 0 0"> + <ToggleButton DockPanel.Dock="Right" Width="100" IsChecked="{Binding Value}" HorizontalAlignment="Right" /> + <TextBlock Text="{Binding Name}" VerticalAlignment="Center"></TextBlock> + </DockPanel> + </DataTemplate> + </editors:ParameterizedEditor.BooleanTemplate> + </editors:ParameterizedEditor> + </StackPanel> </Expander> </Grid> </StackPanel> @@ -218,6 +351,12 @@ <TextBlock FontSize="14" Margin="10 0 0 0" VerticalAlignment="Center">NEW</TextBlock> </StackPanel> </Button> + <Button Height="Auto" Grid.Column="1" Command="{Binding CloneCommand}" Margin="2" Background="#FF9A6A" BorderBrush="#FF9A6A"> + <StackPanel Orientation="Horizontal"> + <materialDesign:PackIcon Width="20" Height="20" VerticalAlignment="Center" Kind="ContentCopy"></materialDesign:PackIcon> + <TextBlock FontSize="14" Margin="10 0 0 0" VerticalAlignment="Center">CLONE</TextBlock> + </StackPanel> + </Button> <Button Height="Auto" Command="{Binding SaveCommand}" Margin="2"> <StackPanel Orientation="Horizontal"> <materialDesign:PackIcon Width="20" Height="20" VerticalAlignment="Center" Kind="ContentSaveSettings"></materialDesign:PackIcon> diff --git a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs index 4fcebe3dd..3cd3fb5f9 100644 --- a/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs +++ b/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/ViewModels/MachineConnectionViewVM.cs @@ -48,7 +48,7 @@ namespace Tango.MachineStudio.UI.ViewModels public MachineConnectionViewVM(ExternalBridgeScanner scanner) { Scanner = scanner; - ConnectCommand = new RelayCommand(Connect,(x) => SelectedMachine != null); + ConnectCommand = new RelayCommand(Connect, (x) => SelectedMachine != null); } /// <summary> diff --git a/Software/Visual_Studio/Tango.BL/ObservableEntity.cs b/Software/Visual_Studio/Tango.BL/ObservableEntity.cs index 1073a31ce..41f18bee5 100644 --- a/Software/Visual_Studio/Tango.BL/ObservableEntity.cs +++ b/Software/Visual_Studio/Tango.BL/ObservableEntity.cs @@ -97,6 +97,17 @@ namespace Tango.BL } /// <summary> + /// Gets or sets the entity last updated data and time. + /// </summary> + [ParameterIgnore] + [JsonIgnore] + [NotMapped] + public Type ObjectType + { + get { return GetType(); } + } + + /// <summary> /// Initializes a new instance of the <see cref="ObservableEntity{T}"/> class. /// </summary> public ObservableEntity() |
