コード例 #1
0
        public static ToggleState GetCheckState(IntPtr controlHandle)
        {
            try
            {
                AutomationElement control = CommonUIAPatternHelpers.Prologue(TogglePattern.Pattern, controlHandle);
                StaticEvents.RegisterEvent(TogglePattern.ToggleStateProperty, control);

                ToggleState ret = TogglePatternHelper.GetToggleState(control);
                if (ret == ToggleState.Indeterminate)
                {
                    /* Otherwise, retry with native method */
                    ret = ProdCheckBoxNative.GetCheckStateNative(controlHandle);
                }

                LogController.ReceiveLogMessage(new LogMessage(control.Current.Name));

                return(ret);
            }
            catch (InvalidOperationException err)
            {
                throw new ProdOperationException(err.Message, err);
            }
            catch (ElementNotAvailableException err)
            {
                throw new ProdOperationException(err.Message, err);
            }
            catch (ArgumentException err)
            {
                throw new ProdOperationException(err.Message, err);
            }
        }
コード例 #2
0
        public static ToggleState GetCheckState(ProdWindow prodwindow, string automationId)
        {
            try
            {
                AutomationElement control = InternalUtilities.GetHandlelessElement(prodwindow, automationId);
                StaticEvents.RegisterEvent(TogglePattern.ToggleStateProperty, control);

                ToggleState ret = TogglePatternHelper.GetToggleState(control);

                LogController.ReceiveLogMessage(new LogMessage(control.Current.Name));

                return(ret);
            }
            catch (InvalidOperationException err)
            {
                throw new ProdOperationException(err.Message, err);
            }
            catch (ElementNotAvailableException err)
            {
                throw new ProdOperationException(err.Message, err);
            }
            catch (ArgumentException err)
            {
                throw new ProdOperationException(err.Message, err);
            }
        }
コード例 #3
0
        private static ToggleState UiaGetToggleState(BaseProdControl control)
        {
            ToggleState ret = TogglePatternHelper.GetToggleState(control.UIAElement);

            LogController.ReceiveLogMessage(new LogMessage(ret.ToString()));
            return(ret);
        }
コード例 #4
0
 public static bool GetRadioState(IntPtr controlHandle)
 {
     try
     {
         AutomationElement control = CommonUIAPatternHelpers.Prologue(SelectionPattern.Pattern, controlHandle);
         bool ret = (TogglePatternHelper.GetToggleState(control) == ToggleState.On);
         LogController.ReceiveLogMessage(new LogMessage(control.Current.Name));
         return(ret);
     }
     catch (InvalidOperationException err)
     {
         throw new ProdOperationException(err.Message, err);
     }
     catch (ElementNotAvailableException err)
     {
         throw new ProdOperationException(err.Message, err);
     }
     catch (ArgumentException err)
     {
         throw new ProdOperationException(err.Message, err);
     }
 }