예제 #1
0
        private void PreviousSlot_Click(object sender, RoutedEventArgs e)
        {
            var serviceProvider       = ScheduleView.GetServiceProvider();
            var slotSelectionService  = serviceProvider.GetService <SlotSelectionService>();
            var slotIterationProvider = serviceProvider.GetService <ISlotIterationService>();

            Slot previous;
            var  last = slotSelectionService.GetSelection();

            if (last == null)
            {
                previous = slotIterationProvider.GetSlots().Last();
            }
            else
            {
                previous = last.Copy();

                previous.End   = last.Start;
                previous.Start = last.Start.Add(-last.Duration());

                if (!ScheduleView.VisibleRange.Contains(previous.Start))
                {
                    previous = slotIterationProvider.GetSlots().Last();
                }
            }
            slotSelectionService.SetSelection(previous);
            ScheduleView.ScrollIntoView(previous);
        }
예제 #2
0
        private void NextSlot_Click(object sender, RoutedEventArgs e)
        {
            var serviceProvider       = ScheduleView.GetServiceProvider();
            var slotSelectionService  = serviceProvider.GetService <SlotSelectionService>();
            var slotIterationProvider = serviceProvider.GetService <ISlotIterationService>();

            Slot next;
            var  start = slotSelectionService.GetSelection();

            if (start == null)
            {
                next = slotIterationProvider.GetSlots().First();
            }
            else
            {
                next       = start.Copy();
                next.Start = start.End;
                next.End   = start.End.Add(start.Duration());

                if (!ScheduleView.VisibleRange.Contains(next.Start))
                {
                    next = slotIterationProvider.GetSlots().First();
                }
            }
            slotSelectionService.SetSelection(next);
            ScheduleView.ScrollIntoView(next);
        }
예제 #3
0
        private void NextAppointment_Click(object sender, RoutedEventArgs e)
        {
            var serviceProvider             = ScheduleView.GetServiceProvider();
            var occurrenceSelectionService  = serviceProvider.GetService <AppointmentSelectionService>();
            var occurrenceIterationProvider = serviceProvider.GetService <IOccurrenceIterationProvider>();
            var start = occurrenceSelectionService.GetSelection().FirstOrDefault();
            var next  = occurrenceIterationProvider.GetOccurrencesFrom(start).Skip(1).FirstOrDefault() ?? occurrenceIterationProvider.GetOccurrences().FirstOrDefault();

            if (next != null)
            {
                occurrenceSelectionService.SetSelection(next);
                ScheduleView.ScrollIntoView(next);
            }
        }
예제 #4
0
        private void PreviousAppointment_Click(object sender, RoutedEventArgs e)
        {
            var serviceProvider             = ScheduleView.GetServiceProvider();
            var occurrenceSelectionService  = serviceProvider.GetService <AppointmentSelectionService>();
            var occurrenceIterationProvider = serviceProvider.GetService <IOccurrenceIterationProvider>();
            var start = occurrenceSelectionService.GetSelection().FirstOrDefault();

            var previous = occurrenceIterationProvider.GetOccurrencesTo(start).Take(occurrenceIterationProvider.GetOccurrencesTo(start).Count() - 1).LastOrDefault() ?? occurrenceIterationProvider.GetOccurrences().LastOrDefault();

            if (previous != null)
            {
                occurrenceSelectionService.SetSelection(previous);
                ScheduleView.ScrollIntoView(previous);
            }
        }