namespace JD.Threading.Dispatch { public interface IThreadDispatchStrategy { #region Properties /// /// Returns false if the property is called on the main thread of the strategy (usually the UI thread). /// bool InvokeRequired { get; } /// /// Returns false if the property is called on any thread managed by the strategy (usually the UI thread AND the long operation thread). /// bool LongOperationInvokeRequired { get; } #endregion #region Methods /// /// Dispatches the given synchronously. /// void Dispatch(System.Action action); /// /// Dispatches the given asynchronously, if possible. Otherwise, dispatch it synchronously. /// void DispatchAsync(System.Action action, bool forceAsync); /// /// Creates a spacetime rift to allow the to run while the UI thread still feels responsive to the user. /// Blocks until the operation is finished. /// /// /// Effectively, there is only one thread operating on the data at the same time, but the UI thread will keep on responding to /// a limited set of Win32 messages to mimic responsiveness. /// void DoLongOperation(System.Action action); /// /// Creates a spacetime rift to allow the to run while the UI thread still feels responsive to the user. /// Returns immediately. To be effective, you must return control as soon as possible to the message loop. In other words, don't /// temper with the data after calling this method. /// /// /// Effectively, there is only one thread operating on the data at the same time, but the UI thread will keep on responding to /// a limited set of Win32 messages to mimic responsiveness. /// void DoLongOperationAsync(System.Action action); #endregion } }