protected void OnExecuteOperation(Operation operation) { if (operation != null) { NaoCoopApp.Views.RobotSelectionView robotSelectionView = new Views.RobotSelectionView(); robotSelectionView.ShowDialog(); if (robotSelectionView.DialogResult == DialogResult.Ok) { // collect the robots to be used in the operation // start the operation NaoCoopApp.Views.OperationExecutionView operationExecutionView = new Views.OperationExecutionView(operation, robotSelectionView.SelectedRobots.ToArray()); try { // validate the execution operationExecutionView.ValidateExecution(); } catch (Exception ex) { MessageBox.Show("The execution is not valid. " + ex.Message); return; } operationExecutionView.ShowDialog(); } } }
protected void OnOkCommand(Views.RobotSelectionView robotSelectionView) { // set the selected robots foreach (var robot in AvailableRobots) { if (robot.Selected) { robotSelectionView.SelectedRobots.Add(robot); } } robotSelectionView.DialogResult = DialogResult.Ok; robotSelectionView.Close(); }
protected void OnCancelCommand(Views.RobotSelectionView robotSelectionView) { robotSelectionView.DialogResult = DialogResult.Cancel; robotSelectionView.Close(); }