本文整理汇总了C#中DispatcherPriority类的典型用法代码示例。如果您正苦于以下问题:C# DispatcherPriority类的具体用法?C# DispatcherPriority怎么用?C# DispatcherPriority使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DispatcherPriority类属于命名空间,在下文中一共展示了DispatcherPriority类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PostAction
public static void PostAction(
this DispatcherObject obj,
Action action,
DispatcherPriority priority = DispatcherPriority.Input)
{
obj.Dispatcher.BeginInvoke(priority, action);
}
示例2: InvokeIfRequired
public static void InvokeIfRequired(this Dispatcher disp, Action dotIt, DispatcherPriority priority)
{
if (disp.Thread != Thread.CurrentThread)
disp.Invoke(priority, dotIt);
else
dotIt();
}
示例3: InvokeIfRequired
public static void InvokeIfRequired(this Dispatcher dispatcher, Action action, DispatcherPriority priority)
{
if (!dispatcher.CheckAccess())
dispatcher.Invoke(priority, (Delegate) action);
else
action();
}
示例4: LightClawSynchronizationContext
public LightClawSynchronizationContext(Dispatcher dispatcher, DispatcherPriority priority)
{
Contract.Requires<ArgumentNullException>(dispatcher != null);
this.dispatcher = dispatcher;
this.priority = priority;
}
示例5: DispatcherTimer
/// <summary>
/// Initializes a new instance of the <see cref="DispatcherTimer"/> class.
/// </summary>
/// <param name="interval">The interval at which to tick.</param>
/// <param name="priority">The priority to use.</param>
/// <param name="dispatcher">The dispatcher to use.</param>
/// <param name="callback">The event to call when the timer ticks.</param>
public DispatcherTimer(TimeSpan interval, DispatcherPriority priority, EventHandler callback, Dispatcher dispatcher)
{
this.priority = priority;
this.Dispatcher = dispatcher;
this.Interval = interval;
this.Tick += callback;
}
示例6: DispatcherThrottle
/// <summary>
/// Initializes a new instance of the <see cref="DispatcherThrottle" /> class.
/// </summary>
/// <param name="priority">The priority of the dispatcher.</param>
/// <param name="target">The target action to invoke when the throttle condition is hit.</param>
public DispatcherThrottle(DispatcherPriority priority, [NotNull] Action target)
{
Contract.Requires(target != null);
_target = target;
_priority = priority;
}
示例7: DispatcherOperation
internal DispatcherOperation(Dispatcher dispatcher, Delegate del, DispatcherPriority priority, object[] args)
{
myDispatcher = dispatcher;
myDelegate = del;
myPriority = priority;
myArgs = args;
}
示例8: DispatcherTimer
/// <summary>
/// Creates a timer that is bound to the specified dispatcher and
/// will be processed at the specified priority, after the
/// specified timeout.
/// </summary>
/// <param name="interval">
/// The interval to tick the timer after.
/// </param>
/// <param name="priority">
/// The priority to process the timer at.
/// </param>
/// <param name="callback">
/// The callback to call when the timer ticks.
/// </param>
/// <param name="dispatcher">
/// The dispatcher to use to process the timer.
/// </param>
public DispatcherTimer(TimeSpan interval, DispatcherPriority priority, EventHandler callback, Dispatcher dispatcher) // NOTE: should be Priority
{
//
if(callback == null)
{
throw new ArgumentNullException("callback");
}
if(dispatcher == null)
{
throw new ArgumentNullException("dispatcher");
}
if (interval.TotalMilliseconds < 0)
throw new ArgumentOutOfRangeException("interval", SR.Get(SRID.TimeSpanPeriodOutOfRange_TooSmall));
if (interval.TotalMilliseconds > Int32.MaxValue)
throw new ArgumentOutOfRangeException("interval", SR.Get(SRID.TimeSpanPeriodOutOfRange_TooLarge));
Initialize(dispatcher, priority, interval);
Tick += callback;
Start();
}
示例9: Execute
public void Execute(Delegate method, DispatcherPriority priority)
{
if (application == null)
{
ExecuteDirectlyOrDuringATest(method);
return;
}
var dispatcher = application.Dispatcher;
if ((application != null) && isAsync)
{
dispatcher.BeginInvoke(method);
return;
}
var notRequireUiThread = dispatcher.CheckAccess();
if (notRequireUiThread)
{
ExecuteDirectlyOrDuringATest(method);
return;
}
if (isAsync)
{
dispatcher.BeginInvoke(method, priority);
return;
}
dispatcher.Invoke(method, priority);
}
示例10: DispatcherTimer
public DispatcherTimer(Dispatcher dispatcher, ITaskScheduler scheduler, TimeSpan interval, DispatcherPriority priority)
{
this.dispatcher = dispatcher;
this.scheduler = scheduler;
this.Interval = interval;
this.Priority = priority;
}
示例11: DispatcherTimer
/// <summary>
/// Initializes a new instance of the <see cref="DispatcherTimer"/> class.
/// </summary>
/// <param name="interval">The interval at which to tick.</param>
/// <param name="priority">The priority to use.</param>
/// <param name="dispatcher">The dispatcher to use.</param>
/// <param name="callback">The event to call when the timer ticks.</param>
public DispatcherTimer(TimeSpan interval, DispatcherPriority priority, EventHandler callback, Dispatcher dispatcher)
{
_priority = priority;
Dispatcher = dispatcher;
Interval = interval;
Tick += callback;
}
示例12: InvokeIfRequired
/// <summary>
/// for UI methods to switch current thread to UI thread
/// </summary>
public static void InvokeIfRequired(this DispatcherObject control, Action methodcall, DispatcherPriority priorityForCall)
{
if (control.Dispatcher.Thread != Thread.CurrentThread)
control.Dispatcher.Invoke(priorityForCall, methodcall);
else
methodcall();
}
示例13: Invoke
public virtual void Invoke(DispatcherPriority priority, Delegate method, object arg)
{
if (!this.uiThreadDispatcher.HasShutdownStarted)
{
this.uiThreadDispatcher.Invoke(priority, method, arg);
}
}
示例14: DispatcherOperation
internal DispatcherOperation (Dispatcher dis, DispatcherPriority prio, Delegate d, object arg)
: this (dis, prio)
{
delegate_method = d;
delegate_args = new object [1];
delegate_args [0] = arg;
}
示例15: BeginInvoke
public virtual void BeginInvoke(DispatcherPriority priority, Delegate method, object arg, params object[] args)
{
if (!this.uiThreadDispatcher.HasShutdownStarted)
{
this.uiThreadDispatcher.BeginInvoke(priority, method, arg, args);
}
}