private void btnFindModel_Click(object sender, EventArgs e) { DataTable robotModels; IRobotModelsHandler robotModelsHandler; IList <TextBox> parametersTextBoxes = new List <TextBox> { txtNumberOfAxis, txtReach, txtPayload }; ParametersHandler parametersHandler = new ParametersHandler(parametersTextBoxes); RobotModelType robotModelType = parametersHandler.GetRobotModelType(); IList <Parameter> parameters = null; try { parameters = parametersHandler.GetParameters(); } catch (ParameterTextBoxNotFilledException exception) { MessageBox.Show(exception.Message); return; } catch (ParameterTextBoxInvalidValue exception) { MessageBox.Show(exception.Message); return; } robotModelsHandler = RobotModelFactory.GetRobotModelHandler(robotModelType, parameters, ddlApplicationTypes.SelectedValue.ToString()); robotModels = robotModelsHandler.GetChosenRobotModels(); if (robotModels == null) { MessageBox.Show("Nie udało się pobrać modeli z bazy."); return; } ChosenModelsListForm chosenModelsListForm = new ChosenModelsListForm(robotModels); chosenModelsListForm.OnRobotModelChosen += chosenModelsListForm_OnRobotModelChosen; chosenModelsListForm.ShowDialog(); }
public void setup(string robotModel) { foreach (Type t in this.GetType().Assembly.GetTypes()) { if (t.IsSubclassOf(typeof(Robot))) { functionComboBox.Items.Add(t.Name); } } robot = RobotModelFactory.getRobotModel(robotModel); if (robot != null) { for (int j = 0; j < functionComboBox.Items.Count; j++) { if (functionComboBox.Items[j].ToString().Equals(robot.name)) { functionComboBox.SelectedIndex = j; break; } } } }
private void functionComboBox_SelectedIndexChanged(object sender, EventArgs e) { robot = RobotModelFactory.getRobotModel(functionComboBox.SelectedItem.ToString()); Invalidate(); }