private void UITestConfigAddInstructionBtn_Click(object sender, EventArgs e) { if (UITestConfigInstructionSelect.SelectedItem == null || activeTestConfiguration.IsRunning) { return; } string instruction_name = UITestConfigInstructionSelect.SelectedItem.ToString(); InstructionUIEntry instructionUIEntry = (InstructionUIEntry)UITestConfigInstructionSelect.SelectedItem; JObject paramTable = new JObject(); // Get parameters from the parameters data grid input for (int row = 0; row < UITestConfigInstructionParameterGrid.Rows.Count; row++) { string key = null; object value = null; for (int col = 0; col < UITestConfigInstructionParameterGrid.ColumnCount; col++) { var cell = UITestConfigInstructionParameterGrid.Rows[row].Cells[col].Value; if (col % 2 == 0) { // Key key = cell.ToString(); } else { // Value string instruction_type = instructionUIEntry.parameters[key].Value <string>(); //instruction_list[instruction_name][key].Value<string>(); value = Cast.ToType(cell, instruction_type); // This casts, BUT only result we need here is that value is 0 if string is empty.... } } if (key != null && value != null) { paramTable[key] = JToken.FromObject(value); } } if (paramTable.Count > 0) { foreach (IObservableNumericValue checkedObserveValue in UITestConfigOutputParamChecklist.CheckedItems) { observedValueLabels.Add(checkedObserveValue.Label); } Instruction thatInstruction = new Instruction(instructionUIEntry.label, paramTable); InstructionEntry entry = new InstructionEntry { instruction = thatInstruction, observedValueLabels = observedValueLabels }; int index = AddTestConfigInstructionRow(entry); entry.setInstructionIndex(index); activeTestConfiguration.AddInstructionEntry(entry); } }
public void AddInstructionUIEntry(InstructionUIEntry entry) { if (!UITestConfigInstructionSelect.Items.Contains(entry)) { UITestConfigInstructionSelect.Items.Add(entry); } }
private void UITestConfigInstructionSelect_SelectedIndexChanged(object sender, EventArgs e) { InstructionUIEntry sel = (InstructionUIEntry)UITestConfigInstructionSelect.SelectedItem; UITestConfigInstructionParameterGrid.Rows.Clear(); foreach (KeyValuePair <string, JToken> param in sel.parameters) { UITestConfigInstructionParameterGrid.Rows.Add(new string[] { param.Key, "" }); } }
public void ReceiveInstructionList(object payload, string attribute, string label) { ThreadHelper.UI_Invoke(this, null, TestConfigTab.UITestConfigInstructionParameterGrid, (Hashtable d) => { instruction_list = (JObject)payload; foreach (KeyValuePair <string, JToken> instruction in instruction_list) { InstructionUIEntry entry = new InstructionUIEntry { label = instruction.Key, parameters = instruction.Value as JObject }; TestConfigTab.AddInstructionUIEntry(entry); } }, null); }