Exemple #1
0
 /// <summary>
 /// Create a new instance of the ContextSwitcher
 /// </summary>
 /// <param name="context">The context to switch. ContextSwitcher stores the initial context.</param>
 /// <param name="path">The path to switc to</param>
 public ContextSwitcher(Context context, string path)
 {
   if (!string.IsNullOrEmpty(path))
   {
     _active = true;
     StoreContext(context);
     _result = context.SetContext(path);
   }
   else
     _result = new CommandResult(CommandStatus.Success, "ContextSwitcher not active");
 }
Exemple #2
0
    protected CommandResult Execute(string command)
    {
      CommandResult result = null;
      try
      {
        // Dispatch the command to the core command handler
        result = _commandHandler.Execute(command.Trim());
      }
      catch (Exception ex)
      {
        result = new CommandResult(CommandStatus.Failure, ex.Message);
      }

      return result;
    }