Beispiel #1
0
        private static double GetNextPreviousOffsetBasedOnCalendarViewMode(CurrentCalendarView mode)
        {
            double offset;

            switch (mode)
            {
            case CurrentCalendarView.Day:
                offset = 1;
                break;

            case CurrentCalendarView.Week:
            case CurrentCalendarView.WorkWeek:
                offset = 7;
                break;

            case CurrentCalendarView.Month:
                offset = 31;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(mode), mode, null);
            }

            return(offset);
        }
Beispiel #2
0
        // Terrible hack to get around a bug in the Outlook View Control where if you have more than one
        // calendar view active, GoToDate will not work on the instance it's called on, instead it will
        // work on the last "active" view of the calendar, which may or may not be the current one.
        // So to get around that, if the last clicked next button was not this one, we reset the
        // calendar view to make it active, before using GoToDate.
        private void SetCurrentViewControlAsActiveIfNecessary(CurrentCalendarView mode, Button button, ref Guid lastButtonGuidClicked)
        {
            // we don't need to do this if we only have one instance, so bail right away.
            if (InstanceManager.InstanceCount == 1)
            {
                return;
            }

            // we can bail if we know the last button clicked was the one on this form.
            if ((Guid)button.Tag == lastButtonGuidClicked)
            {
                return;
            }

            var currentDate = OutlookViewControl.SelectedDate;

            switch (mode)
            {
            case CurrentCalendarView.Day:
                SetViewXml(Resources.DayXML);
                break;

            case CurrentCalendarView.Week:
                SetViewXml(Resources.WeekXML);
                break;

            case CurrentCalendarView.WorkWeek:
                SetViewXml(Resources.WorkWeekXML);
                break;

            case CurrentCalendarView.Month:
                SetViewXml(Resources.MonthXML);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(mode), mode, null);
            }

            OutlookViewControl.GoToDate(currentDate.ToString(CultureInfo.InvariantCulture));
            lastButtonGuidClicked = (Guid)button.Tag;
        }
Beispiel #3
0
        private static double GetNextPreviousOffsetBasedOnCalendarViewMode(CurrentCalendarView mode)
        {
            double offset = 0;

            switch (mode)
            {
            case CurrentCalendarView.Day:
                offset = 1;
                break;

            case CurrentCalendarView.Week:
            case CurrentCalendarView.WorkWeek:
                offset = 7;
                break;

            case CurrentCalendarView.Month:
                offset = 31;
                break;
            }
            return(offset);
        }
Beispiel #4
0
        // Terrible hack to get around a bug in the Outlook View Control where if you have more than one
        // calendar view active, GoToDate will not work on the instance it's called on, instead it will
        // work on the last "active" view of the calendar, which may or may not be the current one.
        // So to get around that, if the last clicked next button was not this one, we reset the
        // calendar view to make it active, before using GoToDate.
        private void SetCurrentViewControlAsActiveIfNecessary(CurrentCalendarView mode, Button button, ref Guid lastButtonGuidClicked)
        {
            // we don't need to do this if we only have one instance, so bail right away.
            if (InstanceManager.InstanceCount == 1) return;

            // we can bail if we know the last button clicked was the one on this form.
            if ((Guid)button.Tag == lastButtonGuidClicked) return;

            var currentDate = OutlookViewControl.SelectedDate;
            switch (mode)
            {
                case CurrentCalendarView.Day:
                    SetViewXml(Resources.DayXML);
                    break;
                case CurrentCalendarView.Week:
                    SetViewXml(Resources.WeekXML);
                    break;
                case CurrentCalendarView.WorkWeek:
                    SetViewXml(Resources.WorkWeekXML);
                    break;
                case CurrentCalendarView.Month:
                    SetViewXml(Resources.MonthXML);
                    break;
            }

            OutlookViewControl.GoToDate(currentDate.ToString(CultureInfo.InvariantCulture));
            lastButtonGuidClicked = (Guid)button.Tag;
        }
Beispiel #5
0
        private static double GetNextPreviousOffsetBasedOnCalendarViewMode(CurrentCalendarView mode)
        {
            double offset = 0;

            switch (mode)
            {
                case CurrentCalendarView.Day:
                    offset = 1;
                    break;
                case CurrentCalendarView.Week:
                case CurrentCalendarView.WorkWeek:
                    offset = 7;
                    break;
                case CurrentCalendarView.Month:
                    offset = 31;
                    break;
            }
            return offset;
        }