aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-02-27 15:40:19 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-02-27 15:40:19 +0200
commit47c117490f9f9fed42329ebd1374709528693d6b (patch)
tree5c50f9acf1f9721d3db8cbecbdb5df89e6cc800e /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views
parent7d61c30b400b62069d1e69893ebe196412b2df2b (diff)
downloadTango-47c117490f9f9fed42329ebd1374709528693d6b.tar.gz
Tango-47c117490f9f9fed42329ebd1374709528693d6b.zip
Refactored Hardware Designer DAL.
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.xaml60
-rw-r--r--Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.HardwareDesigner/Views/MainView.xaml.cs24
2 files changed, 52 insertions, 32 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 e73ba2a1f..3e840467f 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
@@ -45,7 +45,13 @@
<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">
<materialDesign:PackIcon Kind="Pencil" Width="32" Height="32" Foreground="Silver" />
- <ComboBox ItemsSource="{Binding Adapter.HardwareVersions}" SelectedItem="{Binding SelectedVersion}" DisplayMemberPath="Name" Width="300" FontSize="16" FontWeight="Bold" Margin="5 0 0 0" materialDesign:HintAssist.Hint="Hardware Version"></ComboBox>
+ <ComboBox ItemsSource="{Binding Adapter.HardwareVersions}" SelectedItem="{Binding SelectedVersion}" Width="300" FontSize="16" FontWeight="Bold" Margin="5 0 0 0" materialDesign:HintAssist.Hint="Hardware Version">
+ <ComboBox.ItemTemplate>
+ <DataTemplate>
+ <TextBlock><Run Text="{Binding Name}"></Run> <Run></Run> <Run Foreground="Gray" FontSize="14">v</Run><Run Foreground="Gray" FontSize="14" Text="{Binding Version}"></Run></TextBlock>
+ </DataTemplate>
+ </ComboBox.ItemTemplate>
+ </ComboBox>
</StackPanel>
</StackPanel>
</Grid>
@@ -63,14 +69,14 @@
<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" ItemContainerStyle="{StaticResource basicListBoxItem}" ItemsSource="{Binding CurrentVersionDancerTypes}" Margin="0 5 0 0" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled">
+ <ListBox x:Name="listDancers" ItemContainerStyle="{StaticResource basicListBoxItem}" ItemsSource="{Binding CurrentVersion.HardwareDancers}" 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:DancerType}">
+ <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>
@@ -92,7 +98,7 @@
<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 Name}" VerticalAlignment="Center"></TextBlock>
+ <TextBlock FontSize="8" TextAlignment="Center" TextWrapping="Wrap" Margin="0 5 0 0" Text="{Binding HardwareDancerType.Name}" VerticalAlignment="Center"></TextBlock>
</StackPanel>
</Grid>
</Border>
@@ -106,14 +112,14 @@
<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" ItemContainerStyle="{StaticResource basicListBoxItem}" ItemsSource="{Binding CurrentVersionMotorTypes}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled">
+ <ListBox x:Name="listMotors" ItemContainerStyle="{StaticResource basicListBoxItem}" ItemsSource="{Binding CurrentVersion.HardwareMotors}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
- <DataTemplate DataType="{x:Type observables:MotorType}">
+ <DataTemplate DataType="{x:Type observables:HardwareMotor}">
<Grid Style="{StaticResource draggableGrid}">
<Grid.ToolTip>
<Border Padding="2">
@@ -150,7 +156,7 @@
<Grid>
<StackPanel Orientation="Horizontal">
<Image Source="../Images/engine.png" Width="16" />
- <TextBlock FontSize="8" Margin="5 0 0 0" TextTrimming="CharacterEllipsis" Text="{Binding Name}" VerticalAlignment="Center"></TextBlock>
+ <TextBlock FontSize="8" Margin="5 0 0 0" TextTrimming="CharacterEllipsis" Text="{Binding HardwareMotorType.Name}" VerticalAlignment="Center"></TextBlock>
</StackPanel>
</Grid>
</Border>
@@ -164,14 +170,14 @@
<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 x:Name="listPid" ItemContainerStyle="{StaticResource basicListBoxItem}" ItemsSource="{Binding CurrentVersion.HardwarePidControls}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
- <DataTemplate DataType="{x:Type observables:PidControl}">
+ <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>
@@ -193,7 +199,7 @@
<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>
+ <TextBlock FontSize="8" Margin="5 0 0 0" TextTrimming="CharacterEllipsis" Text="{Binding HardwarePidControlType.Name}" VerticalAlignment="Center"></TextBlock>
</StackPanel>
</Grid>
</Border>
@@ -227,7 +233,7 @@
<RowDefinition Height="60"/>
</Grid.RowDefinitions>
- <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto">
+ <ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Auto" Margin="0 0 0 10">
<Grid>
<StackPanel>
<materialDesign:Card Margin="5,10,5,0" Background="{DynamicResource MaterialDesignBackground}" Padding="20 10">
@@ -245,7 +251,7 @@
<materialDesign:Card Margin="5,10,5,0" Background="{DynamicResource MaterialDesignBackground}">
<StackPanel>
<Expander HorizontalAlignment="Stretch" Header="Motors">
- <ListBox ItemsSource="{Binding Adapter.MotorTypes}" HorizontalContentAlignment="Stretch">
+ <ListBox ItemsSource="{Binding Adapter.HardwareMotorTypes}" HorizontalContentAlignment="Stretch">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
<Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
@@ -275,7 +281,7 @@
<materialDesign:Card Margin="5,10,5,0" Background="{DynamicResource MaterialDesignBackground}">
<StackPanel>
<Expander HorizontalAlignment="Stretch" Header="Dancers">
- <ListBox ItemsSource="{Binding Adapter.DancerTypes}" HorizontalContentAlignment="Stretch">
+ <ListBox ItemsSource="{Binding Adapter.HardwareDancerTypes}" HorizontalContentAlignment="Stretch">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
<Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
@@ -305,7 +311,7 @@
<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 ItemsSource="{Binding Adapter.HardwarePidControlTypes}" HorizontalContentAlignment="Stretch">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
<Setter Property="HorizontalContentAlignment" Value="Stretch"></Setter>
@@ -456,12 +462,26 @@
</ScrollViewer>
<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>
- <TextBlock FontSize="14" Margin="10 0 0 0" VerticalAlignment="Center">SAVE</TextBlock>
- </StackPanel>
- </Button>
+ <UniformGrid Rows="1">
+ <Button Height="Auto" Grid.Column="1" Command="{Binding DeleteCommand}" Margin="2" Background="#FF8A8A" BorderBrush="#FF8A8A">
+ <StackPanel Orientation="Horizontal">
+ <materialDesign:PackIcon Width="20" Height="20" VerticalAlignment="Center" Kind="Delete"></materialDesign:PackIcon>
+ <TextBlock FontSize="14" Margin="10 0 0 0" VerticalAlignment="Center">DEL</TextBlock>
+ </StackPanel>
+ </Button>
+ <Button Height="Auto" Grid.Column="1" Command="{Binding NewCommand}" Margin="2" Background="#6BD16F" BorderBrush="#6BD16F">
+ <StackPanel Orientation="Horizontal">
+ <materialDesign:PackIcon Width="20" Height="20" VerticalAlignment="Center" Kind="Plus"></materialDesign:PackIcon>
+ <TextBlock FontSize="14" Margin="10 0 0 0" VerticalAlignment="Center">NEW</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>
+ <TextBlock FontSize="14" Margin="10 0 0 0" VerticalAlignment="Center">SAVE</TextBlock>
+ </StackPanel>
+ </Button>
+ </UniformGrid>
</Grid>
</Grid>
</Grid>
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 d18a8ac71..0a3c06344 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
@@ -43,41 +43,41 @@ namespace Tango.MachineStudio.HardwareDesigner.Views
private void OnMotorsDrop(object sender, DropEventArgs e)
{
- if (e.Draggable.DataContext is MotorType)
+ if (e.Draggable.DataContext is HardwareMotorType)
{
- _vm.OnMotorDrop(e.Draggable.DataContext as MotorType);
+ _vm.OnMotorDrop(e.Draggable.DataContext as HardwareMotorType);
}
}
private void OnDancerDrop(object sender, DropEventArgs e)
{
- if (e.Draggable.DataContext is DancerType)
+ if (e.Draggable.DataContext is HardwareDancerType)
{
- _vm.OnDropDancer(e.Draggable.DataContext as DancerType);
+ _vm.OnDropDancer(e.Draggable.DataContext as HardwareDancerType);
}
}
private void OnPidControlDrop(object sender, DropEventArgs e)
{
- if (e.Draggable.DataContext is PidControl)
+ if (e.Draggable.DataContext is HardwarePidControlType)
{
- _vm.OnDropPidControl(e.Draggable.DataContext as PidControl);
+ _vm.OnDropPidControl(e.Draggable.DataContext as HardwarePidControlType);
}
}
private void OnTrashDrop(object sender, DropEventArgs e)
{
- if (e.Draggable.DataContext is MotorType)
+ if (e.Draggable.DataContext is HardwareMotor)
{
- _vm.OnRemoveMotor(e.Draggable.DataContext as MotorType);
+ _vm.OnRemoveMotor(e.Draggable.DataContext as HardwareMotor);
}
- else if (e.Draggable.DataContext is DancerType)
+ else if (e.Draggable.DataContext is HardwareDancer)
{
- _vm.OnRemoveDancer(e.Draggable.DataContext as DancerType);
+ _vm.OnRemoveDancer(e.Draggable.DataContext as HardwareDancer);
}
- else if (e.Draggable.DataContext is PidControl)
+ else if (e.Draggable.DataContext is HardwarePidControl)
{
- _vm.OnRemovePidControl(e.Draggable.DataContext as PidControl);
+ _vm.OnRemovePidControl(e.Draggable.DataContext as HardwarePidControl);
}
}
}