diff options
Diffstat (limited to 'Software/Visual_Studio/Tango.SharedUI/Controls/ScriptEditorControl.xaml.cs')
| -rw-r--r-- | Software/Visual_Studio/Tango.SharedUI/Controls/ScriptEditorControl.xaml.cs | 20 |
1 files changed, 10 insertions, 10 deletions
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)); |
