diff options
| author | Roy <roy.mail.net@gmail.com> | 2017-12-08 00:54:27 +0200 |
|---|---|---|
| committer | Roy <roy.mail.net@gmail.com> | 2017-12-08 00:54:27 +0200 |
| commit | db4db5d05b42cbc795b3a38bba3e6c87f30d583f (patch) | |
| tree | 6eb253e1bb8d267ffdf41b2e1ff14febfd4f62a9 /Software/Visual_Studio/Tango.SharedUI/Controls | |
| parent | b457125866deb830b379cf3873e5cda3975b077a (diff) | |
| download | Tango-db4db5d05b42cbc795b3a38bba3e6c87f30d583f.tar.gz Tango-db4db5d05b42cbc795b3a38bba3e6c87f30d583f.zip | |
Stubs scripting improvements.
Diffstat (limited to 'Software/Visual_Studio/Tango.SharedUI/Controls')
| -rw-r--r-- | Software/Visual_Studio/Tango.SharedUI/Controls/ScriptEditorControl.xaml | 7 | ||||
| -rw-r--r-- | Software/Visual_Studio/Tango.SharedUI/Controls/ScriptEditorControl.xaml.cs | 20 |
2 files changed, 15 insertions, 12 deletions
diff --git a/Software/Visual_Studio/Tango.SharedUI/Controls/ScriptEditorControl.xaml b/Software/Visual_Studio/Tango.SharedUI/Controls/ScriptEditorControl.xaml index 1329bedc5..e7f3308b8 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Controls/ScriptEditorControl.xaml +++ b/Software/Visual_Studio/Tango.SharedUI/Controls/ScriptEditorControl.xaml @@ -5,10 +5,13 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:fa="http://schemas.fontawesome.io/icons/" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:mahapps="http://metro.mahapps.com/winfx/xaml/controls" mc:Ignorable="d" d:DesignHeight="400" d:DesignWidth="600" Background="#151515"> + <UserControl.InputBindings> + <KeyBinding Key="F5" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=RunCommand}" /> + </UserControl.InputBindings> + <Grid> <Grid> <Grid.RowDefinitions> @@ -39,7 +42,7 @@ <fa:ImageAwesome Icon="Paste" Foreground="LightGray"></fa:ImageAwesome> </Button> <Rectangle Margin="20 7 10 5" HorizontalAlignment="Center" VerticalAlignment="Stretch" Stroke="#3E3E3E" StrokeThickness="2"></Rectangle> - <Button Cursor="Hand" Margin="10 0 0 0" ToolTip="Run" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=RunCommand}" Style="{DynamicResource MetroCircleButtonStyle}" Width="16" Height="16"> + <Button Cursor="Hand" Margin="10 0 0 0" ToolTip="Run (F5)" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=RunCommand}" Style="{DynamicResource MetroCircleButtonStyle}" Width="16" Height="16"> <fa:ImageAwesome Icon="Play" Foreground="#39B839"></fa:ImageAwesome> </Button> <Button Cursor="Hand" Margin="15 0 0 0" IsEnabled="False" ToolTip="Stop" Command="{Binding RelativeSource={RelativeSource AncestorType=UserControl},Path=StopCommand}" Style="{DynamicResource MetroCircleButtonStyle}" Width="14" Height="14"> diff --git a/Software/Visual_Studio/Tango.SharedUI/Controls/ScriptEditorControl.xaml.cs b/Software/Visual_Studio/Tango.SharedUI/Controls/ScriptEditorControl.xaml.cs index d3adf4d78..0551de699 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Controls/ScriptEditorControl.xaml.cs +++ b/Software/Visual_Studio/Tango.SharedUI/Controls/ScriptEditorControl.xaml.cs @@ -78,11 +78,9 @@ namespace Tango.SharedUI.Controls public partial class ScriptEditorControl : UserControl { private CompletionWindow completionWindow; - private bool textChanged; + public ScriptEditorControl() { - HighlightTypes = new ObservableCollection<Type>(); - InitializeComponent(); textEditor.TextArea.IndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.CSharp.CSharpIndentationStrategy(); @@ -120,9 +118,12 @@ namespace Tango.SharedUI.Controls types.Add(new KeyValuePair<string, Type>("String", typeof(String))); types.Add(new KeyValuePair<string, Type>("string", typeof(String))); - foreach (var t in HighlightTypes) + if (HighlightTypes != null) { - types.Add(new KeyValuePair<string, Type>(t.Name, t)); + foreach (var t in HighlightTypes) + { + types.Add(new KeyValuePair<string, Type>(t.Key, t.Value)); + } } var type = types.SingleOrDefault(x => x.Key == keyword); @@ -213,22 +214,21 @@ namespace Tango.SharedUI.Controls private void OnTextChanged() { - if (!textChanged) + if (textEditor.Text != Text) { textEditor.Text = Text; - textChanged = true; } } - public ObservableCollection<Type> HighlightTypes + public ObservableCollection<KeyValuePair<string, Type>> HighlightTypes { - get { return (ObservableCollection<Type>)GetValue(HighlightTypesProperty); } + get { return (ObservableCollection<KeyValuePair<string, Type>>)GetValue(HighlightTypesProperty); } set { SetValue(HighlightTypesProperty, value); } } public static readonly DependencyProperty HighlightTypesProperty = - DependencyProperty.Register("HighlightTypes", typeof(ObservableCollection<Type>), typeof(ScriptEditorControl), new PropertyMetadata(null)); + DependencyProperty.Register("HighlightTypes", typeof(ObservableCollection<KeyValuePair<string, Type>>), typeof(ScriptEditorControl), new PropertyMetadata(null)); |
