Add() public method

public Add ( String name, String localizedName, string description, ActionDelegate doAction ) : void
name String
localizedName String
description string
doAction ActionDelegate
return void
示例#1
0
文件: TreeItem.cs 项目: mono/uia2atk
		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);
		}
示例#2
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);
        }
示例#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);
        }
示例#4
0
        internal void AddExpandContractAction()
        {
            if (expandCollapseProvider == null)
            {
                return;
            }

            actionExpert.Add(EXPAND_OR_CONTRACT_ACTION_NAME,
                             EXPAND_OR_CONTRACT_ACTION_NAME,
                             EXPAND_OR_CONTRACT_ACTION_DESC,
                             DoExpandCollapse);
        }
示例#5
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);
        }
示例#6
0
		public HeaderItem (IRawElementProviderSimple provider) : base (provider)
		{
			Role = Atk.Role.TableColumnHeader;

			invokeProvider = (IInvokeProvider) provider.GetPatternProvider (InvokePatternIdentifiers.Pattern.Id);		
			imageExpert = new ImageImplementorHelper (this); 

			actionExpert = new ActionImplementorHelper ();
			if (invokeProvider != null)
				actionExpert.Add ("click", "click", null, DoClick);
		}
示例#7
0
文件: ListItem.cs 项目: mono/uia2atk
		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);
		}
示例#8
0
        public HeaderItem(IRawElementProviderSimple provider) : base(provider)
        {
            Role = Atk.Role.TableColumnHeader;

            invokeProvider = (IInvokeProvider)provider.GetPatternProvider(InvokePatternIdentifiers.Pattern.Id);
            imageExpert    = new ImageImplementorHelper(this);

            actionExpert = new ActionImplementorHelper();
            if (invokeProvider != null)
            {
                actionExpert.Add("click", "click", null, DoClick);
            }
        }
示例#9
0
        public override void RaiseAutomationPropertyChangedEvent(AutomationPropertyChangedEventArgs e)
        {
            if (editableTextExpert.RaiseAutomationPropertyChangedEvent(e))
            {
                return;
            }

            if (e.Property == AutomationElementIdentifiers.HasKeyboardFocusProperty)
            {
                bool    focused       = (bool)e.NewValue;
                Adapter parentAdapter = (Adapter)Parent;
                if (parentAdapter is List)
                {
                    ((List)parentAdapter).HandleItemFocus(this, focused);
                    return;
                }
                parentAdapter.NotifyStateChange(Atk.StateType.Focused, focused);
                if (focused)
                {
                    Atk.Focus.TrackerNotify(parentAdapter);
                }
            }
            else if (e.Property == TogglePatternIdentifiers.ToggleStateProperty)
            {
                NotifyStateChange(Atk.StateType.Checked, IsChecked((ToggleState)e.NewValue));
            }
            else if (e.Property == AutomationElementIdentifiers.IsTogglePatternAvailableProperty)
            {
                if ((bool)e.NewValue == true)
                {
                    toggleProvider = (IToggleProvider)Provider.GetPatternProvider(TogglePatternIdentifiers.Pattern.Id);
                    actionExpert.Add("toggle", "toggle", null, DoToggle);
                }
                else
                {
                    toggleProvider = null;
                    actionExpert.Remove("toggle");
                }
            }
            else
            {
                base.RaiseAutomationPropertyChangedEvent(e);
            }
        }
示例#10
0
 public SpinnerWithValue(IRawElementProviderSimple provider) : base(provider)
 {
     actionExpert = new ActionImplementorHelper();
     actionExpert.Add("activate", "activate", null, DoActivate);
 }
示例#11
0
文件: Spinner.cs 项目: mono/uia2atk
		public SpinnerWithValue (IRawElementProviderSimple provider) : base (provider)
		{
			actionExpert = new ActionImplementorHelper ();
			actionExpert.Add ("activate", "activate", null, DoActivate);
		}