aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views')
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/MainView.xaml374
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/MainView.xaml.cs61
2 files changed, 68 insertions, 367 deletions
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 55b3580fe..335ce809e 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
@@ -8,12 +8,13 @@
xmlns:mahApps="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:editors="clr-namespace:Tango.SharedUI.Editors;assembly=Tango.SharedUI"
xmlns:converters="clr-namespace:Tango.SharedUI.Converters;assembly=Tango.SharedUI"
+ xmlns:entities="clr-namespace:Tango.BL.Entities;assembly=Tango.BL"
xmlns:local="clr-namespace:Tango.MachineStudio.HardwareDesigner.Views"
xmlns:vm="clr-namespace:Tango.MachineStudio.HardwareDesigner.ViewModels"
xmlns:observables="clr-namespace:Tango.BL.Entities;assembly=Tango.BL"
xmlns:global="clr-namespace:Tango.MachineStudio.HardwareDesigner"
mc:Ignorable="d"
- d:DesignHeight="720" Background="Transparent" d:DesignWidth="1280" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}">
+ d:DesignHeight="720" d:DesignWidth="1280" d:DataContext="{d:DesignInstance Type=vm:MainViewVM, IsDesignTimeCreatable=False}" DataContext="{x:Static global:ViewModelLocator.MainViewVM}">
<UserControl.Resources>
<converters:DoubleToIntConverter x:Key="DoubleToIntConverter" />
@@ -25,22 +26,17 @@
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="477*"/>
- <ColumnDefinition Width="310"/>
+ <ColumnDefinition Width="500"/>
</Grid.ColumnDefinitions>
<Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="200"/>
- <ColumnDefinition Width="1*"/>
- </Grid.ColumnDefinitions>
-
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="90"/>
<RowDefinition Height="631*"/>
</Grid.RowDefinitions>
- <Grid Margin="-210 0 0 0">
+ <Grid Margin="0 0 0 0">
<StackPanel Orientation="Horizontal">
<TextBlock FontSize="30" FontStyle="Italic" VerticalAlignment="Center" Margin="50 10 10 0" Foreground="Silver" FontWeight="Bold">HARDWARE DESIGNER</TextBlock>
<StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="10 10 0 0">
@@ -56,202 +52,76 @@
</StackPanel>
</Grid>
- <Viewbox MaxWidth="1200" Grid.Row="1" >
- <Grid VerticalAlignment="Top">
- <Image IsHitTestVisible="False" Source="../Images/machine-sketch-trans.png" MaxWidth="800" RenderOptions.BitmapScalingMode="Fant">
- <Image.Effect>
- <DropShadowEffect ShadowDepth="0" BlurRadius="20" Opacity="1" RenderingBias="Performance" Color="DimGray"></DropShadowEffect>
- </Image.Effect>
- </Image>
+ <Grid Grid.Row="1">
- <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="Top" Foreground="Silver" FontSize="20">DRAG &amp; 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" />
- </ItemsPanelTemplate>
- </ListBox.ItemsPanel>
- <ListBox.ItemTemplate>
- <DataTemplate DataType="{x:Type observables:HardwareDancer}">
- <Grid Style="{StaticResource draggableGrid}">
- <Border Margin="5" CornerRadius="5" Width="100" Height="100" BorderThickness="1" Padding="2" IsHitTestVisible="False">
- <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>
- <Image Source="../Images/compass.png" Width="32" Margin="5" />
- <TextBlock FontSize="8" TextAlignment="Center" TextWrapping="Wrap" Margin="0 5 0 0" Text="{Binding HardwareDancerType.Name}" VerticalAlignment="Center"></TextBlock>
- </StackPanel>
- </Grid>
- </Border>
- </Grid>
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
- </Grid>
- </Border>
- <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="Top" Foreground="Silver" FontSize="20">DRAG &amp; 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" />
- </ItemsPanelTemplate>
- </ListBox.ItemsPanel>
- <ListBox.ItemTemplate>
- <DataTemplate DataType="{x:Type observables:HardwareMotor}">
- <Grid Style="{StaticResource draggableGrid}">
- <Border Margin="4" CornerRadius="3" Height="25" 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/engine.png" Width="16" />
- <TextBlock FontSize="8" Margin="5 0 0 0" TextTrimming="CharacterEllipsis" Text="{Binding HardwareMotorType.Description}" VerticalAlignment="Center"></TextBlock>
- </StackPanel>
- </Grid>
- </Border>
- </Grid>
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
- </Grid>
- </Border>
+ <ScrollViewer VerticalScrollBarVisibility="Auto" Margin="50 20 0 0">
+ <StackPanel>
+ <StackPanel Orientation="Horizontal">
+ <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.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>
+ </DataTemplate>
+ </ListBox.ItemTemplate>
+ </ListBox>
- <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="Top" Foreground="Silver" FontSize="20">DRAG &amp; 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" />
- </ItemsPanelTemplate>
- </ListBox.ItemsPanel>
- <ListBox.ItemTemplate>
- <DataTemplate DataType="{x:Type observables:HardwarePidControl}">
- <Grid Style="{StaticResource draggableGrid}">
- <Border Margin="4" CornerRadius="3" Height="25" 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/balance.png" Width="16" />
- <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>
+ <StackPanel Orientation="Horizontal" Margin="0 20 0 0">
+ <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.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>
+ </DataTemplate>
+ </ListBox.ItemTemplate>
+ </ListBox>
- <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 &amp; 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>
- </Grid>
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
- </Grid>
- </Border>
- </Canvas>
- </Grid>
- </Viewbox>
- </Grid>
+ <StackPanel Orientation="Horizontal" Margin="0 20 0 0">
+ <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.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>
+ </DataTemplate>
+ </ListBox.ItemTemplate>
+ </ListBox>
+
+ <StackPanel Orientation="Horizontal" Margin="0 20 0 0">
+ <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.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>
+ </DataTemplate>
+ </ListBox.ItemTemplate>
+ </ListBox>
+ </StackPanel>
+ </ScrollViewer>
- <Grid>
- <Grid VerticalAlignment="Bottom" Margin="0 0 0 50" Style="{StaticResource droppableGrid}" dragAndDrop:DragAndDropService.Drop="OnTrashDrop">
- <StackPanel Margin="0 0 -80 50">
- <TextBlock HorizontalAlignment="Center" FontSize="20" Foreground="Gray">
- DROP HERE TO DELETE
- </TextBlock>
- <materialDesign:PackIcon Kind="ArrowDown" HorizontalAlignment="Center" Width="32" Height="32" Foreground="Gray" Margin="0 10 0 0" />
- <materialDesign:PackIcon Kind="Delete" Foreground="#9EFF6A6A" Width="250" Height="250" HorizontalAlignment="Center" />
- </StackPanel>
</Grid>
+
</Grid>
</Grid>
@@ -261,7 +131,7 @@
<RowDefinition Height="60"/>
</Grid.RowDefinitions>
- <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Margin="0 0 0 10">
+ <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Margin="0 90 0 10">
<Grid>
<StackPanel>
<materialDesign:Card Margin="5,10,5,0" Background="{DynamicResource MaterialDesignBackground}" Padding="20 10">
@@ -278,114 +148,6 @@
<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>
- <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/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 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="Motors">
- <ListBox ItemsSource="{Binding Adapter.HardwareMotorTypes}" 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/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 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="Dancers">
- <ListBox ItemsSource="{Binding Adapter.HardwareDancerTypes}" 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/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 Description}"></Run></TextBlock>
- </StackPanel>
- </StackPanel>
-
- <Rectangle Margin="0 10 0 0" VerticalAlignment="Bottom" Stroke="Gainsboro" StrokeThickness="1"></Rectangle>
- </Grid>
- </DataTemplate>
- </ListBox.ItemTemplate>
- </ListBox>
- </Expander>
- </StackPanel>
- </materialDesign:Card>
-
- <materialDesign:Card Margin="5,10,5,0" Background="{DynamicResource MaterialDesignBackground}">
- <StackPanel>
<Grid>
<Expander HorizontalAlignment="Stretch" Header="Component Properties" IsExpanded="True">
<editors:ParameterizedEditor ParameterizedObject="{Binding SelectedHardwareObject}" Padding="10">
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 dad105a43..14593327b 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
@@ -25,72 +25,11 @@ namespace Tango.MachineStudio.HardwareDesigner.Views
{
private MainViewVM _vm;
- public DraggingSurface DraggingSurface
- {
- get { return (DraggingSurface)GetValue(DraggingSurfaceProperty); }
- set { SetValue(DraggingSurfaceProperty, value); }
- }
- public static readonly DependencyProperty DraggingSurfaceProperty =
- DependencyProperty.Register("DraggingSurface", typeof(DraggingSurface), typeof(MainView), new PropertyMetadata(null));
-
public MainView()
{
InitializeComponent();
- DraggingSurface = dragSufrace;
Loaded += (x, y) => _vm = DataContext as MainViewVM;
}
-
- private void OnMotorsDrop(object sender, DropEventArgs e)
- {
- if (e.Draggable.DataContext is HardwareMotorType)
- {
- _vm.OnMotorDrop(e.Draggable.DataContext as HardwareMotorType);
- }
- }
-
- private void OnDancerDrop(object sender, DropEventArgs e)
- {
- if (e.Draggable.DataContext is HardwareDancerType)
- {
- _vm.OnDropDancer(e.Draggable.DataContext as HardwareDancerType);
- }
- }
-
- private void OnPidControlDrop(object sender, DropEventArgs e)
- {
- if (e.Draggable.DataContext is HardwarePidControlType)
- {
- _vm.OnDropPidControl(e.Draggable.DataContext as HardwarePidControlType);
- }
- }
-
- 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)
- {
- _vm.OnRemoveMotor(e.Draggable.DataContext as HardwareMotor);
- }
- else if (e.Draggable.DataContext is HardwareDancer)
- {
- _vm.OnRemoveDancer(e.Draggable.DataContext as HardwareDancer);
- }
- else if (e.Draggable.DataContext is HardwarePidControl)
- {
- _vm.OnRemovePidControl(e.Draggable.DataContext as HardwarePidControl);
- }
- else if (e.Draggable.DataContext is HardwareWinder)
- {
- _vm.OnRemoveWinder(e.Draggable.DataContext as HardwareWinder);
- }
- }
}
}