Beispiel #1
0
        public ListItem(IRawElementProviderSimple provider) : base(provider)
        {
            invokeProvider        = (IInvokeProvider)provider.GetPatternProvider(InvokePatternIdentifiers.Pattern.Id);
            selectionItemProvider = (ISelectionItemProvider)provider.GetPatternProvider(SelectionItemPatternIdentifiers.Pattern.Id);
            if (selectionItemProvider == null)
            {
                throw new ArgumentException("ListItem should always implement ISelectionItemProvider");
            }
            toggleProvider = (IToggleProvider)provider.GetPatternProvider(TogglePatternIdentifiers.Pattern.Id);

            textExpert         = TextImplementorFactory.GetImplementor(this, provider);
            imageExpert        = new ImageImplementorHelper(this);
            actionExpert       = new ActionImplementorHelper();
            editableTextExpert = new EditableTextImplementorHelper(this, this, textExpert);

            // TODO: Localize the name?s
            actionExpert.Add("click", "click", null, DoClick);
            if (toggleProvider != null)
            {
                actionExpert.Add("toggle", "toggle", null, DoToggle);
            }
            if (invokeProvider != null)
            {
                actionExpert.Add("invoke", "invoke", null, DoInvoke);
            }
            Role = (toggleProvider != null? Atk.Role.CheckBox: Atk.Role.ListItem);
        }
Beispiel #2
0
 public Slider(IRawElementProviderSimple provider) : base(provider)
 {
     Role = Atk.Role.Slider;
     rangeValueProvider = (IRangeValueProvider)provider.GetPatternProvider(RangeValuePatternIdentifiers.Pattern.Id);
     textExpert         = TextImplementorFactory.GetImplementor(this, provider);
     oldText            = textExpert.Text;
 }
Beispiel #3
0
        public TreeItem(IRawElementProviderSimple provider) : base(provider)
        {
            invokeProvider        = (IInvokeProvider)provider.GetPatternProvider(InvokePatternIdentifiers.Pattern.Id);
            selectionItemProvider = (ISelectionItemProvider)provider.GetPatternProvider(SelectionItemPatternIdentifiers.Pattern.Id);

            expandCollapseProvider = provider.GetPatternProvider(
                ExpandCollapsePatternIdentifiers.Pattern.Id) as IExpandCollapseProvider;

            textExpert   = TextImplementorFactory.GetImplementor(this, provider);
            actionExpert = new ActionImplementorHelper();

            // TODO: Localize the name?s
            actionExpert.Add("click", "click", null, DoClick);
            if (ToggleProvider != null)
            {
                actionExpert.Add("toggle", "toggle", null, DoToggle);
            }
            if (invokeProvider != null)
            {
                actionExpert.Add("invoke", "invoke", null, DoInvoke);
            }

            IRawElementProviderFragment fragment = Provider as IRawElementProviderFragment;

            if (fragment != null && fragment.Navigate(NavigateDirection.FirstChild) != null)
            {
                AddExpandContractAction();
            }

            Role = (ToggleProvider != null? Atk.Role.CheckBox: Atk.Role.TableCell);

            imageExpert        = new ImageImplementorHelper(this);
            editableTextExpert = new EditableTextImplementorHelper(this, this, textExpert);
        }
Beispiel #4
0
        public MenuItem(IRawElementProviderSimple provider) : base(provider)
        {
            if (provider == null)
            {
                throw new ArgumentNullException("provider");
            }

            if ((provider as IRawElementProviderFragment) == null)
            {
                throw new ArgumentException("Provider for ParentMenu should be IRawElementProviderFragment");
            }

            textExpert = TextImplementorFactory.GetImplementor(this, provider);

            Role = Atk.Role.MenuItem;

            string name = (string)provider.GetPropertyValue(AutomationElementIdentifiers.NameProperty.Id);

            if (!String.IsNullOrEmpty(name))
            {
                Name = name;
            }

            invokeProvider = (IInvokeProvider)
                             provider.GetPatternProvider(InvokePatternIdentifiers.Pattern.Id);
            toggleProvider = (IToggleProvider)
                             provider.GetPatternProvider(TogglePatternIdentifiers.Pattern.Id);
            selectionItemProvider = (ISelectionItemProvider)
                                    provider.GetPatternProvider(SelectionItemPatternIdentifiers.Pattern.Id);
            expandCollapseProvider = (IExpandCollapseProvider)
                                     provider.GetPatternProvider(ExpandCollapsePatternIdentifiers.Pattern.Id);

            actionExpert.Add("click", "click", null, DoClick);
        }
Beispiel #5
0
        public TextBoxEntryView(IRawElementProviderSimple provider) : base(provider)
        {
            if (IsTableCell)
            {
                Role = Atk.Role.TableCell;
            }
            else
            {
                Role = Atk.Role.Text;
            }

            if (provider.GetPatternProvider(TextPatternIdentifiers.Pattern.Id) == null &&
                provider.GetPatternProvider(ValuePatternIdentifiers.Pattern.Id) == null)
            {
                throw new ArgumentException("Provider for TextBox should either implement IValue or IText");
            }

            textExpert = TextImplementorFactory.GetImplementor(this, provider);
            if ((int)provider.GetPropertyValue(AutomationElementIdentifiers.ControlTypeProperty.Id)
                == ControlType.Document.Id)
            {
                multiLine = true;
            }

            editableTextExpert = new EditableTextImplementorHelper(this, this, textExpert);
        }
Beispiel #6
0
        public Hyperlink(IRawElementProviderSimple provider) : base(provider)
        {
            invokeProvider = (IInvokeProvider)provider.GetPatternProvider(InvokePatternIdentifiers.Pattern.Id);
            hypertext      = (IHypertext)invokeProvider;
            links          = new List <HyperlinkObject> ();
            Role           = Atk.Role.Label;

            textExpert = TextImplementorFactory.GetImplementor(this, provider);
        }
Beispiel #7
0
        public Spinner(IRawElementProviderSimple provider) : base(provider)
        {
            Role = Atk.Role.SpinButton;
            rangeValueProvider = (IRangeValueProvider)provider.GetPatternProvider(RangeValuePatternIdentifiers.Pattern.Id);

            editableRange
                = provider.GetPatternProvider(EditableRangePatternIdentifiers.Pattern.Id) as IEditableRangeProvider;

            valueProvider = (IValueProvider)provider.GetPatternProvider(ValuePatternIdentifiers.Pattern.Id);
            textExpert    = TextImplementorFactory.GetImplementor(this, provider);
            oldText       = textExpert.Text;
        }
Beispiel #8
0
        // UI Automation Properties supported
        // AutomationElementIdentifiers.AcceleratorKeyProperty.Id
        // AutomationIdProperty() ?
        // AutomationElementIdentifiers.BoundingRectangleProperty.Id
        // AutomationElementIdentifiers.ClickablePointProperty.Id
        // AutomationElementIdentifiers.ControlTypeProperty.Id
        // AutomationElementIdentifiers.HelpTextProperty.Id
        // AutomationElementIdentifiers.IsContentElementProperty.Id
        // AutomationElementIdentifiers.IsControlElementProperty.Id
        // AutomationElementIdentifiers.IsKeyboardFocusableProperty.Id
        // AutomationElementIdentifiers.LabeledByProperty.Id
        // AutomationElementIdentifiers.LocalizedControlTypeProperty.Id
        // AutomationElementIdentifiers.NameProperty.Id
        public Button(IRawElementProviderSimple provider) : base(provider)
        {
            invokeProvider   = (IInvokeProvider)provider.GetPatternProvider(InvokePatternIdentifiers.Pattern.Id);
            imageImplementor = new ImageImplementorHelper(this);
            InitializeAdditionalProviders();
            if (invokeProvider != null)
            {
                //it seems the default description should be null
                actionName = default_invoke_name;
                Role       = Atk.Role.PushButton;
            }

            textExpert = TextImplementorFactory.GetImplementor(this, provider);
        }
Beispiel #9
0
        public ListWithEditableText(IRawElementProviderFragmentRoot provider)
            : base(provider)
        {
            IValueProvider value_prov
                = provider.GetPatternProvider(ValuePatternIdentifiers.Pattern.Id) as IValueProvider;

            if (value_prov == null)
            {
                throw new ArgumentException("Provider does not implement IValue");
            }

            text_helper        = TextImplementorFactory.GetImplementor(this, provider);
            editableTextExpert = new EditableTextImplementorHelper(this, this, text_helper);
        }
Beispiel #10
0
        public ComboBoxItem(IRawElementProviderSimple provider) : base(provider)
        {
            int controlType = (int)provider.GetPropertyValue(AutomationElementIdentifiers.ControlTypeProperty.Id);

            selectionItemProvider = (ISelectionItemProvider)provider.GetPatternProvider(
                SelectionItemPatternIdentifiers.Pattern.Id);
            if (selectionItemProvider == null)
            {
                throw new ArgumentException(
                          String.Format("Provider for ComboBoxItem (control type {0}) should implement ISelectionItemProvider", controlType));
            }

            textExpert = TextImplementorFactory.GetImplementor(this, provider);

            //FIXME: take in account ComboBox style changes at runtime
            if (ParentIsSimple())
            {
                Role = Atk.Role.TableCell;
            }
            else
            {
                Role = Atk.Role.MenuItem;
            }
        }
Beispiel #11
0
        public TextContainer(IRawElementProviderSimple provider) : base(provider)
        {
            Role = Atk.Role.Statusbar;

            textExpert = TextImplementorFactory.GetImplementor(this, provider);
        }
Beispiel #12
0
        public TextLabel(IRawElementProviderSimple provider) : base(provider)
        {
            Role = Atk.Role.Label;

            textExpert = TextImplementorFactory.GetImplementor(this, provider);
        }