public static void Execute(string title, Action <Action <long>, Action <long> > action, UiProgressUnits units = UiProgressUnits.Items) { using (UiProgressWindow window = new UiProgressWindow(title, units)) { Task.Run(() => ExecuteAction(window, action)); window.ShowDialog(); } }
public static T Execute <T>(string title, Func <Action <long>, Action <long>, T> action, UiProgressUnits units = UiProgressUnits.Items) { using (UiProgressWindow window = new UiProgressWindow(title, units)) { Task <T> task = Task.Run(() => ExecuteFunction(window, action)); window.ShowDialog(); return(task.Result); } }
public static void Execute(string title, IProgressSender progressSender, Action action, UiProgressUnits units = UiProgressUnits.Items) { using (UiProgressWindow window = new UiProgressWindow(title, units)) { progressSender.ProgressTotalChanged += window.SetTotal; progressSender.ProgressIncremented += window.Incremented; Task.Run(() => ExecuteAction(window, action)); window.ShowDialog(); } }
public static T Execute <T>(string title, IProgressSender progressSender, Func <T> func, UiProgressUnits units = UiProgressUnits.Items) { using (UiProgressWindow window = new UiProgressWindow(title, units)) { progressSender.ProgressTotalChanged += window.SetTotal; progressSender.ProgressIncremented += window.Incremented; Task <T> task = Task.Run(() => ExecuteFunction(window, func)); window.ShowDialog(); return(task.Result); } }