Beispiel #1
0
 private void RegisterStandaloneProperties(IUIAutomationRegistrar registrar)
 {
     foreach (var propertyInfoHelper in StandaloneProperties)
     {
         int id;
         var propInfo = propertyInfoHelper.Data;
         registrar.RegisterProperty(ref propInfo, out id);
         propertyInfoHelper.PropertyId = id;
     }
 }
        static AutomationElement()
        {
            Guid   rclsid = CLSID_CUIAutomation;
            Guid   riid   = IID_IUIAutomation;
            object obj    = null;

            PInvoke.CoCreateInstance(ref rclsid, IntPtr.Zero, 1, ref riid, out obj);
            if (obj == null)
            {
                return;
            }
            pAutomation = obj as IUIAutomation;

            rclsid = CLSID_CUIAutomationRegistrar;
            riid   = IID_IUIAutomationRegistrar;
            PInvoke.CoCreateInstance(ref rclsid, IntPtr.Zero, 1, ref riid, out obj);
            IUIAutomationRegistrar pRegistrar = obj as IUIAutomationRegistrar;

            try {
                UIAutomationPropertyInfo propinfo;
                propinfo = new UIAutomationPropertyInfo {
                    guid = ItemCount_Property_GUID,
                    pProgrammaticName = "ItemCount",
                    type = UIAutomationType_Int
                };
                pRegistrar.RegisterProperty(propinfo, out UIA_ItemCountPropertyId);
                propinfo = new UIAutomationPropertyInfo {
                    guid = SelectedItemCount_Property_GUID,
                    pProgrammaticName = "SelectedItemCount",
                    type = UIAutomationType_Int
                };
                pRegistrar.RegisterProperty(propinfo, out UIA_SelectedCountPropertyId);
                propinfo = new UIAutomationPropertyInfo {
                    guid = ItemIndex_Property_GUID,
                    pProgrammaticName = "ItemIndex",
                    type = UIAutomationType_Int
                };
                pRegistrar.RegisterProperty(propinfo, out UIA_ItemIndexPropertyId);
            }
            finally {
                if (pRegistrar != null)
                {
                    Marshal.ReleaseComObject(pRegistrar);
                }
            }
        }
Beispiel #3
0
        static AutomationElement()
        {
            // Register the ItemsView custom properties, as documented here:
            // http://msdn.microsoft.com/en-us/library/ff486373%28VS.85%29.aspx

            Guid   rclsid = CLSID_CUIAutomationRegistrar;
            Guid   riid   = IID_IUIAutomationRegistrar;
            object obj;

            PInvoke.CoCreateInstance(ref rclsid, IntPtr.Zero, 1, ref riid, out obj);
            IUIAutomationRegistrar pRegistrar = obj as IUIAutomationRegistrar;

            try {
                UIAutomationPropertyInfo propinfo;
                propinfo = new UIAutomationPropertyInfo {
                    guid = ItemCount_Property_GUID,
                    pProgrammaticName = "ItemCount",
                    type = UIAutomationType_Int
                };
                pRegistrar.RegisterProperty(ref propinfo, out UIA_ItemCountPropertyId);
                propinfo = new UIAutomationPropertyInfo {
                    guid = SelectedItemCount_Property_GUID,
                    pProgrammaticName = "SelectedItemCount",
                    type = UIAutomationType_Int
                };
                pRegistrar.RegisterProperty(ref propinfo, out UIA_SelectedCountPropertyId);
                propinfo = new UIAutomationPropertyInfo {
                    guid = ItemIndex_Property_GUID,
                    pProgrammaticName = "ItemIndex",
                    type = UIAutomationType_Int
                };
                pRegistrar.RegisterProperty(ref propinfo, out UIA_ItemIndexPropertyId);
            }
            finally {
                if (pRegistrar != null)
                {
                    Marshal.ReleaseComObject(pRegistrar);
                }
            }
        }
Beispiel #4
0
 internal Registrar(IUIAutomationRegistrar uiaRegistrar, Action <int, ITypeConverter> converterRegistrationAction)
 {
     _uiaRegistrar = uiaRegistrar;
     _converterRegistrationAction = converterRegistrationAction;
     _idToCustomPropertyMap       = new Dictionary <int, CustomProperty>();
 }
 private void RegisterStandaloneProperties(IUIAutomationRegistrar registrar)
 {
     foreach (var propertyInfoHelper in StandaloneProperties)
     {
         int id;
         var propInfo = propertyInfoHelper.Data;
         registrar.RegisterProperty(ref propInfo, out id);
         propertyInfoHelper.PropertyId = id;
     }
 }