using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace TIProDevExtension.ValueEditor { /// /// Often one editor window will feed into the next. This class represents the /// output of an editor window. If you want to know what the user selected in /// a window, get the window's ValueBroadcaster object and subscribe to it. /// /// Note that some windows will continue to transmit updates after the window /// has been closed. Imaging that you're editing a column, so you bring up a /// viewer editor to describe the column. Then in the viewer editor you bring /// up a color editor to set the foreground color. Then you close the viewer /// editor window. You still have the color editor and the column editor open. /// Changes in the color edtior will flow through the viewer editor to the /// column editor, even though the viewer editor was closed. /// /// You listen to a ValueBroadcaster rather than a window because the /// ValueBroadcaster may outlive the window. /// public class ValueBroadcaster { public event Action ValueChanged; private object _value; public object Value { get { return _value; } set { if (value != _value) { _value = value; ValueChanged?.Invoke(_value); } } } } }