private void loopAction_SelectionChangeCommitted(object sender, EventArgs e) { DataGridView loopActionParameterBox = _loopGridViewHelper; BeginLoopCommand cmd = this; DataTable actionParameters = cmd.v_ActionParameterTable; //sender is null when command is updating if (sender != null) { actionParameters.Rows.Clear(); } DataGridViewComboBoxCell comparisonComboBox; //remove if exists if (_recorderControl.Visible) { _recorderControl.Hide(); } switch (_actionDropdown.SelectedItem) { case "Value Compare": case "Date Compare": loopActionParameterBox.Visible = true; if (sender != null) { actionParameters.Rows.Add("Value1", ""); actionParameters.Rows.Add("Operand", ""); actionParameters.Rows.Add("Value2", ""); loopActionParameterBox.DataSource = actionParameters; } //combobox cell for Variable Name comparisonComboBox = new DataGridViewComboBoxCell(); comparisonComboBox.Items.Add("is equal to"); comparisonComboBox.Items.Add("is greater than"); comparisonComboBox.Items.Add("is greater than or equal to"); comparisonComboBox.Items.Add("is less than"); comparisonComboBox.Items.Add("is less than or equal to"); comparisonComboBox.Items.Add("is not equal to"); //assign cell as a combobox loopActionParameterBox.Rows[1].Cells[1] = comparisonComboBox; break; case "Variable Compare": loopActionParameterBox.Visible = true; if (sender != null) { actionParameters.Rows.Add("Value1", ""); actionParameters.Rows.Add("Operand", ""); actionParameters.Rows.Add("Value2", ""); actionParameters.Rows.Add("Case Sensitive", "No"); loopActionParameterBox.DataSource = actionParameters; } //combobox cell for Variable Name comparisonComboBox = new DataGridViewComboBoxCell(); comparisonComboBox.Items.Add("contains"); comparisonComboBox.Items.Add("does not contain"); comparisonComboBox.Items.Add("is equal to"); comparisonComboBox.Items.Add("is not equal to"); //assign cell as a combobox loopActionParameterBox.Rows[1].Cells[1] = comparisonComboBox; comparisonComboBox = new DataGridViewComboBoxCell(); comparisonComboBox.Items.Add("Yes"); comparisonComboBox.Items.Add("No"); //assign cell as a combobox loopActionParameterBox.Rows[3].Cells[1] = comparisonComboBox; break; case "Variable Has Value": loopActionParameterBox.Visible = true; if (sender != null) { actionParameters.Rows.Add("Variable Name", ""); loopActionParameterBox.DataSource = actionParameters; } break; case "Variable Is Numeric": loopActionParameterBox.Visible = true; if (sender != null) { actionParameters.Rows.Add("Variable Name", ""); loopActionParameterBox.DataSource = actionParameters; } break; case "Error Occured": loopActionParameterBox.Visible = true; if (sender != null) { actionParameters.Rows.Add("Line Number", ""); loopActionParameterBox.DataSource = actionParameters; } break; case "Error Did Not Occur": loopActionParameterBox.Visible = true; if (sender != null) { actionParameters.Rows.Add("Line Number", ""); loopActionParameterBox.DataSource = actionParameters; } break; case "Window Name Exists": case "Active Window Name Is": loopActionParameterBox.Visible = true; if (sender != null) { actionParameters.Rows.Add("Window Name", ""); loopActionParameterBox.DataSource = actionParameters; } break; case "File Exists": loopActionParameterBox.Visible = true; if (sender != null) { actionParameters.Rows.Add("File Path", ""); actionParameters.Rows.Add("True When", "It Does Exist"); loopActionParameterBox.DataSource = actionParameters; } //combobox cell for Variable Name comparisonComboBox = new DataGridViewComboBoxCell(); comparisonComboBox.Items.Add("It Does Exist"); comparisonComboBox.Items.Add("It Does Not Exist"); //assign cell as a combobox loopActionParameterBox.Rows[1].Cells[1] = comparisonComboBox; break; case "Folder Exists": loopActionParameterBox.Visible = true; if (sender != null) { actionParameters.Rows.Add("Folder Path", ""); actionParameters.Rows.Add("True When", "It Does Exist"); loopActionParameterBox.DataSource = actionParameters; } //combobox cell for Variable Name comparisonComboBox = new DataGridViewComboBoxCell(); comparisonComboBox.Items.Add("It Does Exist"); comparisonComboBox.Items.Add("It Does Not Exist"); //assign cell as a combobox loopActionParameterBox.Rows[1].Cells[1] = comparisonComboBox; break; case "Web Element Exists": loopActionParameterBox.Visible = true; if (sender != null) { actionParameters.Rows.Add("Selenium Instance Name", "DefaultBrowser"); actionParameters.Rows.Add("Element Search Method", ""); actionParameters.Rows.Add("Element Search Parameter", ""); actionParameters.Rows.Add("Timeout (Seconds)", "30"); actionParameters.Rows.Add("True When", "It Does Exist"); loopActionParameterBox.DataSource = actionParameters; } comparisonComboBox = new DataGridViewComboBoxCell(); comparisonComboBox.Items.Add("It Does Exist"); comparisonComboBox.Items.Add("It Does Not Exist"); //assign cell as a combobox loopActionParameterBox.Rows[4].Cells[1] = comparisonComboBox; comparisonComboBox = new DataGridViewComboBoxCell(); comparisonComboBox.Items.Add("XPath"); comparisonComboBox.Items.Add("ID"); comparisonComboBox.Items.Add("Name"); comparisonComboBox.Items.Add("Tag Name"); comparisonComboBox.Items.Add("Class Name"); comparisonComboBox.Items.Add("CSS Selector"); //assign cell as a combobox loopActionParameterBox.Rows[1].Cells[1] = comparisonComboBox; break; case "GUI Element Exists": loopActionParameterBox.Visible = true; if (sender != null) { actionParameters.Rows.Add("Window Name", "Current Window"); actionParameters.Rows.Add("Element Search Method", "AutomationId"); actionParameters.Rows.Add("Element Search Parameter", ""); actionParameters.Rows.Add("Timeout (Seconds)", "30"); actionParameters.Rows.Add("True When", "It Does Exist"); loopActionParameterBox.DataSource = actionParameters; } comparisonComboBox = new DataGridViewComboBoxCell(); comparisonComboBox.Items.Add("It Does Exist"); comparisonComboBox.Items.Add("It Does Not Exist"); //assign cell as a combobox loopActionParameterBox.Rows[4].Cells[1] = comparisonComboBox; var parameterName = new DataGridViewComboBoxCell(); parameterName.Items.Add("AcceleratorKey"); parameterName.Items.Add("AccessKey"); parameterName.Items.Add("AutomationId"); parameterName.Items.Add("ClassName"); parameterName.Items.Add("FrameworkId"); parameterName.Items.Add("HasKeyboardFocus"); parameterName.Items.Add("HelpText"); parameterName.Items.Add("IsContentElement"); parameterName.Items.Add("IsControlElement"); parameterName.Items.Add("IsEnabled"); parameterName.Items.Add("IsKeyboardFocusable"); parameterName.Items.Add("IsOffscreen"); parameterName.Items.Add("IsPassword"); parameterName.Items.Add("IsRequiredForForm"); parameterName.Items.Add("ItemStatus"); parameterName.Items.Add("ItemType"); parameterName.Items.Add("LocalizedControlType"); parameterName.Items.Add("Name"); parameterName.Items.Add("NativeWindowHandle"); parameterName.Items.Add("ProcessID"); //assign cell as a combobox loopActionParameterBox.Rows[1].Cells[1] = parameterName; _recorderControl.Show(); break; case "Image Element Exists": loopActionParameterBox.Visible = true; if (sender != null) { actionParameters.Rows.Add("Captured Image Variable", ""); actionParameters.Rows.Add("Accuracy (0-1)", "0.8"); actionParameters.Rows.Add("True When", "It Does Exist"); loopActionParameterBox.DataSource = actionParameters; } comparisonComboBox = new DataGridViewComboBoxCell(); comparisonComboBox.Items.Add("It Does Exist"); comparisonComboBox.Items.Add("It Does Not Exist"); //assign cell as a combobox loopActionParameterBox.Rows[2].Cells[1] = comparisonComboBox; break; case "App Instance Exists": loopActionParameterBox.Visible = true; if (sender != null) { actionParameters.Rows.Add("Instance Name", ""); actionParameters.Rows.Add("True When", "It Does Exist"); loopActionParameterBox.DataSource = actionParameters; } comparisonComboBox = new DataGridViewComboBoxCell(); comparisonComboBox.Items.Add("It Does Exist"); comparisonComboBox.Items.Add("It Does Not Exist"); //assign cell as a combobox loopActionParameterBox.Rows[1].Cells[1] = comparisonComboBox; break; default: break; } loopActionParameterBox.Columns[0].ReadOnly = true; }
private void ifAction_SelectionChangeCommitted(object sender, EventArgs e) { ComboBox ifAction = (ComboBox)ActionDropdown; DataGridView ifActionParameterBox = (DataGridView)IfGridViewHelper; //Sergey added Core.Automation.Commands_cn.BeginIfCommand_cn cmd = (Core.Automation.Commands_cn.BeginIfCommand_cn) this; DataTable actionParameters = cmd.v_IfActionParameterTable; //sender is null when command is updating if (sender != null) { actionParameters.Rows.Clear(); } DataGridViewComboBoxCell comparisonComboBox = new DataGridViewComboBoxCell(); //recorder control Control recorderControl = (Control)RecorderControl; //remove if exists if (RecorderControl.Visible) { RecorderControl.Hide(); } switch (ifAction.SelectedItem) { case "Value": case "Date Compare": ifActionParameterBox.Visible = true; if (sender != null) { actionParameters.Rows.Add("Value1", ""); actionParameters.Rows.Add("Operand", ""); actionParameters.Rows.Add("Value2", ""); ifActionParameterBox.DataSource = actionParameters; } //combobox cell for Variable Name comparisonComboBox = new DataGridViewComboBoxCell(); comparisonComboBox.Items.Add("is equal to"); comparisonComboBox.Items.Add("is greater than"); comparisonComboBox.Items.Add("is greater than or equal to"); comparisonComboBox.Items.Add("is less than"); comparisonComboBox.Items.Add("is less than or equal to"); comparisonComboBox.Items.Add("is not equal to"); //assign cell as a combobox ifActionParameterBox.Rows[1].Cells[1] = comparisonComboBox; break; case "Variable Compare": ifActionParameterBox.Visible = true; if (sender != null) { actionParameters.Rows.Add("Value1", ""); actionParameters.Rows.Add("Operand", ""); actionParameters.Rows.Add("Value2", ""); actionParameters.Rows.Add("Case Sensitive", "No"); ifActionParameterBox.DataSource = actionParameters; } //combobox cell for Variable Name comparisonComboBox = new DataGridViewComboBoxCell(); comparisonComboBox.Items.Add("contains"); comparisonComboBox.Items.Add("does not contain"); comparisonComboBox.Items.Add("is equal to"); comparisonComboBox.Items.Add("is not equal to"); //assign cell as a combobox ifActionParameterBox.Rows[1].Cells[1] = comparisonComboBox; comparisonComboBox = new DataGridViewComboBoxCell(); comparisonComboBox.Items.Add("Yes"); comparisonComboBox.Items.Add("No"); //assign cell as a combobox ifActionParameterBox.Rows[3].Cells[1] = comparisonComboBox; break; case "Variable Has Value": ifActionParameterBox.Visible = true; if (sender != null) { actionParameters.Rows.Add("Variable Name", ""); ifActionParameterBox.DataSource = actionParameters; } break; case "Variable Is Numeric": ifActionParameterBox.Visible = true; if (sender != null) { actionParameters.Rows.Add("Variable Name", ""); ifActionParameterBox.DataSource = actionParameters; } break; case "Error Occured": ifActionParameterBox.Visible = true; if (sender != null) { actionParameters.Rows.Add("Line Number", ""); ifActionParameterBox.DataSource = actionParameters; } break; case "Error Did Not Occur": ifActionParameterBox.Visible = true; if (sender != null) { actionParameters.Rows.Add("Line Number", ""); ifActionParameterBox.DataSource = actionParameters; } break; case "Window Name Exists": case "Active Window Name Is": ifActionParameterBox.Visible = true; if (sender != null) { actionParameters.Rows.Add("Window Name", ""); ifActionParameterBox.DataSource = actionParameters; } break; case "File Exists": ifActionParameterBox.Visible = true; if (sender != null) { actionParameters.Rows.Add("File Path", ""); actionParameters.Rows.Add("True When", ""); ifActionParameterBox.DataSource = actionParameters; } //combobox cell for Variable Name comparisonComboBox = new DataGridViewComboBoxCell(); comparisonComboBox.Items.Add("It Does Exist"); comparisonComboBox.Items.Add("It Does Not Exist"); //assign cell as a combobox ifActionParameterBox.Rows[1].Cells[1] = comparisonComboBox; break; case "Folder Exists": ifActionParameterBox.Visible = true; if (sender != null) { actionParameters.Rows.Add("Folder Path", ""); actionParameters.Rows.Add("True When", ""); ifActionParameterBox.DataSource = actionParameters; } //combobox cell for Variable Name comparisonComboBox = new DataGridViewComboBoxCell(); comparisonComboBox.Items.Add("It Does Exist"); comparisonComboBox.Items.Add("It Does Not Exist"); //assign cell as a combobox ifActionParameterBox.Rows[1].Cells[1] = comparisonComboBox; break; case "Web Element Exists": ifActionParameterBox.Visible = true; if (sender != null) { actionParameters.Rows.Add("Selenium Instance Name", "default"); actionParameters.Rows.Add("Element Search Method", ""); actionParameters.Rows.Add("Element Search Parameter", ""); ifActionParameterBox.DataSource = actionParameters; } comparisonComboBox = new DataGridViewComboBoxCell(); comparisonComboBox.Items.Add("Find Element By XPath"); comparisonComboBox.Items.Add("Find Element By ID"); comparisonComboBox.Items.Add("Find Element By Name"); comparisonComboBox.Items.Add("Find Element By Tag Name"); comparisonComboBox.Items.Add("Find Element By Class Name"); comparisonComboBox.Items.Add("Find Element By CSS Selector"); //assign cell as a combobox ifActionParameterBox.Rows[1].Cells[1] = comparisonComboBox; break; case "GUI Element Exists": ifActionParameterBox.Visible = true; if (sender != null) { actionParameters.Rows.Add("Window Name", "Current Window"); actionParameters.Rows.Add("Element Search Method", ""); actionParameters.Rows.Add("Element Search Parameter", ""); ifActionParameterBox.DataSource = actionParameters; } var parameterName = new DataGridViewComboBoxCell(); parameterName.Items.Add("AcceleratorKey"); parameterName.Items.Add("AccessKey"); parameterName.Items.Add("AutomationId"); parameterName.Items.Add("ClassName"); parameterName.Items.Add("FrameworkId"); parameterName.Items.Add("HasKeyboardFocus"); parameterName.Items.Add("HelpText"); parameterName.Items.Add("IsContentElement"); parameterName.Items.Add("IsControlElement"); parameterName.Items.Add("IsEnabled"); parameterName.Items.Add("IsKeyboardFocusable"); parameterName.Items.Add("IsOffscreen"); parameterName.Items.Add("IsPassword"); parameterName.Items.Add("IsRequiredForForm"); parameterName.Items.Add("ItemStatus"); parameterName.Items.Add("ItemType"); parameterName.Items.Add("LocalizedControlType"); parameterName.Items.Add("Name"); parameterName.Items.Add("NativeWindowHandle"); parameterName.Items.Add("ProcessID"); //assign cell as a combobox ifActionParameterBox.Rows[1].Cells[1] = parameterName; RecorderControl.Show(); break; default: break; } }