diff options
| author | Roy <roy.mail.net@gmail.com> | 2018-02-10 02:13:37 +0200 |
|---|---|---|
| committer | Roy <roy.mail.net@gmail.com> | 2018-02-10 02:13:37 +0200 |
| commit | 07e686eb253ffd29f36dbe530b3a17633e02b353 (patch) | |
| tree | d9663f1c92a400349dffc743adb0114ee1a7f618 /Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views | |
| parent | c8c9606e545f49aae3d9f0524775436adbdf27e9 (diff) | |
| download | Tango-07e686eb253ffd29f36dbe530b3a17633e02b353.tar.gz Tango-07e686eb253ffd29f36dbe530b3a17633e02b353.zip | |
Added support for motor controllers.
Diffstat (limited to 'Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views')
2 files changed, 49 insertions, 2 deletions
diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml index f353c92d1..7cdd92e06 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml @@ -41,7 +41,7 @@ </Menu> <Grid Grid.Row="1"> - <StackPanel Orientation="Horizontal" Margin="20 0 0 0"> + <StackPanel HorizontalAlignment="Left" Orientation="Horizontal" Margin="20 0 0 0"> <ListBox ItemContainerStyle="{StaticResource basicListBoxItem}" ItemsSource="{Binding AvailableTechItems}" SelectedItem="{Binding SelectedTechItem,Mode=TwoWay}" HorizontalContentAlignment="Stretch" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Disabled"> <ListBox.ItemsPanel> <ItemsPanelTemplate> @@ -69,6 +69,17 @@ </ListBox.ItemTemplate> </ListBox> </StackPanel> + + <StackPanel HorizontalAlignment="Right" Orientation="Horizontal" Margin="0 0 255 10" VerticalAlignment="Bottom"> + <ListBox x:Name="listMode" SelectedIndex="0" Style="{StaticResource MaterialDesignToolToggleListBox}"> + <ListBoxItem Height="40" Width="60" HorizontalContentAlignment="Center" ToolTip="Edit Mode"> + <materialDesign:PackIcon HorizontalAlignment="Center" Width="30" Height="30" Kind="Pencil" /> + </ListBoxItem> + <ListBoxItem Height="40" Width="60" HorizontalContentAlignment="Center" ToolTip="Action Mode" MouseUp="OnActionModeClicked"> + <materialDesign:PackIcon HorizontalAlignment="Center" Width="30" Height="30" Kind="HandPointingRight" /> + </ListBoxItem> + </ListBox> + </StackPanel> </Grid> </Grid> @@ -87,6 +98,8 @@ x:Name="editor" Elements="{Binding Elements}" ElementCreation="ElementsEditor_ElementCreation" + ElementsRemoved="ElementsEditor_ElementsRemoved" + AfterPaste="ElementsEditor_AfterPaste" RulerHeight="32" EditorWidth="1920" EditorHeight="1080" @@ -98,7 +111,19 @@ SelectionFillBrush="#338D8D8D" SelectionStrokeBrush="{StaticResource AccentColorBrush}" BorderBrush="{StaticResource AccentColorBrush}" - BorderThickness="1" /> + BorderThickness="1"> + + <editors:ElementsEditor.Style> + <Style TargetType="editors:ElementsEditor"> + <Setter Property="IsEditable" Value="True"></Setter> + <Style.Triggers> + <DataTrigger Binding="{Binding ElementName=listMode,Path=SelectedIndex}" Value="1"> + <Setter Property="IsEditable" Value="False"></Setter> + </DataTrigger> + </Style.Triggers> + </Style> + </editors:ElementsEditor.Style> + </editors:ElementsEditor> <Slider Grid.Column="1" Orientation="Vertical" Margin="5" Maximum="3" Minimum="0.2" Value="{Binding ElementName=editor,Path=ScaleFactor}"></Slider> </Grid> diff --git a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml.cs b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml.cs index 5944af1e2..6b84fb363 100644 --- a/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml.cs +++ b/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.Technician/Views/MachineTechView.xaml.cs @@ -32,6 +32,13 @@ namespace Tango.MachineStudio.Technician.Views { _vm = DataContext as MachineTechViewVM; }; + + (editor.UndoRedoStatesProvider as ElementsEditorUndoRedoStatesProvider).StateExecuted += MachineTechView_StateExecuted; + } + + private void MachineTechView_StateExecuted(object sender, UndoRedoStateExecutedEventArgs e) + { + ElementsEditorUndoRedoState state = e.State as ElementsEditorUndoRedoState; } private void ElementsEditor_ElementCreation(object sender, ElementCreationEventArgs e) @@ -39,5 +46,20 @@ namespace Tango.MachineStudio.Technician.Views _vm.AddElement(e.Bounds); e.AppendUndoState = true; } + + private void ElementsEditor_ElementsRemoved(object sender, ElementsEventArgs e) + { + _vm.OnElementsRemoved(e.Elements); + } + + private void ElementsEditor_AfterPaste(object sender, ElementsEventArgs e) + { + _vm.OnElementsPasted(e.Elements); + } + + private void OnActionModeClicked(object sender, MouseButtonEventArgs e) + { + editor.DeselectElements(); + } } } |
