/// <summary> /// If it is unknown if a Dispatcher is attached, it will determine where to execute the action /// </summary> public async Task DetermineExecutionAsync(Action action) { if (Dispatcher != null) { await VisualTools.OnUIThreadAsync(action); } else { action(); } }
public static async Task ContinueOnUIThreadAsync(this Task Task, CoreDispatcher Dispatcher, Action action) { await Task.ContinueWith(async task => await VisualTools.OnUIThreadAsync(Dispatcher, action)); }