Ejemplo n.º 1
0
        public static async Task <WorkResult <T> > RunAsync <T>(this IWorkCommand <T> command, string workblob, IProgress <IWorkProgress <T> > progress = null, CancellationToken token = default(CancellationToken)) where T : IWorkUnit
        {
            T workunit = await command.DeserializeAsync(workblob);

            if (workunit != null)
            {
                return(await command.RunAsync(workunit, progress, token));
            }
            return(new WorkResult <T>(WorkResultStatus.Error, "Unable to deserialize workblob"));
        }
Ejemplo n.º 2
0
 public static WorkResult <T> Run <T>(this IWorkCommand <T> command, string workblob, IProgress <IWorkProgress <T> > progress = null, CancellationToken token = default(CancellationToken)) where T : IWorkUnit
 {
     return(Task.Run(async() => await command.RunAsync(workblob, progress, token), token).Result);
 }