Example #1
0
        public async Task <T> Run()
        {
            if (CommandRan)
            {
                throw new Exception("This command has already been run");
            }
            CommandRan = true;

            CommandCompleteEventArgs <T> output = new CommandCompleteEventArgs <T>();

            try
            {
                output.Result = await RunInternal();
            }
            catch (Exception e)
            {
                output.Error = e;
            }

            if (OnCommandComplete != null)
            {
                OnCommandComplete(this, output);
            }

            return(output.Result);
        }
Example #2
0
 private void P_Exited(object sender, EventArgs e)
 {
     if (OnCommandComplete != null)
     {
         CommandCompleteEventArgs <T> ev = new CommandCompleteEventArgs <T>();
         OnCommandComplete(this, ev);
     }
 }