GuiDispatcher
Ecng.Xaml
バッチ処理と定期的な実行サポートでWPF UIスレッドにアクションをマーシャリングするディスパッチ・実装。
継承元: Disposable
実装: IDispatcher
コンストラクター
GuiDispatcher
public GuiDispatcher()
guiDispatcher = GuiDispatcher()
スレッドディスパッチャを使用してGuiDispatcherクラスの新しいインスタンスを初期化します。
GuiDispatcher
public GuiDispatcher(Dispatcher dispatcher)
guiDispatcher = GuiDispatcher(dispatcher)
GuiDispatcherクラスの新しいインスタンスを初期化します。
- dispatcher
- UIスレッドディスパッチャインスタンス。
プロパティ
Dispatcher
public Dispatcher Dispatcher { get; }
value = guiDispatcher.Dispatcher
UIスレッドディスパッチャインスタンスを取得します。
GlobalDispatcher
public static GuiDispatcher GlobalDispatcher { get; }
value = GuiDispatcher.GlobalDispatcher
GuiDispatcher@のグローバルシングルトンインスタンスを取得します。
Interval
public TimeSpan Interval { get; set; }
value = guiDispatcher.Interval
guiDispatcher.Interval = value
バッチ処理間隔を取得または設定します。デフォルトは1 msです。
MaxPeriodicalActionErrors
public int MaxPeriodicalActionErrors { get; set; }
value = guiDispatcher.MaxPeriodicalActionErrors
guiDispatcher.MaxPeriodicalActionErrors = value
削除される前に、定期的なアクションで許可されるエラーの最大数を取得または設定します。 -1 を使用して制限を無効にします。
PendingActionsCount
public int PendingActionsCount { get; }
value = guiDispatcher.PendingActionsCount
処理を待ち受けるアクションの数を取得します。
メソッド
AddAction
public void AddAction(Action action)
guiDispatcher.AddAction(action)
UI スレッドで実行するためのアクションをキューイングします。
- action
- 実行するアクション。
AddPeriodicalAction
public IDisposable AddPeriodicalAction(Action action)
result = guiDispatcher.AddPeriodicalAction(action)
各ディスパッチャティックで実行される周期的なアクションを追加します。削除するために使用できるトークンを返します。
- action
- 実行するアクション。
戻り値: アクションを削除するために使用できるトークン。
AddSyncAction
public void AddSyncAction(Action action)
guiDispatcher.AddSyncAction(action)
UI スレッドで指定されたアクションを同期的に実行します。
- action
- 実行するアクション。
AddSyncAction``1
public T AddSyncAction<T>(Func<T> action)
result = guiDispatcher.AddSyncAction(action)
UI スレッドで指定された関数を同期的に実行し、結果を返します。
- action
- 実行する関数。
戻り値: 関数結果。
DisposeManaged
protected override void DisposeManaged()
guiDispatcher.DisposeManaged()
管理されたリソースを解放します。
FlushPendingActions
public void FlushPendingActions()
guiDispatcher.FlushPendingActions()
キューされたすべてのアクションの即時処理をリクエストします。
InitGlobalDispatcher
public static void InitGlobalDispatcher()
GuiDispatcher.InitGlobalDispatcher()
未作成の場合には、グローバルディスパッチャを初期化します。
InvokePeriodically
public IDisposable InvokePeriodically(Action action, TimeSpan interval)
result = guiDispatcher.InvokePeriodically(action, interval)
イベント
Error
public event Action<Exception> Error
guiDispatcher.Error += handler
アクションの実行中にエラーが発生したときにレイズされます。