public UnKnownPattern(A11yElement e, int id, string name) : base(e, id, name)
 {
     if (!PatternType.GetInstance().Exists(id))
     {
         // be silent since Unknown pattern was created since pattern interface couldn't be retrieved by unknown reason.
     }
 }
 public PatternInfoControl()
 {
     InitializeComponent();
     foreach (var kv in PatternType.GetInstance().GetKeyValuePairList())
     {
         ExpStates[kv.Key] = false;
     }
     HidePatternsTree();
 }
Exemplo n.º 3
0
        private static string CreateSearchPatternsString(A11yElement e)
        {
            if (e == null)
            {
                return(null);
            }

            var patterns = e.Patterns?.Select(p => PatternType.GetInstance().GetNameById(p.Id));

            if (patterns == null)
            {
                return(null);
            }

            return(string.Join(" ", patterns));
        }
Exemplo n.º 4
0
        /// <summary>
        /// Get the Instance of specific pattern.
        /// if there is no matching pattern, it is wrapped up as Unknown.
        /// </summary>
        /// <param name="e"></param>
        /// <param name="id"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public static A11yPattern GetPatternInstance(A11yElement e, IUIAutomationElement uia, int id, string name)
        {
            try
            {
                dynamic pt = null;

                if (PatternType.GetInstance().Exists(id))
                {
                    pt = uia.GetCachedPattern(id);
                }

                if (pt != null)
                {
                    switch (id)
                    {
                    case PatternType.UIA_AnnotationPatternId:
                        return(new AnnotationPattern(e, pt));

                    case PatternType.UIA_CustomNavigationPatternId:
                        return(new CustomNavigationPattern(e, pt));

                    case PatternType.UIA_DockPatternId:
                        return(new DockPattern(e, pt));

                    case PatternType.UIA_DragPatternId:
                        return(new DragPattern(e, pt));

                    case PatternType.UIA_DropTargetPatternId:
                        return(new DropTargetPattern(e, pt));

                    case PatternType.UIA_ExpandCollapsePatternId:
                        return(new ExpandCollapsePattern(e, pt));

                    case PatternType.UIA_GridItemPatternId:
                        return(new GridItemPattern(e, pt));

                    case PatternType.UIA_GridPatternId:
                        return(new GridPattern(e, pt));

                    case PatternType.UIA_InvokePatternId:
                        return(new InvokePattern(e, pt));

                    case PatternType.UIA_ItemContainerPatternId:
                        return(new ItemContainerPattern(e, pt));

                    case PatternType.UIA_LegacyIAccessiblePatternId:
                        return(new LegacyIAccessiblePattern(e, pt));

                    case PatternType.UIA_MultipleViewPatternId:
                        return(new MultipleViewPattern(e, pt));

                    case PatternType.UIA_ObjectModelPatternId:
                        return(new ObjectModelPattern(e, pt));

                    case PatternType.UIA_RangeValuePatternId:
                        return(new RangeValuePattern(e, pt));

                    case PatternType.UIA_ScrollItemPatternId:
                        return(new ScrollItemPattern(e, pt));

                    case PatternType.UIA_ScrollPatternId:
                        return(new ScrollPattern(e, pt));

                    case PatternType.UIA_SelectionItemPatternId:
                        return(new SelectionItemPattern(e, pt));

                    case PatternType.UIA_SelectionPatternId:
                        return(new SelectionPattern(e, pt));

                    case PatternType.UIA_SelectionPattern2Id:
                        return(new SelectionPattern2(e, pt));

                    case PatternType.UIA_SpreadsheetPatternId:
                        return(new SpreadsheetPattern(e, pt));

                    case PatternType.UIA_SpreadsheetItemPatternId:
                        return(new SpreadsheetItemPattern(e, pt));

                    case PatternType.UIA_StylesPatternId:
                        return(new StylesPattern(e, pt));

                    case PatternType.UIA_SynchronizedInputPatternId:
                        return(new SynchronizedInputPattern(e, pt));

                    case PatternType.UIA_TableItemPatternId:
                        return(new TableItemPattern(e, pt));

                    case PatternType.UIA_TablePatternId:
                        return(new TablePattern(e, pt));

                    case PatternType.UIA_TextChildPatternId:
                        return(new TextChildPattern(e, pt));

                    case PatternType.UIA_TextEditPatternId:
                        return(new TextEditPattern(e, pt));

                    case PatternType.UIA_TextPatternId:
                        return(new TextPattern(e, pt));

                    case PatternType.UIA_TextPattern2Id:
                        return(new TextPattern2(e, pt));

                    case PatternType.UIA_TogglePatternId:
                        return(new TogglePattern(e, pt));

                    case PatternType.UIA_TransformPatternId:
                        return(new TransformPattern(e, pt));

                    case PatternType.UIA_TransformPattern2Id:
                        return(new TransformPattern2(e, pt));

                    case PatternType.UIA_ValuePatternId:
                        return(new ValuePattern(e, pt));

                    case PatternType.UIA_VirtualizedItemPatternId:
                        return(new VirtualizedItemPattern(e, pt));

                    case PatternType.UIA_WindowPatternId:
                        return(new WindowPattern(e, pt));
                    }
                }
                return(new UnKnownPattern(e, id, name));
            }
#pragma warning disable CA1031 // Do not catch general exception types
            catch (Exception ex)
            {
                ex.ReportException();

                return(null);
            }
#pragma warning restore CA1031 // Do not catch general exception types
        }
 public PatternInfoControl()
 {
     InitializeComponent();
     PatternType.GetInstance().GetKeyValuePairList().ForEach(kv => ExpStates[kv.Key] = false);
 }
Exemplo n.º 6
0
 public void CheckExists()
 {
     Assert.AreEqual(PatternType.GetInstance().Exists(PatternType.UIA_DockPatternId), true);
     Assert.AreEqual(PatternType.GetInstance().Exists(0), false);
 }
Exemplo n.º 7
0
        public override string ToString()
        {
            var patternName = PatternType.GetInstance().GetNameById(this.PatternID);

            return($"has {patternName} pattern");
        }
Exemplo n.º 8
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="e"></param>
 public A11yPattern(A11yElement e, int id) : this(e, id, PatternType.GetInstance().GetNameById(id))
 {
 }