public CommandResult Execute(IExecutionContext context) { try { CheckForPendingCancel(context); ShowUserInfo(context, UserInfoState.Running); CommandResult result = Do(context); ShowUserInfo(context, UserInfoState.Success); return(result); } catch (PackageExecutionCancelledException) { ShowUserInfo(context, UserInfoState.Fault); throw; } catch (Exception ex) { switch (ErrorLevel) { case CommandErrorLevel.StopExecution: ShowUserInfo(context, UserInfoState.Fault); throw; case CommandErrorLevel.SkipError: break; case CommandErrorLevel.AppendLog: context.Log.AddLogException(ex); break; case CommandErrorLevel.AskUser: string message = ex.Message + " при выполнении команды " + GetHumanReadableName(); if (!context.AskUserToSkipError(message)) { ShowUserInfo(context, UserInfoState.Fault); throw; } break; } ShowUserInfo(context, UserInfoState.Dismiss); return(CommandResult.Next); } }