protected override Attribute LookForAnnotation(MemberInfo method) { Attribute annotation = base.LookForAnnotation(method); if (annotation != null) { return(annotation); } NoProxyAttribute noProxy = AnnotationUtil.GetAnnotation <NoProxyAttribute>(method, false); if (noProxy != null) { return(noProxy); } ProcessAttribute process = AnnotationUtil.GetAnnotation <ProcessAttribute>(method, false); if (process != null) { return(process); } FindAttribute find = AnnotationUtil.GetAnnotation <FindAttribute>(method, false); if (find != null) { return(find); } MergeAttribute merge = AnnotationUtil.GetAnnotation <MergeAttribute>(method, false); if (merge != null) { return(merge); } return(AnnotationUtil.GetAnnotation <RemoveAttribute>(method, false)); }
public FindAttributeCollection GuiToObject() { var collection = new FindAttributeCollection(); FindAttribute attribute = GetFindAttribute(); collection.Add(attribute); return(collection); }
private ActionElementBase CheckSingleElementDeserial(string filename, Type intendedType, string tagName, FindAttribute finder) { var firstAction = (ActionElementBase)CheckSingleBaseDeserial(filename, intendedType); Assert.AreEqual(tagName, firstAction.ActionFinder.TagName, "Tag name not text"); Assert.AreEqual(1, firstAction.ActionFinder.AttributeList.Count, "attribute list count is not 1"); FindAttribute firstAttribute = firstAction.ActionFinder.AttributeList[0]; Assert.AreEqual(finder.FindName, firstAttribute.FindName, "name is not 'id'"); Assert.AreEqual(finder.FindValue, firstAttribute.FindValue, "value is not 'name'"); return(firstAction); }
internal FindAttribute GetRowValue(int RowIndex) { var attribute = new FindAttribute { FindName = gridElement[RowIndex, FIND_ID].Value.ToString() }; attribute.FindMethod = FindMethods.XPath; attribute.FindValue = gridElement[RowIndex, FIND_VALUE].ToString(); attribute.Regex = false; return(attribute); }
private static Sexes SexAsEnum(string sex) { var enumType = typeof(Sexes); foreach (Sexes sexEnum in (Sexes[])Enum.GetValues(typeof(Sexes))) { string sexName = FindAttribute <DisplayAttribute> .InEnum(sexEnum).Name; if (sexName == sex) { return(sexEnum); } } throw new ArgumentOutOfRangeException($"The '{sex}' value is not found."); }
internal FindAttribute GetFindAttribute() { var attribute = new FindAttribute { FindName = methodComboBox.SelectedItem.ToString() }; if (Enum.IsDefined(typeof(FindMethods), attribute.FindName)) { attribute.FindMethod = (FindMethods)Enum.Parse(typeof(FindMethods), attribute.FindName); attribute.FindName = null; } attribute.FindValue = valueTextBox.Text; attribute.Regex = regxCheckBox.Checked; return(attribute); }
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 = ""; } } }
private void AddGridRow(FindAttribute attribute) { int RowIndex = gridElement.RowsCount++; gridElement[RowIndex, 0] = new Cell(FindMethods.XPath.ToString(), new TextBox(typeof(string))); var id = attribute.FindName == null ? "" : attribute.FindName; gridElement[RowIndex, 1] = new Cell(id, new TextBox(typeof(string))); var val = attribute.FindValue; gridElement[RowIndex, 2] = new Cell(val, new TextBox(typeof(string))); var btnDelete = new Button(""); gridElement[RowIndex, 3] = btnDelete; var bmpDelete = new Bitmap(ucBaseElement.GetIconFullPath("db-Delete.bmp")); bmpDelete.MakeTransparent(Color.Fuchsia); gridElement[RowIndex, 3].Image = bmpDelete; var buttonClickEvent = new SourceGrid.Cells.Controllers.Button(); buttonClickEvent.Executed += DeleteFindButton_Click; gridElement[RowIndex, 3].Controller.AddController(buttonClickEvent); }
private void CheckSingleElementSerial(string outputFile, Type intendedType, string tagName, FindAttribute finder) { XmlNode actionNode = CheckSingleBaseSerial(outputFile, intendedType); XmlNode findCollectionNode = (actionNode.SelectSingleNode("FindAttributeCollection")); Assert.IsNotNull(findCollectionNode, "find collection node not found"); Assert.IsNotNull(findCollectionNode.Attributes); Assert.IsNotNull(findCollectionNode.Attributes["TagName"]); Assert.AreEqual(tagName, findCollectionNode.Attributes["TagName"].Value); XmlNodeList findAttributeList = findCollectionNode.SelectNodes("FindAttribute"); Assert.IsNotNull(findAttributeList, "list of action nodes is null"); Assert.AreEqual(1, findAttributeList.Count, "find node list is not 1"); XmlNode findAttribute = findAttributeList[0]; Assert.IsNotNull(findAttribute, "find attribute is null"); Assert.IsNotNull(findAttribute.Attributes, "findAttribute.Attributes == null"); Assert.AreEqual(finder.FindName, findAttribute.Attributes["FindName"].Value); Assert.AreEqual(finder.FindValue, findAttribute.InnerText); }
private static string SexAsText(Sexes sex) { string sexName = FindAttribute <DisplayAttribute> .InEnum(sex).Name; return(sexName); }