diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-03-01 12:01:46 +0200 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-03-01 12:01:46 +0200 |
| commit | 93e915dd3fc06ae20b29aa927966676b9f8b7c5a (patch) | |
| tree | f5c5d5e47513e474c68f295c6abd18f3d18a9c6b /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner | |
| parent | 9823b433c62ed173671923c32ccccadc1d06c0bd (diff) | |
| download | Tango-93e915dd3fc06ae20b29aa927966676b9f8b7c5a.tar.gz Tango-93e915dd3fc06ae20b29aa927966676b9f8b7c5a.zip | |
Lots of work !
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner')
5 files changed, 144 insertions, 118 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Images/thread.png b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Images/thread.png Binary files differnew file mode 100644 index 000000000..aa5a46140 --- /dev/null +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Images/thread.png diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Tango.MachineStudio.HardwareDesigner.csproj b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Tango.MachineStudio.HardwareDesigner.csproj index 6ca84be11..b50dd9fa9 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Tango.MachineStudio.HardwareDesigner.csproj +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Tango.MachineStudio.HardwareDesigner.csproj @@ -165,5 +165,8 @@ <ItemGroup> <Resource Include="Images\balance.png" /> </ItemGroup> + <ItemGroup> + <Resource Include="Images\thread.png" /> + </ItemGroup> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> </Project>
\ No newline at end of file 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 6d605ed1c..8fede46fe 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 @@ -37,6 +37,19 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels set { _currentVersion = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } } + private IObservableEntity _selectedHardwareObject; + public IObservableEntity SelectedHardwareObject + { + get { return _selectedHardwareObject; } + set + { + _selectedHardwareObject = null; + RaisePropertyChangedAuto(); + _selectedHardwareObject = value; + RaisePropertyChangedAuto(); + } + } + public RelayCommand SaveCommand { get; set; } public RelayCommand DeleteCommand { get; set; } @@ -79,8 +92,15 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels CurrentVersion.HardwarePidControls.Remove(pidControl); } + public void OnRemoveWinder(HardwareWinder hardwareWinder) + { + CurrentVersion.HardwareWinders.Remove(hardwareWinder); + } + public void OnMotorDrop(HardwareMotorType motorType) { + if (CheckCurrentVersionNull()) return; + if (!CurrentVersion.HardwareMotors.ToList().Exists(x => x.HardwareMotorType == motorType)) { CurrentVersion.HardwareMotors.Add(new HardwareMotor() { HardwareMotorType = motorType }); @@ -89,6 +109,8 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels public void OnDropDancer(HardwareDancerType dancerType) { + if (CheckCurrentVersionNull()) return; + if (!CurrentVersion.HardwareDancers.ToList().Exists(x => x.HardwareDancerType == dancerType)) { CurrentVersion.HardwareDancers.Add(new HardwareDancer() { HardwareDancerType = dancerType }); @@ -97,12 +119,35 @@ namespace Tango.MachineStudio.HardwareDesigner.ViewModels public void OnDropPidControl(HardwarePidControlType pidControlType) { + if (CheckCurrentVersionNull()) return; + if (!CurrentVersion.HardwarePidControls.ToList().Exists(x => x.HardwarePidControlType == pidControlType)) { CurrentVersion.HardwarePidControls.Add(new HardwarePidControl() { HardwarePidControlType = pidControlType }); } } + public void OnDropWinder(HardwareWinderType hardwareWinderType) + { + if (CheckCurrentVersionNull()) return; + + if (!CurrentVersion.HardwareWinders.ToList().Exists(x => x.HardwareWinderType == hardwareWinderType)) + { + CurrentVersion.HardwareWinders.Add(new HardwareWinder() { HardwareWinderType = hardwareWinderType }); + } + } + + private bool CheckCurrentVersionNull() + { + if (CurrentVersion == null) + { + _notification.ShowInfo("Please select a hardware version before attempting to insert any components."); + return true; + } + + return false; + } + private void New() { String name = _notification.ShowTextInput("Enter hardware version name", "Name"); 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 f8de83966..d5f8b9e51 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 @@ -68,8 +68,8 @@ <Canvas ClipToBounds="False" x:Name="canvas"> <Border BorderThickness="1" BorderBrush="Gray" CornerRadius="0 0 20 20" Width="707" Height="132" Canvas.Left="50" Canvas.Top="378" Background="#ABFFFFFF"> <Grid Style="{StaticResource droppableGrid}" dragAndDrop:DragAndDropService.Drop="OnDancerDrop"> - <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Silver" FontSize="20">DRAG & DROP DANCERS</TextBlock> - <ListBox x:Name="listDancers" ItemContainerStyle="{StaticResource basicListBoxItem}" ItemsSource="{Binding CurrentVersion.HardwareDancers}" Margin="0 5 0 0" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled"> + <TextBlock HorizontalAlignment="Center" VerticalAlignment="Top" Foreground="Silver" FontSize="20">DRAG & DROP DANCERS</TextBlock> + <ListBox x:Name="listDancers" ItemContainerStyle="{StaticResource basicListBoxItem}" HorizontalAlignment="Center" VerticalAlignment="Center" ItemsSource="{Binding CurrentVersion.HardwareDancers}" SelectedItem="{Binding SelectedHardwareObject,Mode=TwoWay}" Margin="0 5 0 0" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled"> <ListBox.ItemsPanel> <ItemsPanelTemplate> <WrapPanel Orientation="Horizontal" /> @@ -111,8 +111,8 @@ <Border BorderThickness="1 1 1 0" BorderBrush="Gray" Width="576" Height="157" Canvas.Left="114" Canvas.Top="224" Background="#ABFFFFFF"> <Grid Style="{StaticResource droppableGrid}" dragAndDrop:DragAndDropService.Drop="OnMotorsDrop"> - <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Silver" FontSize="20">DRAG & DROP MOTORS</TextBlock> - <ListBox x:Name="listMotors" ItemContainerStyle="{StaticResource basicListBoxItem}" ItemsSource="{Binding CurrentVersion.HardwareMotors}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled"> + <TextBlock HorizontalAlignment="Center" VerticalAlignment="Top" Foreground="Silver" FontSize="20">DRAG & DROP MOTORS</TextBlock> + <ListBox x:Name="listMotors" ItemContainerStyle="{StaticResource basicListBoxItem}" HorizontalAlignment="Center" VerticalAlignment="Center" ItemsSource="{Binding CurrentVersion.HardwareMotors}" SelectedItem="{Binding SelectedHardwareObject,Mode=TwoWay}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled"> <ListBox.ItemsPanel> <ItemsPanelTemplate> <WrapPanel Orientation="Horizontal" /> @@ -121,21 +121,6 @@ <ListBox.ItemTemplate> <DataTemplate DataType="{x:Type observables:HardwareMotor}"> <Grid Style="{StaticResource draggableGrid}"> - <Grid.ToolTip> - <Border Padding="2"> - <ItemsControl ItemsSource="{Binding Parameters}"> - <ItemsControl.ItemTemplate> - <DataTemplate> - <TextBlock Margin="2"> - <Run Text="{Binding Name}" FontWeight="SemiBold"></Run> - : - <Run Text="{Binding Value}" FontStyle="Italic"></Run> - </TextBlock> - </DataTemplate> - </ItemsControl.ItemTemplate> - </ItemsControl> - </Border> - </Grid.ToolTip> <Border Margin="4" CornerRadius="3" Height="25" IsHitTestVisible="False" MaxWidth="100" BorderThickness="1" Padding="5 2 9 2"> <Border.Style> <Style TargetType="Border"> @@ -156,7 +141,7 @@ <Grid> <StackPanel Orientation="Horizontal"> <Image Source="../Images/engine.png" Width="16" /> - <TextBlock FontSize="8" Margin="5 0 0 0" TextTrimming="CharacterEllipsis" Text="{Binding HardwareMotorType.Name}" VerticalAlignment="Center"></TextBlock> + <TextBlock FontSize="8" Margin="5 0 0 0" TextTrimming="CharacterEllipsis" Text="{Binding HardwareMotorType.Description}" VerticalAlignment="Center"></TextBlock> </StackPanel> </Grid> </Border> @@ -169,8 +154,8 @@ <Border BorderThickness="1 1 1 0" BorderBrush="Gray" Width="545" Height="120" Canvas.Left="130" Canvas.Top="105" Background="#ABFFFFFF" CornerRadius="20 20 0 0" Padding="5"> <Grid Style="{StaticResource droppableGrid}" dragAndDrop:DragAndDropService.Drop="OnPidControlDrop"> - <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Silver" FontSize="20">DRAG & DROP PID CONTROLS</TextBlock> - <ListBox x:Name="listPid" ItemContainerStyle="{StaticResource basicListBoxItem}" ItemsSource="{Binding CurrentVersion.HardwarePidControls}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled"> + <TextBlock HorizontalAlignment="Center" VerticalAlignment="Top" Foreground="Silver" FontSize="20">DRAG & DROP PID CONTROLS</TextBlock> + <ListBox x:Name="listPid" ItemContainerStyle="{StaticResource basicListBoxItem}" HorizontalAlignment="Center" VerticalAlignment="Center" ItemsSource="{Binding CurrentVersion.HardwarePidControls}" SelectedItem="{Binding SelectedHardwareObject,Mode=TwoWay}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled"> <ListBox.ItemsPanel> <ItemsPanelTemplate> <WrapPanel Orientation="Horizontal" /> @@ -199,7 +184,50 @@ <Grid> <StackPanel Orientation="Horizontal"> <Image Source="../Images/balance.png" Width="16" /> - <TextBlock FontSize="8" Margin="5 0 0 0" TextTrimming="CharacterEllipsis" Text="{Binding HardwarePidControlType.Name}" VerticalAlignment="Center"></TextBlock> + <TextBlock FontSize="8" Margin="5 0 0 0" TextTrimming="CharacterEllipsis" Text="{Binding HardwarePidControlType.Description}" VerticalAlignment="Center"></TextBlock> + </StackPanel> + </Grid> + </Border> + </Grid> + </DataTemplate> + </ListBox.ItemTemplate> + </ListBox> + </Grid> + </Border> + + <Border BorderThickness="1 1 1 0" BorderBrush="Gray" Width="296" Height="73" Canvas.Left="255" Canvas.Top="33" Background="#ABFFFFFF" CornerRadius="20 20 0 0" Padding="5"> + <Grid Style="{StaticResource droppableGrid}" dragAndDrop:DragAndDropService.Drop="OnDropWinder"> + <TextBlock HorizontalAlignment="Center" VerticalAlignment="Top" Foreground="Silver" FontSize="16">DRAG & DROP WINDERS</TextBlock> + <ListBox x:Name="listWinders" ItemContainerStyle="{StaticResource basicListBoxItem}" HorizontalAlignment="Center" VerticalAlignment="Center" ItemsSource="{Binding CurrentVersion.HardwareWinders}" SelectedItem="{Binding SelectedHardwareObject,Mode=TwoWay}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled"> + <ListBox.ItemsPanel> + <ItemsPanelTemplate> + <WrapPanel Orientation="Horizontal" /> + </ItemsPanelTemplate> + </ListBox.ItemsPanel> + <ListBox.ItemTemplate> + <DataTemplate DataType="{x:Type observables:HardwareMotor}"> + <Grid Style="{StaticResource draggableGrid}"> + <Border Margin="4" CornerRadius="3" Height="53" IsHitTestVisible="False" MaxWidth="100" BorderThickness="1" Padding="5 2 9 2"> + <Border.Style> + <Style TargetType="Border"> + <Setter Property="BorderBrush" Value="Silver"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType=ListBoxItem},Path=IsSelected}" Value="True"> + <Setter Property="BorderBrush" Value="{StaticResource AccentColorBrush}"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </Border.Style> + <Border.Background> + <LinearGradientBrush> + <GradientStop Color="White"/> + <GradientStop Color="#FFD6D6D6" Offset="1"/> + </LinearGradientBrush> + </Border.Background> + <Grid> + <StackPanel Orientation="Horizontal"> + <Image Source="../Images/thread.png" Width="16" /> + <TextBlock FontSize="8" Margin="5 0 0 0" TextTrimming="CharacterEllipsis" Text="{Binding HardwareWinderType.Description}" VerticalAlignment="Center"></TextBlock> </StackPanel> </Grid> </Border> @@ -250,6 +278,32 @@ <materialDesign:Card Margin="5,10,5,0" Background="{DynamicResource MaterialDesignBackground}"> <StackPanel> + <Expander HorizontalAlignment="Stretch" Header="Winders"> + <ListBox ItemsSource="{Binding Adapter.HardwareWinderTypes}" HorizontalContentAlignment="Stretch"> + <ListBox.ItemContainerStyle> + <Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}"> + <Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter> + <Setter Property="VerticalContentAlignment" Value="Stretch"></Setter> + <Setter Property="Padding" Value="1"></Setter> + </Style> + </ListBox.ItemContainerStyle> + <ListBox.ItemTemplate> + <DataTemplate> + <Grid Background="Transparent" IsHitTestVisible="True" dragAndDrop:DragAndDropService.DraggableBorderBrush="{StaticResource AccentColorBrush}" dragAndDrop:DragAndDropService.Draggable="True" dragAndDrop:DragAndDropService.DraggingSurface="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=DraggingSurface}"> + <StackPanel Orientation="Horizontal" Margin="2 8"> + <Image IsHitTestVisible="False" Width="24" Height="24" Source="../Images/thread.png" Stretch="Fill" RenderOptions.BitmapScalingMode="Fant"></Image> + <StackPanel Margin="5 0 0 0" IsHitTestVisible="False" VerticalAlignment="Center"> + <TextBlock IsHitTestVisible="False" FontSize="10" Foreground="DimGray"><Run Text="{Binding Description}"></Run></TextBlock> + </StackPanel> + </StackPanel> + + <Rectangle Margin="0 10 0 0" VerticalAlignment="Bottom" Stroke="Gainsboro" StrokeThickness="1"></Rectangle> + </Grid> + </DataTemplate> + </ListBox.ItemTemplate> + </ListBox> + </Expander> + <Border Height="1" HorizontalAlignment="Stretch" Background="{DynamicResource MaterialDesignDivider}" SnapsToDevicePixels="True" /> <Expander HorizontalAlignment="Stretch" Header="PID Controls"> <ListBox ItemsSource="{Binding Adapter.HardwarePidControlTypes}" HorizontalContentAlignment="Stretch"> <ListBox.ItemContainerStyle> @@ -265,7 +319,7 @@ <StackPanel Orientation="Horizontal" Margin="2 8"> <Image IsHitTestVisible="False" Width="24" Height="24" Source="../Images/balance.png" Stretch="Fill" RenderOptions.BitmapScalingMode="Fant"></Image> <StackPanel Margin="5 0 0 0" IsHitTestVisible="False" VerticalAlignment="Center"> - <TextBlock IsHitTestVisible="False" FontSize="10" Foreground="DimGray"><Run Text="{Binding Name}"></Run></TextBlock> + <TextBlock IsHitTestVisible="False" FontSize="10" Foreground="DimGray"><Run Text="{Binding Description}"></Run></TextBlock> </StackPanel> </StackPanel> @@ -275,11 +329,7 @@ </ListBox.ItemTemplate> </ListBox> </Expander> - </StackPanel> - </materialDesign:Card> - - <materialDesign:Card Margin="5,10,5,0" Background="{DynamicResource MaterialDesignBackground}"> - <StackPanel> + <Border Height="1" HorizontalAlignment="Stretch" Background="{DynamicResource MaterialDesignDivider}" SnapsToDevicePixels="True" /> <Expander HorizontalAlignment="Stretch" Header="Motors"> <ListBox ItemsSource="{Binding Adapter.HardwareMotorTypes}" HorizontalContentAlignment="Stretch"> <ListBox.ItemContainerStyle> @@ -295,7 +345,7 @@ <StackPanel Orientation="Horizontal" Margin="2 8"> <Image IsHitTestVisible="False" Width="24" Height="24" Source="../Images/engine.png" Stretch="Fill" RenderOptions.BitmapScalingMode="Fant"></Image> <StackPanel Margin="5 0 0 0" IsHitTestVisible="False" VerticalAlignment="Center"> - <TextBlock IsHitTestVisible="False" FontSize="10" Foreground="DimGray"><Run Text="{Binding Name}"></Run></TextBlock> + <TextBlock IsHitTestVisible="False" FontSize="10" Foreground="DimGray"><Run Text="{Binding Description}"></Run></TextBlock> </StackPanel> </StackPanel> @@ -305,11 +355,7 @@ </ListBox.ItemTemplate> </ListBox> </Expander> - </StackPanel> - </materialDesign:Card> - - <materialDesign:Card Margin="5,10,5,0" Background="{DynamicResource MaterialDesignBackground}"> - <StackPanel> + <Border Height="1" HorizontalAlignment="Stretch" Background="{DynamicResource MaterialDesignDivider}" SnapsToDevicePixels="True" /> <Expander HorizontalAlignment="Stretch" Header="Dancers"> <ListBox ItemsSource="{Binding Adapter.HardwareDancerTypes}" HorizontalContentAlignment="Stretch"> <ListBox.ItemContainerStyle> @@ -325,7 +371,7 @@ <StackPanel Orientation="Horizontal" Margin="2 8"> <Image IsHitTestVisible="False" Width="24" Height="24" Source="../Images/compass.png" Stretch="Fill" RenderOptions.BitmapScalingMode="Fant"></Image> <StackPanel Margin="5 0 0 0" IsHitTestVisible="False" VerticalAlignment="Center"> - <TextBlock IsHitTestVisible="False" FontSize="10" Foreground="DimGray"><Run Text="{Binding Name}"></Run></TextBlock> + <TextBlock IsHitTestVisible="False" FontSize="10" Foreground="DimGray"><Run Text="{Binding Description}"></Run></TextBlock> </StackPanel> </StackPanel> @@ -341,88 +387,8 @@ <materialDesign:Card Margin="5,10,5,0" Background="{DynamicResource MaterialDesignBackground}"> <StackPanel> <Grid> - <Expander HorizontalAlignment="Stretch" Header="PID Control Properties"> - <editors:ParameterizedEditor ParameterizedObject="{Binding ElementName=listPid,Path=SelectedItem}" 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> - </Expander> - </Grid> - </StackPanel> - </materialDesign:Card> - - <materialDesign:Card Margin="5,10,5,0" Background="{DynamicResource MaterialDesignBackground}"> - <StackPanel> - <Grid> - <Expander HorizontalAlignment="Stretch" Header="Motor Properties"> - <editors:ParameterizedEditor ParameterizedObject="{Binding ElementName=listMotors,Path=SelectedItem}" 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> - </Expander> - </Grid> - </StackPanel> - </materialDesign:Card> - - <materialDesign:Card Margin="5,10,5,0" Background="{DynamicResource MaterialDesignBackground}"> - <StackPanel> - <Grid> - <Expander HorizontalAlignment="Stretch" Header="Dancer Properties"> - <editors:ParameterizedEditor ParameterizedObject="{Binding ElementName=listDancers,Path=SelectedItem}" Padding="10"> + <Expander HorizontalAlignment="Stretch" Header="Component Properties" IsExpanded="True"> + <editors:ParameterizedEditor ParameterizedObject="{Binding SelectedHardwareObject}" Padding="10"> <editors:ParameterizedEditor.ItemsPanel> <ItemsPanelTemplate> <StackPanel></StackPanel> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/MainView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/MainView.xaml.cs index 0a3c06344..a95be867a 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/MainView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/MainView.xaml.cs @@ -65,6 +65,14 @@ namespace Tango.MachineStudio.HardwareDesigner.Views } } + private void OnDropWinder(object sender, DropEventArgs e) + { + if (e.Draggable.DataContext is HardwareWinderType) + { + _vm.OnDropWinder(e.Draggable.DataContext as HardwareWinderType); + } + } + private void OnTrashDrop(object sender, DropEventArgs e) { if (e.Draggable.DataContext is HardwareMotor) @@ -79,6 +87,10 @@ namespace Tango.MachineStudio.HardwareDesigner.Views { _vm.OnRemovePidControl(e.Draggable.DataContext as HardwarePidControl); } + else if (e.Draggable.DataContext is HardwareWinder) + { + _vm.OnRemoveWinder(e.Draggable.DataContext as HardwareWinder); + } } } } |
