private void OnControlPlanCancel(object sender, ServerCommandEventArgs e) { string planType = e.Command.GetArgumentValue <string>("planType"); Int32 planId = e.Command.GetArgumentValue <Int32>("planId"); if (!IsPlanRunning(planType, planId)) { string msg = Commands.ReportError(0, "{0} plan #{1} is not running", planType.ToTitleCase(), planId); Handler.Send(e.Context, msg); return; } // Send to executor string executorClientName = Commands.BuildClientName(planType, planId); ClientState executor = Handler.GetClientState(executorClientName); if (executor == null) { string msg = Commands.ReportError(0, "Executor for {0} plan #{1} doesn't seem to be running", planType.ToTitleCase(), planId); Handler.Send(e.Context, msg); return; } Handler.Send(executor.Context, Commands.ExecutorCancelPlan()); }