Exemple #1
0
        public bool TryGetControlIsEnabled(string controlId, out bool isEnabled, int ordinal, string parentId)
        {
            isEnabled = false;
            var command = new GetIsEnabledCommand
            {
                AutomationIdentifier = CreateAutomationIdentifier(controlId),
                Ordinal          = ordinal,
                ParentIdentifier = CreateAutomationIdentifier(parentId)
            };

            var result        = SyncExecuteCommand(command);
            var successResult = result as SuccessResult;

            return(successResult != null && bool.TryParse(successResult.ResultText, out isEnabled));
        }
        public bool TryGetControlIsEnabled(string controlId, out bool isEnabled, int ordinal, string parentId)
        {
            isEnabled = false;
            var command = new GetIsEnabledCommand
                {
                    AutomationIdentifier = CreateAutomationIdentifier(controlId),
                    Ordinal = ordinal,
                    ParentIdentifier = CreateAutomationIdentifier(parentId)
                };

            var result = SyncExecuteCommand(command);
            var successResult = result as SuccessResult;
            return successResult != null && bool.TryParse(successResult.ResultText, out isEnabled);
        }
        public bool TryGetControlIsEnabled(string controlId, out bool isEnabled)
        {
            isEnabled = false;
            var command = new GetIsEnabledCommand()
            {
                AutomationIdentifier = CreateAutomationIdentifier(controlId)
            };
            var result = SyncExecuteCommand(command);
            var successResult = result as SuccessResult;
            if (successResult == null)
                return false;

            if (!Boolean.TryParse(successResult.ResultText, out isEnabled))
                return false;

            return true;
        }