public static AsyncActionUpdate Create(PlaceholderAction placeholder, ActionPriority priority, Func <ActionUpdateResult> task) { return(new AsyncActionUpdate(placeholder, priority, Task.Run <ActionUpdateResult>(() => { return task(); }) )); }
private AsyncActionUpdate(PlaceholderAction placeholder, ActionPriority priority, Task <ActionUpdateResult> updateTask) { if (placeholder == null) { throw new ArgumentNullException(nameof(placeholder)); } Priority = priority; Placeholder = placeholder; UpdateTask = updateTask; if (UpdateTask.Status == TaskStatus.Created) { UpdateTask.Start(); } }
public static AsyncActionUpdate Create(PlaceholderAction placeholder, ActionPriority priority, Func <Task <ActionUpdateResult> > task) { return(new AsyncActionUpdate(placeholder, priority, task())); }