Exemplo n.º 1
0
        public static BackgroundWorkResult <T> CreateResult(T resultVal)
        {
            BackgroundWorkResult <T> result = new BackgroundWorkResult <T>();

            result.Result = resultVal;
            return(result);
        }
Exemplo n.º 2
0
        public static BackgroundWorkResult <T> ErrorResult(Exception ex)
        {
            BackgroundWorkResult <T> result = new BackgroundWorkResult <T>();

            result.Exception = ex;
            return(result);
        }
Exemplo n.º 3
0
        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);
        }