Exemplo n.º 1
0
        /// <summary>
        /// Convenience method for creating an HabaneroBackgroundWorker.
        /// </summary>
        /// <param name="dispatcher"></param>
        /// <param name="data"></param>
        /// <param name="backgroundWorker"></param>
        /// <param name="onSuccess"></param>
        /// <param name="onCancel"></param>
        /// <param name="onException"></param>
        /// <returns></returns>
        public static HabaneroBackgroundWorker Run(IActionDispatcher dispatcher, ConcurrentDictionary <string, object> data, BackgroundWorkerMethodDelegate backgroundWorker, UIWorkerMethodDelegate onSuccess, UIWorkerMethodDelegate onCancel, BackgroundWorkerExceptionHandlerDelegate onException)
        {
            var runner = new HabaneroBackgroundWorker()
            {
                ActionDispatcher = dispatcher,
                BackgroundWorker = backgroundWorker,
                OnSuccess        = onSuccess,
                OnCancelled      = onCancel,
                OnException      = onException,
                Data             = data
            };

            runner.Run();
            return(runner);
        }
 public static HabaneroBackgroundWorker Run(IActionDispatcher dispatcher, ConcurrentDictionary<string, object> data, BackgroundWorkerMethodDelegate backgroundWorker, UIWorkerMethodDelegate onSuccess, UIWorkerMethodDelegate onCancel, BackgroundWorkerExceptionHandlerDelegate onException)
 {
     var runner = new HabaneroBackgroundWorker()
         {
             ActionDispatcher = dispatcher,
             BackgroundWorker = backgroundWorker,
             OnSuccess = onSuccess,
             OnCancelled = onCancel,
             OnException = onException,
             Data = data
         };
     runner.Run();
     return runner;
 }