public override AppResult Text(string text, bool exact)
        {
            if (ResultObject is NSControl)
            {
                NSControl control = (NSControl)ResultObject;
                string    value   = control.StringValue;
                if (CheckForText(value, text, exact))
                {
                    return(this);
                }

                if (ResultObject is NSButton)
                {
                    var nsButton = (NSButton)ResultObject;
                    if (CheckForText(nsButton.Title, text, exact))
                    {
                        return(this);
                    }
                }
            }

            if (ResultObject is NSSegmentedControl)
            {
                NSSegmentedControl control = (NSSegmentedControl)ResultObject;
                string             value   = control.GetLabel(this.index);
                if (CheckForText(value, text, exact))
                {
                    return(this);
                }
            }

            return(null);
        }
Exemple #2
0
        public override AppResult Text(string text, bool exact)
        {
            if (ResultObject is NSTableView)
            {
                var control = (NSTableView)ResultObject;
                for (int i = 0; i < control.ColumnCount; i++)
                {
                    var cell       = control.GetCell(i, index);
                    var possValues = GetPossibleNSCellValues(cell);
                    LoggingService.LogInfo($"Possible values for NSTableView with column {i} and row {index} -> " + string.Join(", ", possValues));
                    if (possValues.Any(haystack => CheckForText(text, haystack, exact)))
                    {
                        return(this);
                    }
                }
            }
            if (ResultObject is NSControl)
            {
                NSControl control = (NSControl)ResultObject;
                string    value   = control.StringValue;
                if (CheckForText(value, text, exact))
                {
                    return(this);
                }

                if (ResultObject is NSButton)
                {
                    var nsButton = (NSButton)ResultObject;
                    if (CheckForText(nsButton.Title, text, exact))
                    {
                        return(this);
                    }
                }
            }

            if (ResultObject is NSSegmentedControl)
            {
                NSSegmentedControl control = (NSSegmentedControl)ResultObject;
                string             value   = control.GetLabel(this.index);
                if (CheckForText(value, text, exact))
                {
                    return(this);
                }
            }

            return(null);
        }