public override bool TrySetMember(SetMemberBinder binder, object value) { if (binder == null) { throw new ArgumentNullException("binder"); } if (value == null) { throw new ArgumentNullException("value"); } if (string.IsNullOrWhiteSpace(binder.Name)) { throw new ArgumentException(@"binder.name must be non empty string", "binder"); } if (binder.Name == InnerElement.Name) { InnerElement.SetValue(value); } else { InnerElement.SetElementValue(binder.Name, value); } return(true); }
public void SetAttributeEnum <T>(XName name, object value) { object obj = Enum.ToObject(typeof(T), value); IDictionary <string, MemberInfo> members = obj.GetType().GetTypeInfo().DeclaredMembers.ToDictionary(c => c.Name); MemberInfo member; if (!members.TryGetValue(obj.ToString(), out member)) { throw new InvalidOperationException(); } IDictionary <Type, CustomAttributeData> customAttributes = member.CustomAttributes.ToDictionary(c => c.AttributeType); CustomAttributeData enumMemberAttribute; if (customAttributes.TryGetValue(typeof(EnumMemberAttribute), out enumMemberAttribute)) { IDictionary <string, CustomAttributeNamedArgument> args = enumMemberAttribute.NamedArguments.ToDictionary(c => c.MemberName); CustomAttributeNamedArgument arg; if (args.TryGetValue("Value", out arg)) { InnerElement.SetAttributeValue(name, arg.TypedValue.Value); return; } } InnerElement.SetAttributeValue(name, ((T)value).ToString()); }
public Item(IComponent component) { InnerElement = Button(_("tss-contextmenu-item")); InnerElement.appendChild(component.Render()); AttachClick(); InnerElement.addEventListener("mouseover", OnItemMouseOver); }
public Item(string text = string.Empty) { _innerComponent = null; InnerElement = Button(_("tss-contextmenu-item", text: text)); AttachClick(); InnerElement.addEventListener("mouseenter", OnItemMouseEnter); InnerElement.addEventListener("mouseleave", OnItemMouseLeave); }
public void SetValue(object value) { if (value == null) { throw new ArgumentNullException("value"); } InnerElement.SetValue(value); }
/// <summary> /// Determines whether the specified object is equal to the current object. /// </summary> /// <param name="element">The object to compare with the current object.</param> /// <returns>True if the specified object is equal to the current object; otherwise, false.</returns> public override bool Equals(IUITechnologyElement element) { CommonControlElement other = element as CommonControlElement; if ((object)other != null) { return(InnerElement.Equals(other.InnerElement)); } return(false); }
public object GetAttributeValue(XName name) { XAttribute attr = InnerElement.Attribute(name); if (attr != null) { return(attr.Value); } return(default(object)); }
/// <summary> /// Changing curent XElement's attribute value /// </summary> public void SetAttributeValue(XName name, object value) { if (name == null) { throw new ArgumentNullException("name"); } if (value == null) { throw new ArgumentNullException("value"); } InnerElement.SetAttributeValue(name, value); }
public Item(IComponent component) { if (component is ITextFormating itf && (itf is Button || itf is Link)) { itf.SetTextAlign(TextAlign.Left); } _innerComponent = component.Render(); InnerElement = Div(_("tss-contextmenu-item"), _innerComponent); InnerElement.appendChild(_innerComponent); AttachClick(); InnerElement.addEventListener("mouseenter", OnItemMouseEnter); InnerElement.addEventListener("mouseleave", OnItemMouseLeave); }
protected override void SetBoundsCore(Rectangle bounds, BoundsSpecified specified) { _currentlySizing = true; CachedBounds = bounds; try { if (DraggedControl.IsCurrentlyDragging) { if (ToolStripPanelRow.Cells[ToolStripPanelRow.Cells.Count - 1] == this) { Rectangle displayRectangle = ToolStripPanelRow.DisplayRectangle; if (ToolStripPanelRow.Orientation == Orientation.Horizontal) { int spaceToFree = bounds.Right - displayRectangle.Right; if (spaceToFree > 0 && bounds.Width > spaceToFree) { bounds.Width -= spaceToFree; } } else { int spaceToFree = bounds.Bottom - displayRectangle.Bottom; if (spaceToFree > 0 && bounds.Height > spaceToFree) { bounds.Height -= spaceToFree; } } } Debug.WriteLineIf(ToolStripPanelRow.ToolStripPanelMouseDebug.TraceVerbose, "[CELL] DRAGGING calling SetBounds " + bounds.ToString()); base.SetBoundsCore(bounds, specified); InnerElement.SetBounds(bounds, specified); } else { if (!ToolStripPanelRow.CachedBoundsMode) { Debug.WriteLineIf(ToolStripPanelRow.ToolStripPanelMouseDebug.TraceVerbose, "[CELL] NOT DRAGGING calling SetBounds " + bounds.ToString()); base.SetBoundsCore(bounds, specified); InnerElement.SetBounds(bounds, specified); } } } finally { _currentlySizing = false; } }
public dynamic this[XName name] { get { if (name == null) { throw new ArgumentNullException("name"); } var attribute = InnerElement.Attribute(name); if (attribute == null) { throw new InvalidOperationException(string.Format("Attribute '{0}' not found in element '{1}'", name, InnerElement.Name)); } return(DynamicXAttribute.CreateInstance(attribute)); } }
public override bool TryGetMember(GetMemberBinder binder, out object result) { if (binder == null) { throw new ArgumentNullException("binder"); } if (string.IsNullOrWhiteSpace(binder.Name)) { throw new ArgumentException(@"binder.name must be non empty string", "binder"); } var child = InnerElement.Elements(binder.Name).FirstOrDefault(); if (child != null) { result = CreateInstance(child); return(true); } throw new InvalidOperationException(string.Format("Element '{0}' not found among subelements of '{1}'", binder.Name, InnerElement.Name.LocalName)); }
public override bool TryGetMember(GetMemberBinder binder, out object result) { if (binder == null) { throw new ArgumentNullException("binder"); } if (string.IsNullOrWhiteSpace(binder.Name)) { throw new ArgumentException(@"binder.name must be non empty string", "binder"); } var child = InnerElement.Elements(binder.Name).FirstOrDefault(); if (child == null) { child = new XElement(binder.Name); InnerElement.Add(child); } result = CreateInstance(child); return(true); }
/// <summary> /// Gets a clickable point for this element. The framework will use /// this to get clickable point if UITechnologyElement.GetOption(UITechnologyElementOption.GetClickablePointFrom) /// returns GetClickablePointFromTechnologyManager. To use the default algorithm /// provided by the framework, throw NotSupportedException. /// </summary> /// <param name="pointX">The x-coordinate of clickable point.</param> /// <param name="pointY">The y-coordinate of clickable point.</param> /// <exception cref="System.NotSupportedException">Throws System.NotSupportedException /// if this operation is not supported.</exception> /// <seealso cref="UITechnologyElementOption.GetClickablePointFrom"/> public override void GetClickablePoint(out int pointX, out int pointY) { InnerElement.GetClickablePoint(out pointX, out pointY); }
/// <summary> /// Gets the hash code for this object. /// .NET Design Guidelines suggests overridding this too if Equals is overridden. /// </summary> /// <returns>The hash code.</returns> public override int GetHashCode() { return(InnerElement.GetHashCode()); }
/// <summary> /// Gets the string representation of this control. /// </summary> /// <returns>The string representation.</returns> public override string ToString() { return(InnerElement.ToString()); }
/// <summary> /// Waits for the element to be ready for user action. /// </summary> /// <seealso cref="UITechnologyElementOption.WaitForReadyOptions"/> /// <exception cref="System.TimeoutException"> /// Throws TimeoutException if control is not ready in alloted time. /// </exception> public override void WaitForReady() { InnerElement.WaitForReady(); }
/// <summary> /// Gets the value for the specified property for this element. /// </summary> /// <param name="propertyName">The name of the property.</param> /// <returns>The value of the property.</returns> public override object GetPropertyValue(string propertyName) { return(InnerElement.GetPropertyValue(propertyName)); }
/// <summary> /// Sets the option for this IUITechnologyElement. /// </summary> /// <param name="technologyElementOption">The element option to set.</param> /// <param name="optionValue">The value of this element option.</param> /// <exception cref="System.NotSupportedException">Throws System.NotSupportedException /// if the element option is not supported.</exception> public override void SetOption(UITechnologyElementOption technologyElementOption, object optionValue) { InnerElement.SetOption(technologyElementOption, optionValue); }
/// <summary> /// Performs programmatic action, based on the ProgrammaticActionOption passed, on this element. /// </summary> /// <param name="programmaticActionOption">The option corresponding the action to perform.</param> public override void InvokeProgrammaticAction(ProgrammaticActionOption programmaticActionOption) { InnerElement.InvokeProgrammaticAction(programmaticActionOption); }
/// <summary> /// Does the programmatic scrolling for this element. /// </summary> /// <param name="scrollDirection">The direction to scroll.</param> /// <param name="scrollAmount">The amount to scroll.</param> /// <seealso cref="InitializeProgrammaticScroll"/> public override void ScrollProgrammatically(ScrollDirection scrollDirection, ScrollAmount scrollAmount) { InnerElement.ScrollProgrammatically(scrollDirection, scrollAmount); }
/// <summary> /// Gets the amount scrolled in percentage. /// </summary> /// <param name="srollDirection">The direction for which data is required.</param> /// <param name="scrollElement">The element which is either the vertical or horizontal scroll bar.</param> /// <returns>The amount in percentage.</returns> /// <seealso cref="InitializeProgrammaticScroll"/> public override int GetScrolledPercentage(ScrollDirection scrollDirection, IUITechnologyElement scrollElement) { return(InnerElement.GetScrolledPercentage(scrollDirection, scrollElement)); }
/// <summary> /// Initializes this element to do programmatic scrolling. /// </summary> /// <returns>True if element supports programmatic scrolling and /// initialization is successful, false otherwise.</returns> public override bool InitializeProgrammaticScroll() { return(InnerElement.InitializeProgrammaticScroll()); }
/// <summary> /// Gets the true/false value for right to left format based on the kind specified. /// </summary> /// <param name="rightToLeftKind">Either the layout or text kind to check for.</param> /// <returns>True if layout or text based on the RightToLeftKind passed is right to left, /// false otherwise.</returns> public override bool GetRightToLeftProperty(RightToLeftKind rightToLeftKind) { return(InnerElement.GetRightToLeftProperty(rightToLeftKind)); }
/// <summary> /// Gets the native control type of this element. This can be used in /// tandem with the universal type got via GetControlType() in cases /// where just the ControlType is not enough to differentiate a control. /// For example, if the native technology element is HTML, this could be the tag name. /// </summary> /// <param name="nativeControlTypeKind">The kind of the native control type requested.</param> /// <returns>If supported, the native type of the control or else null.</returns> public override object GetNativeControlType(NativeControlTypeKind nativeControlTypeKind) { return(InnerElement.GetNativeControlType(nativeControlTypeKind)); }
/// <summary> /// Gets the QueryId for the related element specified by UITestElementKind. /// </summary> /// <param name="relatedElement">The kind of related element.</param> /// <param name="additionalInfo">Any additional information required. /// For example, when relatedElement is UITestElementKind.Child, this gives the name of the child.</param> /// <param name="maxDepth">The maximum depth to search under this element to find the required component.</param> /// <returns>The QueryId of the element.</returns> public override string GetQueryIdForRelatedElement(UITestElementKind relatedElement, object additionalInfo, out int maxDepth) { return(InnerElement.GetQueryIdForRelatedElement(relatedElement, additionalInfo, out maxDepth)); }
/// <summary> /// Gets the coordinates of the rectangle that completely encloses this element. /// </summary> /// <remarks>This is in screen coordinates and never cached.</remarks> public override void GetBoundingRectangle(out int left, out int top, out int width, out int height) { InnerElement.GetBoundingRectangle(out left, out top, out width, out height); }
/// <summary> /// Sets the focus on this element. /// </summary> public override void SetFocus() { InnerElement.SetFocus(); }
/// <summary> /// Gets the current state information of this element for the given requested states. /// If the element does not support querying only the selective states, it can /// return the complete state information. /// </summary> /// <param name="requestedState">The states for which to check.</param> /// <returns>The information about the given requested state or complete state information.</returns> public override AccessibleStates GetRequestedState(AccessibleStates requestedState) { return(InnerElement.GetRequestedState(requestedState)); }
/// <summary> /// Gets the option for this IUITechnologyElement. /// </summary> /// <param name="technologyElementOption">The element option to get.</param> /// <returns>The value of this element option. </returns> /// <exception cref="System.NotSupportedException">Throws System.NotSupportedException /// if the element option is not supported.</exception> public override object GetOption(UITechnologyElementOption technologyElementOption) { return(InnerElement.GetOption(technologyElementOption)); }