private void CmdButton_Click(object sender, RoutedEventArgs e) { AgentController controller = (sender as Button).DataContext as AgentController; controller.AvailableCommand.AgentName = controller.Name; Command finalCommand = controller.AvailableCommand; if (controller.AvailableCommand is RunCommand) { WatchParametersDialog dlg = new WatchParametersDialog(); dlg.Owner = this; bool? result = dlg.ShowDialog(); if (result == true) { WatchCommand cmd = new WatchCommand(); cmd.AgentName = controller.AvailableCommand.AgentName; cmd.RedStrategy = dlg.Settings.RedStrategy.Name; cmd.YellowStrategy = dlg.Settings.YellowStrategy.Name; cmd.P1 = dlg.Settings.P1; cmd.P2 = dlg.Settings.P2; finalCommand = cmd; } else { return; } } m_Client.Execute(finalCommand); RefreshAgentList(); }
public RunCommand(WatchCommand watchCmd, GuardCommand guardCmd) { Name = "Watch / Guard"; }