public void BeginInvoke(DispatcherPrio priority, Action method) { // Don't call method() here if disp.CheckAccess() is true. That could lead to some // problems, eg. a file gets removed, the BP list gets saved and a file gets added, // causing an exception. if (disp.HasShutdownFinished || disp.HasShutdownStarted) method(); else disp.BeginInvoke(Convert(priority), method); }
DispatcherPriority Convert(DispatcherPrio priority) { switch (priority) { case DispatcherPrio.ContextIdle: return DispatcherPriority.ContextIdle; case DispatcherPrio.Background: return DispatcherPriority.Background; case DispatcherPrio.Loaded: return DispatcherPriority.Loaded; case DispatcherPrio.Send: return DispatcherPriority.Send; default: Debug.Fail("Unknown prio"); return DispatcherPriority.Background; } }
public void BeginInvoke(DispatcherPrio priority, Action method) { // Don't call method() here if disp.CheckAccess() is true. That could lead to some // problems, eg. a file gets removed, the BP list gets saved and a file gets added, // causing an exception. if (disp.HasShutdownFinished || disp.HasShutdownStarted) { method(); } else { disp.BeginInvoke(Convert(priority), method); } }
DispatcherPriority Convert(DispatcherPrio priority) { switch (priority) { case DispatcherPrio.ContextIdle: return(DispatcherPriority.ContextIdle); case DispatcherPrio.Background: return(DispatcherPriority.Background); case DispatcherPrio.Loaded: return(DispatcherPriority.Loaded); case DispatcherPrio.Send: return(DispatcherPriority.Send); default: Debug.Fail("Unknown prio"); return(DispatcherPriority.Background); } }
public void BeginInvoke(DispatcherPrio priority, Action method) { method(); }