public static BackgroundWorkResult <T> CreateResult(T resultVal) { BackgroundWorkResult <T> result = new BackgroundWorkResult <T>(); result.Result = resultVal; return(result); }
public static BackgroundWorkResult <T> ErrorResult(Exception ex) { BackgroundWorkResult <T> result = new BackgroundWorkResult <T>(); result.Exception = ex; return(result); }
public static BackgroundWork CreateWork(Window window, Action begin, Action func, Action <BackgroundWorkResult> end) { BackgroundWork work = new BackgroundWork(); work.Window = window; work.BeginAction = begin; work.WorkFunction = new Func <int>(() => { func(); return(0); }); work.EndAction = new Action <BackgroundWorkResult <int> >( (result) => { BackgroundWorkResult newResult = new BackgroundWorkResult(result); end(newResult); }); return(work); }