コード例 #1
0
ファイル: WordRange.cs プロジェクト: vincenormand/Sample-Code
        /// <summary>
        /// Gets the children of this control in this technology matching the given condition.
        /// </summary>
        /// <param name="condition">The condition to match.</param>
        /// <returns>The enumerator for children.</returns>
        internal virtual System.Collections.IEnumerator GetChildren(AndCondition condition)
        {
            string docName = condition.GetPropertyValue(PropertyNames.Name) as string;

            if (!string.IsNullOrEmpty(docName))
            {
                UITechnologyElement docRange = this.techManager.GetWordRange(this.WindowHandle, new WordDocumentInfo(docName));
                return(new[] { docRange }.GetEnumerator());
            }

            return(null);
        }
コード例 #2
0
        /// <summary>
        /// Gets the children of this control in this technology matching the given condition.
        /// </summary>
        /// <param name="condition">The condition to match.</param>
        /// <returns>The enumerator for children.</returns>
        internal override System.Collections.IEnumerator GetChildren(AndCondition condition)
        {
            int    start, end;
            string startString = condition.GetPropertyValue(PropertyNames.StartIndex) as string;
            string endString   = condition.GetPropertyValue(PropertyNames.EndIndex) as string;

            if (int.TryParse(startString, out start) && int.TryParse(endString, out end))
            {
                UITechnologyElement selectionElement = this.techManager.GetWordRange(this.WindowHandle, new WordSelectionInfo(start, end, this.DocumentInfo));
                return(new[] { selectionElement }.GetEnumerator());
            }

            return(null);
        }
コード例 #3
0
        /// <summary>
        /// Gets the UIA control from GridControl by using the live AutomationElement.
        /// </summary>
        /// <param name="control">The control.</param>
        /// <returns>The live UIA control.</returns>
        public static UITestControl GetLiveUiaControl(UITestControl control)
        {
            UITechnologyElement element = control.GetProperty(UITestControl.PropertyNames.UITechnologyElement) as UITechnologyElement;

            if (element != null)
            {
                AutomationElement ae = element.NativeElement as AutomationElement;
                if (ae != null)
                {
                    return(UITestControlFactory.FromNativeElement(ae, "UIA"));
                }
            }

            throw new InvalidOperationException();
        }
コード例 #4
0
 /// <summary>
 /// Обновить параметры технологии на канвасе
 /// </summary>
 public void UpdateTechParams()
 {
     foreach (Technology t in ttData.GetTechnologies())
     {
         UITechnologyElement uit = GetTechOfCanvasByID(t.ID).GetUIElement();
         if (uit == null)
         {
             Debug.LogError("Tech " + t.ID + " not instantiated, instantiate first");
         }
         else
         {
             uit.name = t.ID.ToString();
             uit.Setup(t);
             uit.SetStatus(GetColorByStatus(t.Status));
         }
     }
 }
コード例 #5
0
 public TechnologyOnCanvas(TechnologyID ID, GameObject uiObject, UITechnologyElement uiElement)
 {
     id = ID;
     uiElementObject = uiObject;
     this.uiElement  = uiElement;
 }