diff options
| author | Shai Frieder <Shai.Frieder@twine-s.com> | 2019-04-15 11:44:09 +0300 |
|---|---|---|
| committer | Shai Frieder <Shai.Frieder@twine-s.com> | 2019-04-15 11:44:09 +0300 |
| commit | 64e2776e794d752daaeb06121492744266f65a23 (patch) | |
| tree | 00bed37becbcea5b31b9879c7341c7f0e2bb3ce1 /Software/Visual_Studio/Scripting/Tango.Scripting.Editors/TextEditorWeakEventManager.cs | |
| parent | 49db61f198119289433e1f2e35b97e011c47aefe (diff) | |
| parent | aa5ba8c457c3722cf215c2992a0b03f310afd1c1 (diff) | |
| download | Tango-64e2776e794d752daaeb06121492744266f65a23.tar.gz Tango-64e2776e794d752daaeb06121492744266f65a23.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/Scripting/Tango.Scripting.Editors/TextEditorWeakEventManager.cs')
| -rw-r--r-- | Software/Visual_Studio/Scripting/Tango.Scripting.Editors/TextEditorWeakEventManager.cs | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/TextEditorWeakEventManager.cs b/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/TextEditorWeakEventManager.cs new file mode 100644 index 000000000..87057ead4 --- /dev/null +++ b/Software/Visual_Studio/Scripting/Tango.Scripting.Editors/TextEditorWeakEventManager.cs @@ -0,0 +1,52 @@ +// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) +// This code is distributed under the GNU LGPL (for details please see \doc\license.txt) + +using Tango.Scripting.Editors.Utils; +using System; + +namespace Tango.Scripting.Editors +{ + /// <summary> + /// Contains weak event managers for <see cref="ITextEditorComponent"/>. + /// </summary> + public static class TextEditorWeakEventManager + { + /// <summary> + /// Weak event manager for the <see cref="ITextEditorComponent.DocumentChanged"/> event. + /// </summary> + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")] + public sealed class DocumentChanged : WeakEventManagerBase<DocumentChanged, ITextEditorComponent> + { + /// <inheritdoc/> + protected override void StartListening(ITextEditorComponent source) + { + source.DocumentChanged += DeliverEvent; + } + + /// <inheritdoc/> + protected override void StopListening(ITextEditorComponent source) + { + source.DocumentChanged -= DeliverEvent; + } + } + + /// <summary> + /// Weak event manager for the <see cref="ITextEditorComponent.OptionChanged"/> event. + /// </summary> + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")] + public sealed class OptionChanged : WeakEventManagerBase<OptionChanged, ITextEditorComponent> + { + /// <inheritdoc/> + protected override void StartListening(ITextEditorComponent source) + { + source.OptionChanged += DeliverEvent; + } + + /// <inheritdoc/> + protected override void StopListening(ITextEditorComponent source) + { + source.OptionChanged -= DeliverEvent; + } + } + } +} |
