void methodComboBox_SelectedIndexChanged(object sender, EventArgs e) { var currentElement = action.GetElement(); if (currentElement == null) { valueTextBox.Text = ""; return; } FindMethods value = (FindMethods)Enum.Parse(typeof(FindMethods), methodComboBox.SelectedItem.ToString(), true); switch (value) { case FindMethods.ProximityText: valueTextBox.Text = Title; break; case FindMethods.Alt: case FindMethods.Class: case FindMethods.For: case FindMethods.Href: case FindMethods.Id: case FindMethods.Index: case FindMethods.Name: case FindMethods.Src: case FindMethods.Title: case FindMethods.Url: case FindMethods.Value: //case FindMethods.Style: if (currentElement.Exists) { valueTextBox.Text = currentElement.GetAttributeValue(value.ToString()); } break; case FindMethods.XPath: if (currentElement.Exists) { valueTextBox.Text = XPathFinder.GetXPath(currentElement); } break; case FindMethods.CssSelector: if (currentElement.Exists) { valueTextBox.Text = currentElement.GetAttributeValue("__selector"); } break; case FindMethods.Text: if (currentElement.Exists) { valueTextBox.Text = currentElement.Text; } break; default: break; } }
public void ObjectToGui(ActionElementBase act) { this.action = act; methodComboBox.DataSource = Enum.GetValues(typeof(FindMethods)); methodComboBox.SelectedIndexChanged += new EventHandler(methodComboBox_SelectedIndexChanged); if (act.FindMechanism.Count > 0) { FindAttribute attribute = act.FindMechanism[0]; methodComboBox.SelectedItem = attribute.FindMethod; regxCheckBox.Checked = attribute.Regex; valueTextBox.Text = attribute.FindValue; var currentElement = action.GetElement(); if (currentElement != null && currentElement.Exists) { contentTextBox.Text = currentElement.OuterHtml; } else { contentTextBox.Text = ""; } } }