From db4db5d05b42cbc795b3a38bba3e6c87f30d583f Mon Sep 17 00:00:00 2001 From: Roy Date: Fri, 8 Dec 2017 00:54:27 +0200 Subject: Stubs scripting improvements. --- .../Controls/ScriptEditorControl.xaml.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'Software/Visual_Studio/Tango.SharedUI/Controls/ScriptEditorControl.xaml.cs') 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(); - InitializeComponent(); textEditor.TextArea.IndentationStrategy = new ICSharpCode.AvalonEdit.Indentation.CSharp.CSharpIndentationStrategy(); @@ -120,9 +118,12 @@ namespace Tango.SharedUI.Controls types.Add(new KeyValuePair("String", typeof(String))); types.Add(new KeyValuePair("string", typeof(String))); - foreach (var t in HighlightTypes) + if (HighlightTypes != null) { - types.Add(new KeyValuePair(t.Name, t)); + foreach (var t in HighlightTypes) + { + types.Add(new KeyValuePair(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 HighlightTypes + public ObservableCollection> HighlightTypes { - get { return (ObservableCollection)GetValue(HighlightTypesProperty); } + get { return (ObservableCollection>)GetValue(HighlightTypesProperty); } set { SetValue(HighlightTypesProperty, value); } } public static readonly DependencyProperty HighlightTypesProperty = - DependencyProperty.Register("HighlightTypes", typeof(ObservableCollection), typeof(ScriptEditorControl), new PropertyMetadata(null)); + DependencyProperty.Register("HighlightTypes", typeof(ObservableCollection>), typeof(ScriptEditorControl), new PropertyMetadata(null)); -- cgit v1.3.1