Beispiel #1
0
        public CommandTask <TResult2> ContinueWith <TResult2>(Func <CmdResult <TResult2> > func)
        {
            CommandTask <TResult2> newCmd = new CommandTask <TResult2>
            {
                Command = () =>
                {
                    CmdResult res = GetResult();
                    if (res.Success)
                    {
                        return(func());
                    }
                    return(new CmdResult <TResult2> {
                        ErrorMessage = res.ErrorMessage, Success = false
                    });
                }
            };

            return(newCmd);
        }
 public static CommandTask StartNew(CmdResult result)
 {
     return(new CommandTask {
         Command = () => result
     });
 }