From cf7af2bc991e99b9dc82f4f54784d0eaa9a043b0 Mon Sep 17 00:00:00 2001 From: Roy Date: Sat, 9 Dec 2017 00:31:12 +0200 Subject: Stubs execution utility almost done. --- .../Controls/ScriptEditorControl.xaml.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (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 0551de699..97ac4f497 100644 --- a/Software/Visual_Studio/Tango.SharedUI/Controls/ScriptEditorControl.xaml.cs +++ b/Software/Visual_Studio/Tango.SharedUI/Controls/ScriptEditorControl.xaml.cs @@ -260,6 +260,28 @@ namespace Tango.SharedUI.Controls public static readonly DependencyProperty SaveCommandProperty = DependencyProperty.Register("SaveCommand", typeof(RelayCommand), typeof(ScriptEditorControl), new PropertyMetadata(null)); + + + public RelayCommand InsertSnippetCommand + { + get { return (RelayCommand)GetValue(InsertSnippetCommandProperty); } + set { SetValue(InsertSnippetCommandProperty, value); } + } + public static readonly DependencyProperty InsertSnippetCommandProperty = + DependencyProperty.Register("InsertSnippetCommand", typeof(RelayCommand), typeof(ScriptEditorControl), new PropertyMetadata(null,(d,e) => (d as ScriptEditorControl).OnInsertScriptCommandChanged())); + + private void OnInsertScriptCommandChanged() + { + if (InsertSnippetCommand != null) + { + InsertSnippetCommand.Executed += (x, snippet) => + { + textEditor.Document.Insert(textEditor.TextArea.Caret.Offset, snippet); + }; + } + } + + #endregion private void textEditor_TextChanged(object sender, EventArgs e) -- cgit v1.3.1