public CalendarCellAccessibleObject(CalendarRowAccessibleObject calendarRowAccessibleObject, CalendarBodyAccessibleObject calendarBodyAccessibleObject, MonthCalendarAccessibleObject monthCalendarAccessibleObject, int calendarIndex, int rowIndex, int columnIndex) : base(monthCalendarAccessibleObject) { _calendarRowAccessibleObject = calendarRowAccessibleObject; _calendarBodyAccessibleObject = calendarBodyAccessibleObject; _monthCalendarAccessibleObject = monthCalendarAccessibleObject; _calendarIndex = calendarIndex; _rowIndex = rowIndex; _columnIndex = columnIndex; // RuntimeId don't change if the calendar date range is not changed, // otherwise the calendar accessibility tree will be rebuilt. // So save this value one time to avoid recreating new structures and making extra calculations. _initRuntimeId = new int[] { _calendarRowAccessibleObject.RuntimeId[0], _calendarRowAccessibleObject.RuntimeId[1], _calendarRowAccessibleObject.RuntimeId[2], _calendarRowAccessibleObject.RuntimeId[3], _calendarRowAccessibleObject.RuntimeId[4], GetChildId() }; }
private CalendarCellAccessibleObject GetCalendarCell(int calendarIndex, AccessibleObject parentAccessibleObject, int columnIndex) { if (columnIndex < 0 || columnIndex >= MAX_DAYS || columnIndex >= ColumnCount) { return(null); } CalendarRowAccessibleObject parentRowAccessibleObject = (CalendarRowAccessibleObject)parentAccessibleObject; int rowIndex = parentRowAccessibleObject.RowIndex; bool getNameResult = GetCalendarGridInfoText(ComCtl32.MCGIP.CALENDARCELL, calendarIndex, rowIndex, columnIndex, out string text); bool getDateResult = GetCalendarGridInfo(ComCtl32.MCGIF.DATE, ComCtl32.MCGIP.CALENDARCELL, calendarIndex, rowIndex, columnIndex, out RECT rectangle, out Kernel32.SYSTEMTIME systemEndDate, out Kernel32.SYSTEMTIME systemStartDate); DateTime endDate = DateTimePicker.SysTimeToDateTime(systemEndDate).Date; DateTime startDate = DateTimePicker.SysTimeToDateTime(systemStartDate).Date; if (getNameResult && !string.IsNullOrEmpty(text)) { string cellName = GetCalendarCellName(endDate, startDate, text, rowIndex == -1); // The cell is present on the calendar, so create accessible object for it. return(new CalendarCellAccessibleObject(this, calendarIndex, parentAccessibleObject, rowIndex, columnIndex, cellName)); } return(null); }
public void CalendarRowAccessibleObject_ctor_default() { using MonthCalendar control = new(); CalendarRowAccessibleObject rowAccessibleObject = CreateCalendarRowAccessibleObject(control); Assert.Equal(0, rowAccessibleObject.TestAccessor().Dynamic._calendarIndex); Assert.Equal(0, rowAccessibleObject.TestAccessor().Dynamic._rowIndex); Assert.False(control.IsHandleCreated); }
public void CalendarRowAccessibleObject_Row_ReturnsExpected(int rowIndex) { using MonthCalendar control = new(); CalendarRowAccessibleObject rowAccessibleObject = CreateCalendarRowAccessibleObject(control, 0, rowIndex); int actual = rowAccessibleObject.Row; Assert.Equal(rowIndex, actual); Assert.False(control.IsHandleCreated); }
public void CalendarRowAccessibleObject_Role_IsRow() { using MonthCalendar control = new(); CalendarRowAccessibleObject rowAccessibleObject = CreateCalendarRowAccessibleObject(control); AccessibleRole actual = rowAccessibleObject.Role; Assert.Equal(AccessibleRole.Row, actual); Assert.False(control.IsHandleCreated); }
public void CalendarRowAccessibleObject_Name_IsNull() { using MonthCalendar control = new(); CalendarRowAccessibleObject rowAccessibleObject = CreateCalendarRowAccessibleObject(control); string actual = rowAccessibleObject.Name; Assert.Null(actual); Assert.False(control.IsHandleCreated); }
public void CalendarRowAccessibleObject_ControlType_IsPane() { using MonthCalendar control = new(); CalendarRowAccessibleObject rowAccessibleObject = CreateCalendarRowAccessibleObject(control); UiaCore.UIA actual = (UiaCore.UIA)rowAccessibleObject.GetPropertyValue(UiaCore.UIA.ControlTypePropertyId); Assert.Equal(UiaCore.UIA.PaneControlTypeId, actual); Assert.False(control.IsHandleCreated); }
public CalendarWeekNumberCellAccessibleObject(CalendarRowAccessibleObject calendarRowAccessibleObject, CalendarBodyAccessibleObject calendarBodyAccessibleObject, MonthCalendarAccessibleObject monthCalendarAccessibleObject, int calendarIndex, int rowIndex, int columnIndex, string weekNumber) : base(calendarRowAccessibleObject, calendarBodyAccessibleObject, monthCalendarAccessibleObject, calendarIndex, rowIndex, columnIndex) { _calendarRowAccessibleObject = calendarRowAccessibleObject; // Name don't change if the calendar date range is not changed, // otherwise the calendar accessibility tree will be rebuilt. // So save this value one time to avoid sending messages to Windows every time. _weekNumber = weekNumber; }