public ActionDispatcherSchedulerHandle()
        {
            this._dispatcher = ActionDispatcher.Current;
            if (this._dispatcher == null)
                throw new InvalidOperationException("No dispatcher running on the current thread.");

            this.SynchronizationContext = SynchronizationContext.Current;
        }
 /// <summary>
 ///     Initializes a new instance of the <see cref="ActionDispatcherSynchronizationContext" /> class by using the
 ///     specified <see cref="ActionDispatcherSynchronizationContext.ActionDispatcher" />.
 /// </summary>
 /// <param name="actionDispatcher">The action queue to associate with this <see cref="BotBits" />.</param>
 public ActionDispatcherSynchronizationContext(ActionDispatcher actionDispatcher)
 {
     this.ActionDispatcher = actionDispatcher;
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="BotBitsSynchronizationContext" /> class by using the
 ///     specified <see cref="BotBitsSynchronizationContext.ActionDispatcher" />.
 /// </summary>
 /// <param name="actionDispatcher">The action queue to associate with this <see cref="BotBits" />.</param>
 internal BotBitsSynchronizationContext(ActionDispatcher actionDispatcher)
 {
     this.ActionDispatcher = actionDispatcher;
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="ActionDispatcherSynchronizationContext" /> class by using the
 ///     specified <see cref="ActionDispatcherSynchronizationContext.ActionDispatcher" />.
 /// </summary>
 /// <param name="actionDispatcher">The action queue to associate with this <see cref="BotBits" />.</param>
 public ActionDispatcherSynchronizationContext(ActionDispatcher actionDispatcher)
 {
     this.ActionDispatcher = actionDispatcher;
 }
Exemplo n.º 5
0
 internal static void RunDispatcher(Action<ActionDispatcher> task)
 {
     var dispatcher = new ActionDispatcher();
     dispatcher.QueueAction(() => task(dispatcher));
     dispatcher.Run();
 }