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 | 22 |
1 files changed, 22 insertions, 0 deletions
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<String> InsertSnippetCommand + { + get { return (RelayCommand<String>)GetValue(InsertSnippetCommandProperty); } + set { SetValue(InsertSnippetCommandProperty, value); } + } + public static readonly DependencyProperty InsertSnippetCommandProperty = + DependencyProperty.Register("InsertSnippetCommand", typeof(RelayCommand<String>), 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) |
