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.xaml184
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/MainView.xaml.cs12
2 files changed, 171 insertions, 25 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 77ace3e63..e73ba2a1f 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
@@ -60,10 +60,10 @@
</Image>
<Canvas ClipToBounds="False" x:Name="canvas">
- <Border BorderThickness="2" BorderBrush="Gray" CornerRadius="0 0 20 20" Width="707" Height="132" Canvas.Left="50" Canvas.Top="378" Background="#ABFFFFFF">
+ <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 &amp; DROP DANCERS</TextBlock>
- <ListBox x:Name="listDancers" ItemsSource="{Binding CurrentVersionDancerTypes}" Margin="0 5 0 0" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled">
+ <ListBox x:Name="listDancers" ItemContainerStyle="{StaticResource basicListBoxItem}" ItemsSource="{Binding CurrentVersionDancerTypes}" Margin="0 5 0 0" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" />
@@ -72,22 +72,23 @@
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type observables:DancerType}">
<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 BorderBrush="Gray" Width="100" Height="100" BorderThickness="1" Background="White" Padding="2" IsHitTestVisible="False">
+ <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" />
@@ -102,10 +103,10 @@
</Grid>
</Border>
- <Border BorderThickness="2 2 2 0" BorderBrush="Gray" Width="576" Height="157" Canvas.Left="114" Canvas.Top="224" Background="#ABFFFFFF">
+ <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 &amp; DROP MOTORS</TextBlock>
- <ListBox x:Name="listMotors" ItemsSource="{Binding CurrentVersionMotorTypes}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled">
+ <ListBox x:Name="listMotors" ItemContainerStyle="{StaticResource basicListBoxItem}" ItemsSource="{Binding CurrentVersionMotorTypes}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" />
@@ -129,7 +130,23 @@
</ItemsControl>
</Border>
</Grid.ToolTip>
- <Border BorderBrush="Gray" Height="25" IsHitTestVisible="False" MaxWidth="100" BorderThickness="1" Background="White" Padding="2">
+ <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" />
@@ -143,6 +160,49 @@
</ListBox>
</Grid>
</Border>
+
+ <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 &amp; DROP PID CONTROLS</TextBlock>
+ <ListBox x:Name="listPid" ItemContainerStyle="{StaticResource basicListBoxItem}" ItemsSource="{Binding CurrentVersionPidControls}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled">
+ <ListBox.ItemsPanel>
+ <ItemsPanelTemplate>
+ <WrapPanel Orientation="Horizontal" />
+ </ItemsPanelTemplate>
+ </ListBox.ItemsPanel>
+ <ListBox.ItemTemplate>
+ <DataTemplate DataType="{x:Type observables:PidControl}">
+ <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 Name}" VerticalAlignment="Center"></TextBlock>
+ </StackPanel>
+ </Grid>
+ </Border>
+ </Grid>
+ </DataTemplate>
+ </ListBox.ItemTemplate>
+ </ListBox>
+ </Grid>
+ </Border>
</Canvas>
</Grid>
</Viewbox>
@@ -209,7 +269,11 @@
</ListBox.ItemTemplate>
</ListBox>
</Expander>
- <Border Height="1" HorizontalAlignment="Stretch" Background="{DynamicResource MaterialDesignDivider}" SnapsToDevicePixels="True" />
+ </StackPanel>
+ </materialDesign:Card>
+
+ <materialDesign:Card Margin="5,10,5,0" Background="{DynamicResource MaterialDesignBackground}">
+ <StackPanel>
<Expander HorizontalAlignment="Stretch" Header="Dancers">
<ListBox ItemsSource="{Binding Adapter.DancerTypes}" HorizontalContentAlignment="Stretch">
<ListBox.ItemContainerStyle>
@@ -240,8 +304,38 @@
<materialDesign:Card Margin="5,10,5,0" Background="{DynamicResource MaterialDesignBackground}">
<StackPanel>
+ <Expander HorizontalAlignment="Stretch" Header="PID Controls">
+ <ListBox ItemsSource="{Binding Adapter.PidControls}" 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 Name}"></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="Selected Motor Properties">
+ <Expander HorizontalAlignment="Stretch" Header="Motor Properties">
<editors:ParameterizedEditor ParameterizedObject="{Binding ElementName=listMotors,Path=SelectedItem}" Padding="10">
<editors:ParameterizedEditor.ItemsPanel>
<ItemsPanelTemplate>
@@ -281,7 +375,7 @@
<materialDesign:Card Margin="5,10,5,0" Background="{DynamicResource MaterialDesignBackground}">
<StackPanel>
<Grid>
- <Expander HorizontalAlignment="Stretch" Header="Selected Dancer Properties">
+ <Expander HorizontalAlignment="Stretch" Header="Dancer Properties">
<editors:ParameterizedEditor ParameterizedObject="{Binding ElementName=listDancers,Path=SelectedItem}" Padding="10">
<editors:ParameterizedEditor.ItemsPanel>
<ItemsPanelTemplate>
@@ -317,11 +411,51 @@
</Grid>
</StackPanel>
</materialDesign:Card>
+
+ <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>
</StackPanel>
</Grid>
</ScrollViewer>
- <Grid Grid.Row="1" Margin="10">
+ <Grid Grid.Row="1" Margin="10 0 10 10">
<Button Height="Auto" Command="{Binding SaveCommand}" Margin="0 0 0 0">
<StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Width="20" Height="20" VerticalAlignment="Center" Kind="ContentSaveSettings"></materialDesign:PackIcon>
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 b06d3bd27..d18a8ac71 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
@@ -57,6 +57,14 @@ namespace Tango.MachineStudio.HardwareDesigner.Views
}
}
+ private void OnPidControlDrop(object sender, DropEventArgs e)
+ {
+ if (e.Draggable.DataContext is PidControl)
+ {
+ _vm.OnDropPidControl(e.Draggable.DataContext as PidControl);
+ }
+ }
+
private void OnTrashDrop(object sender, DropEventArgs e)
{
if (e.Draggable.DataContext is MotorType)
@@ -67,6 +75,10 @@ namespace Tango.MachineStudio.HardwareDesigner.Views
{
_vm.OnRemoveDancer(e.Draggable.DataContext as DancerType);
}
+ else if (e.Draggable.DataContext is PidControl)
+ {
+ _vm.OnRemovePidControl(e.Draggable.DataContext as PidControl);
+ }
}
}
}