public override void OnCommandExecuting(ICommandExecutingContext commandContext) { var session = commandContext.Session as MyAppSession; //If the session is not logged in, cancel the executing of the command if (!session.IsLoggedIn) commandContext.Cancel = true; }
public override void OnCommandExecuting(ICommandExecutingContext commandContext) { var session = commandContext.Session as MyAppSession; //If the session is not logged in, cancel the executing of the command if (!session.IsLoggedIn) { commandContext.Cancel = true; } }
public override void OnCommandExecuted(ICommandExecutingContext commandContext) { var session = commandContext.Session; var startTime = session.Items.GetValue <DateTime>("StartTime"); var ts = DateTime.Now.Subtract(startTime); if (ts.TotalSeconds > 5 && session.Logger.IsInfoEnabled) { session.Logger.InfoFormat("A command '{0}' took {1} seconds!", commandContext.CurrentCommand.Name, ts.ToString()); } }
public override void OnCommandExecuted(ICommandExecutingContext commandContext) { var session = commandContext.Session; var startTime = session.Items.GetValue<DateTime>("StartTime"); var ts = DateTime.Now.Subtract(startTime); if (ts.TotalSeconds > 5 && session.Logger.IsInfoEnabled) { session.Logger.InfoFormat("A command '{0}' took {1} seconds!", commandContext.CurrentCommand.Name, ts.ToString()); } }
public override void OnCommandExecuted(ICommandExecutingContext commandContext) { Interlocked.Increment(ref m_Total); }
public override void OnCommandExecuting(ICommandExecutingContext commandContext) { }
public override void OnCommandExecuting(ICommandExecutingContext commandContext) { commandContext.Session.Items["StartTime"] = DateTime.Now; }
/// <summary> /// Called when [command executed]. /// </summary> /// <param name="commandContext">The command context.</param> public abstract void OnCommandExecuted(ICommandExecutingContext commandContext);