本文整理汇总了C#中DispatcherPriority类的典型用法代码示例。如果您正苦于以下问题:C# DispatcherPriority类的具体用法?C# DispatcherPriority怎么用?C# DispatcherPriority使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DispatcherPriority类属于命名空间,在下文中一共展示了DispatcherPriority类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: PostAction
public static void PostAction(
this DispatcherObject obj,
Action action,
DispatcherPriority priority = DispatcherPriority.Input)
{
obj.Dispatcher.BeginInvoke(priority, action);
}
开发者ID:modulexcite,项目名称:NZag,代码行数:7,代码来源:DispatcherObjectExtensions.cs
示例2: InvokeIfRequired
public static void InvokeIfRequired(this Dispatcher disp, Action dotIt, DispatcherPriority priority)
{
if (disp.Thread != Thread.CurrentThread)
disp.Invoke(priority, dotIt);
else
dotIt();
}
开发者ID:andrewpros,项目名称:AuroraAssetEditor,代码行数:7,代码来源:WpfControlThreadingExtensions.cs
示例3: InvokeIfRequired
public static void InvokeIfRequired(this Dispatcher dispatcher, Action action, DispatcherPriority priority)
{
if (!dispatcher.CheckAccess())
dispatcher.Invoke(priority, (Delegate) action);
else
action();
}
开发者ID:unbearab1e,项目名称:FlattyTweet,代码行数:7,代码来源:DispatcherExtensions.cs
示例4: LightClawSynchronizationContext
public LightClawSynchronizationContext(Dispatcher dispatcher, DispatcherPriority priority)
{
Contract.Requires<ArgumentNullException>(dispatcher != null);
this.dispatcher = dispatcher;
this.priority = priority;
}
开发者ID:ScianGames,项目名称:Engine,代码行数:7,代码来源:LightClawSynchronizationContext.cs
示例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;
}
开发者ID:Scellow,项目名称:Perspex,代码行数:14,代码来源:DispatcherTimer.cs
示例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;
}
开发者ID:tom-englert,项目名称:TomsToolbox,代码行数:12,代码来源:DispatcherThrottle.cs
示例7: DispatcherOperation
internal DispatcherOperation(Dispatcher dispatcher, Delegate del, DispatcherPriority priority, object[] args)
{
myDispatcher = dispatcher;
myDelegate = del;
myPriority = priority;
myArgs = args;
}
开发者ID:koush,项目名称:Xaml,代码行数:7,代码来源:DispatcherOperation.cs
示例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();
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:46,代码来源:DispatcherTimer.cs
示例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);
}
开发者ID:matteomigliore,项目名称:HSDK,代码行数:32,代码来源:Execution.cs
示例10: DispatcherTimer
public DispatcherTimer(Dispatcher dispatcher, ITaskScheduler scheduler, TimeSpan interval, DispatcherPriority priority)
{
this.dispatcher = dispatcher;
this.scheduler = scheduler;
this.Interval = interval;
this.Priority = priority;
}
开发者ID:highzion,项目名称:Granular,代码行数:7,代码来源:DispatcherTimer.cs
示例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;
}
开发者ID:Mike-EEE,项目名称:Perspex,代码行数:14,代码来源:DispatcherTimer.cs
示例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();
}
开发者ID:saeed-kamyabi,项目名称:EsmFamil,代码行数:10,代码来源:Threading.cs
示例13: Invoke
public virtual void Invoke(DispatcherPriority priority, Delegate method, object arg)
{
if (!this.uiThreadDispatcher.HasShutdownStarted)
{
this.uiThreadDispatcher.Invoke(priority, method, arg);
}
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:7,代码来源:UIThreadDispatcher.cs
示例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;
}
开发者ID:nobled,项目名称:mono,代码行数:7,代码来源:DispatcherOperation.cs
示例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);
}
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:7,代码来源:UIThreadDispatcher.cs
示例16: DispatchFrame
public static void DispatchFrame(DispatcherPriority priority = DispatcherPriority.Background)
{
DispatcherFrame frame = new DispatcherFrame();
Dispatcher.CurrentDispatcher.BeginInvoke(priority,
new DispatcherOperationCallback((f)=>((DispatcherFrame)f).Continue = false), frame);
Dispatcher.PushFrame(frame);
}
开发者ID:SonarSource-VisualStudio,项目名称:sonarlint-visualstudio,代码行数:7,代码来源:DispatcherHelper.cs
示例17: Invoke
public static void Invoke(
this IDispatcherService dispatcher,
Action action,
DispatcherPriority priority
)
{
dispatcher.Invoke(action, priority);
}
开发者ID:CosminLazar,项目名称:SystemWrapper,代码行数:8,代码来源:DispatcherServiceExtensions.cs
示例18: BeginInvoke
public static DispatcherOperation BeginInvoke(
this IDispatcherService dispatcher,
Action action,
DispatcherPriority priority
)
{
return dispatcher.BeginInvoke(action, priority);
}
开发者ID:CosminLazar,项目名称:SystemWrapper,代码行数:8,代码来源:DispatcherServiceExtensions.cs
示例19: DispatcherTimer
public DispatcherTimer(TimeSpan interval, DispatcherPriority priority,
EventHandler callback, Dispatcher dispatcher)
{
this.priority = priority;
this.target_dispatcher = dispatcher;
this.interval = interval.Ticks;
this.callback = callback;
}
开发者ID:shahid-pk,项目名称:MonoPresentationFoundation,代码行数:8,代码来源:DispatcherTimer.cs
示例20: DoEvents
public static void DoEvents(DispatcherPriority nPrio)
{
DispatcherFrame nestedFrame = new DispatcherFrame();
DispatcherOperation exitOperation = Dispatcher.CurrentDispatcher.BeginInvoke(nPrio, exitFrameCallback, nestedFrame);
Dispatcher.PushFrame(nestedFrame);
if (exitOperation.Status != DispatcherOperationStatus.Completed)
exitOperation.Abort();
}
开发者ID:Slesa,项目名称:Playground,代码行数:8,代码来源:ReportPresenter.cs
注:本文中的DispatcherPriority类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论