Exemplo n.º 1
0
        private void OnRadioGroupSelectedIndexChanged(NValueChangeEventArgs arg)
        {
            NSchedule    schedule    = m_ScheduleView.Content;
            NAppointment appointment = (NAppointment)schedule.Appointments[0];

            int selectedIndex = (int)arg.NewValue;

            switch (selectedIndex)
            {
            case 0:
                appointment.RecurrenceRule = null;
                schedule.ViewMode          = ENScheduleViewMode.Week;
                break;

            case 1:
                appointment.RecurrenceRule = CreateHourlyRule();
                schedule.ViewMode          = ENScheduleViewMode.Week;
                break;

            case 2:
                appointment.RecurrenceRule = CreateDailyRule();
                schedule.ViewMode          = ENScheduleViewMode.Week;
                break;

            case 3:
                appointment.RecurrenceRule = CreateWeeklyRule();
                schedule.ViewMode          = ENScheduleViewMode.Week;
                break;

            case 4:
                appointment.RecurrenceRule = CreateAbsoluteMonthlyRule();
                schedule.ViewMode          = ENScheduleViewMode.Month;
                break;

            case 5:
                appointment.RecurrenceRule = CreateRelativeMonthlyRule();
                schedule.ViewMode          = ENScheduleViewMode.Month;
                break;

            case 6:
                appointment.RecurrenceRule = CreateAbsoluteYearlyRule();
                schedule.ViewMode          = ENScheduleViewMode.Month;
                break;

            case 7:
                appointment.RecurrenceRule = CreateRelativeYearlyRule();
                schedule.ViewMode          = ENScheduleViewMode.Month;
                break;

            case 8:
                appointment.RecurrenceRule = CreateDailyRuleForOneMonth();
                schedule.ViewMode          = ENScheduleViewMode.Month;
                break;

            case 9:
                appointment.RecurrenceRule = CreateDailyRuleForFiveOccurrences();
                schedule.ViewMode          = ENScheduleViewMode.Month;
                break;
            }
        }
        protected override void InitSchedule(NSchedule schedule)
        {
            DateTime today = DateTime.Today;

            // Create a recurring appointment, which occurs every day
            NAppointment         appointment = new NAppointment("Appointment", today.AddHours(12), today.AddHours(14));
            NRecurrenceDailyRule rule        = new NRecurrenceDailyRule();

            rule.StartDate             = new DateTime(2015, 1, 1);
            appointment.RecurrenceRule = rule;

            // Add the recurring appointment to the schedule
            schedule.Appointments.Add(appointment);

            // Change the time of the first appointment in the current week
            NAppointmentBase appChild = appointment.Occurrences[0];

            appChild.Start = appChild.Start.AddHours(-2);
            appChild.End   = appChild.End.AddHours(-2);

            // Change the subject of the second appointment
            appChild         = appointment.Occurrences[1];
            appChild.Subject = "Custom Subject";

            // Change the category of the third appointment
            appChild          = appointment.Occurrences[2];
            appChild.Category = "Red";

            // Delete the fourth appointment
            appointment.Occurrences.RemoveAt(3);
        }
Exemplo n.º 3
0
        protected override void InitSchedule(NSchedule schedule)
        {
            DateTime today     = DateTime.Today;
            DateTime startDate = new DateTime(today.Year, 1, 1);

            // Create an appointment which occurs per 3 hours
            NAppointment          appointment = new NAppointment("Meeting", today, today.AddHours(2));
            NRecurrenceHourlyRule rule        = new NRecurrenceHourlyRule();

            rule.StartDate             = startDate;
            rule.Interval              = 3;
            appointment.RecurrenceRule = rule;
            schedule.Appointments.Add(appointment);

            // Create an appointment which occurs every hour and categorize it
            appointment                = new NAppointment("Talking", today, today.AddHours(0.5));
            rule                       = new NRecurrenceHourlyRule();
            rule.StartDate             = startDate;
            rule.Interval              = 1;
            appointment.RecurrenceRule = rule;
            appointment.Category       = "Red";
            schedule.Appointments.Add(appointment);

            // Swicth schedule to week view mode
            schedule.ViewMode = ENScheduleViewMode.Week;
        }
Exemplo n.º 4
0
        protected override void InitSchedule(NSchedule schedule)
        {
            const string ActivityGroup = "Activity";
            const string Work          = "Work";
            const string Rest          = "Rest";
            const string Travel        = "Travel";

            schedule.ViewMode = ENScheduleViewMode.Day;

            // Add a schedule group
            schedule.Groups.Add(new NScheduleGroup(ActivityGroup, new string[] { Work, Rest, Travel }));

            // Add a grouping to each of the view modes
            schedule.DayViewMode.Groupings.Add(new NGroupGrouping(ActivityGroup));
            schedule.WeekViewMode.Groupings.Add(new NGroupGrouping(ActivityGroup));
            schedule.MonthViewMode.Groupings.Add(new NGroupGrouping(ActivityGroup));
            schedule.TimelineViewMode.Groupings.Add(new NGroupGrouping(ActivityGroup));

            // Create the appointments
            DateTime today = DateTime.Today;

            schedule.Appointments.Add(CreateAppointment("Travel to Work", today.AddHours(6.5), today.AddHours(7.5), Travel));
            schedule.Appointments.Add(CreateAppointment("Meeting with John", today.AddHours(8), today.AddHours(10), Work));
            schedule.Appointments.Add(CreateAppointment("Conference", today.AddHours(10.5), today.AddHours(11.5), Work));
            schedule.Appointments.Add(CreateAppointment("Lunch", today.AddHours(12), today.AddHours(14), Rest));
            schedule.Appointments.Add(CreateAppointment("News Reading", today.AddHours(12.5), today.AddHours(13.5), Rest));
            schedule.Appointments.Add(CreateAppointment("Video Presentation", today.AddHours(14.5), today.AddHours(15.5), Work));
            schedule.Appointments.Add(CreateAppointment("Web Meeting", today.AddHours(16), today.AddHours(17), Work));
            schedule.Appointments.Add(CreateAppointment("Travel back home", today.AddHours(17.5), today.AddHours(19), Travel));
            schedule.Appointments.Add(CreateAppointment("Family Dinner", today.AddHours(20), today.AddHours(21), Rest));
        }
Exemplo n.º 5
0
        private void OnRadioGroupSelectedIndexChanged(NValueChangeEventArgs arg)
        {
            int       selectedIndex = (int)arg.NewValue;
            NSchedule schedule      = m_ScheduleView.Content;

            if (selectedIndex == 0)
            {
                // Time grouping should be first
                if (schedule.DayViewMode.Groupings[0] is NGroupGrouping)
                {
                    SwapGroupings(schedule.DayViewMode);
                    SwapGroupings(schedule.WeekViewMode);
                    SwapGroupings(schedule.MonthViewMode);
                }
            }
            else
            {
                // Schedule group grouping should be first
                if (schedule.DayViewMode.Groupings[0] is NDateRangeGrouping)
                {
                    SwapGroupings(schedule.DayViewMode);
                    SwapGroupings(schedule.WeekViewMode);
                    SwapGroupings(schedule.MonthViewMode);
                }
            }
        }
Exemplo n.º 6
0
        protected override void InitSchedule(NSchedule schedule)
        {
            DateTime today = DateTime.Today;

            NAppointment appointment = new NAppointment("Appoinment", today.AddHours(12), today.AddHours(14));

            appointment.RecurrenceRule = CreateDailyRule();
            schedule.Appointments.Add(appointment);
        }
        protected override void InitSchedule(NSchedule schedule)
        {
            DateTime start = DateTime.Now;

            // Create an appointment
            NAppointment appointment = new NAppointment("Meeting", start, start.AddHours(2));

            schedule.Appointments.Add(appointment);
            schedule.ScrollToTime(start.TimeOfDay);
        }
Exemplo n.º 8
0
        private void OnScheduleViewModeChanged(NValueChangeEventArgs arg)
        {
            m_bViewModeChanging = true;

            NSchedule schedule = m_ScheduleView.Content;

            m_WidthUpDown.Value    = schedule.Width;
            m_HeightUpDown.Value   = schedule.Height;
            m_DurationUpDown.Value = schedule.ActiveViewMode.Duration;

            // Enable the duration numeric up down only when the timeline view mode is selected
            m_DurationUpDown.Enabled = (ENScheduleViewMode)arg.NewValue == ENScheduleViewMode.Timeline;

            m_bViewModeChanging = false;
        }
Exemplo n.º 9
0
        protected override void InitSchedule(NSchedule schedule)
        {
            DateTime today = DateTime.Today;

            schedule.ViewMode = ENScheduleViewMode.Day;

            // The categories of the schedule are stored in its Categories collections and by default are:
            // "Orange", "Red", "Blue", "Green", "Purple" and "Yellow"
            // You can either use these names (case sensitive), or obtain them from the Categories collection of the schedule

            // Create an appointment and associate it with the "Red" category
            NAppointment appointment = new NAppointment("Travel to Work", today.AddHours(6.5), today.AddHours(7.5));

            appointment.Category = "Red";
            schedule.Appointments.Add(appointment);

            // Create an appointment and associate it with the first category of the schedule
            appointment          = new NAppointment("Meeting with John", today.AddHours(8), today.AddHours(10));
            appointment.Category = schedule.Categories[0].Name;
            schedule.Appointments.Add(appointment);

            // Time markers are similar to categories with the diference that they only color the header of an appointment.
            // The time markers of a schedule are stored in its TimeMarkers collection and by default are:
            // "Free", "Tentative", "Busy" and "Out of Office"
            // You can either use these names (case sensitive), or obtain them from the TmieMarkers collection of the schedule

            // Create an appointment and assign the "Busy" time marker to it
            appointment            = new NAppointment("Conference", today.AddHours(10.5), today.AddHours(11.5));
            appointment.TimeMarker = "Busy";
            schedule.Appointments.Add(appointment);

            // Create an appointment and assign the first time marker of the schedule to it
            appointment            = new NAppointment("Lunch", today.AddHours(12), today.AddHours(14));
            appointment.TimeMarker = schedule.TimeMarkers[0].Name;
            schedule.Appointments.Add(appointment);

            // Create an appointment and assign both a category and a time marker to it
            appointment            = new NAppointment("News Reading", today.AddHours(12.5), today.AddHours(13.5));
            appointment.Category   = "Yellow";
            appointment.TimeMarker = "Tentative";
            schedule.Appointments.Add(appointment);

            // Add some more appointments
            schedule.Appointments.Add(new NAppointment("Video Presentation", today.AddHours(14.5), today.AddHours(15.5)));
            schedule.Appointments.Add(new NAppointment("Web Meeting", today.AddHours(16), today.AddHours(17)));
            schedule.Appointments.Add(new NAppointment("Travel back home", today.AddHours(17.5), today.AddHours(19)));
            schedule.Appointments.Add(new NAppointment("Family Dinner", today.AddHours(20), today.AddHours(21)));
        }
Exemplo n.º 10
0
        protected override void InitSchedule(NSchedule schedule)
        {
            DateTime today = DateTime.Today;

            schedule.ViewMode = ENScheduleViewMode.Day;

            schedule.Appointments.Add(new NAppointment("Travel to Work", today.AddHours(6.5), today.AddHours(7.5)));
            schedule.Appointments.Add(new NAppointment("Meeting with John", today.AddHours(8), today.AddHours(10)));
            schedule.Appointments.Add(new NAppointment("Conference", today.AddHours(10.5), today.AddHours(11.5)));
            schedule.Appointments.Add(new NAppointment("Lunch", today.AddHours(12), today.AddHours(14)));
            schedule.Appointments.Add(new NAppointment("News Reading", today.AddHours(12.5), today.AddHours(13.5)));
            schedule.Appointments.Add(new NAppointment("Video Presentation", today.AddHours(14.5), today.AddHours(15.5)));
            schedule.Appointments.Add(new NAppointment("Web Meeting", today.AddHours(16), today.AddHours(17)));
            schedule.Appointments.Add(new NAppointment("Travel back home", today.AddHours(17.5), today.AddHours(19)));
            schedule.Appointments.Add(new NAppointment("Family Dinner", today.AddHours(20), today.AddHours(21)));
        }
            private void OnAppointmentChanged(NEventArgs args)
            {
                NValueChangeEventArgs valueChangeArgs = args as NValueChangeEventArgs;

                if (valueChangeArgs == null)
                {
                    return;
                }

                // If the start or the end time of the appointment has changed, update the barcode
                NProperty property = valueChangeArgs.Property;

                if (property == NAppointmentBase.StartProperty || property == NAppointmentBase.EndProperty)
                {
                    UpdateBarcode();
                    NSchedule schedule = (NSchedule)this.GetFirstAncestor(NSchedule.NScheduleSchema);
                    schedule.ScrollToTime(TimeSpan.FromHours(6));
                }
            }
Exemplo n.º 12
0
        protected override void InitSchedule(NSchedule schedule)
        {
            m_Random = new Random();

            int      totalDays = TotalAppointments / AppointmentsPerDay;
            DateTime date      = DateTime.Today.AddDays(-totalDays / 2);

            // Generate the random appointments
            NAppointmentCollection appointments = schedule.Appointments;

            for (int i = 0; i < totalDays; i++)
            {
                AddRandomAppointments(appointments, date);
                date = date.AddDays(1);
            }

            // Switch the schedule to week view
            schedule.ViewMode = ENScheduleViewMode.Week;
        }
Exemplo n.º 13
0
        protected override NWidget CreateExampleControls()
        {
            NStackPanel stack    = (NStackPanel)base.CreateExampleControls();
            NSchedule   schedule = m_ScheduleView.Content;

            schedule.ViewModeChanged += OnScheduleViewModeChanged;

            // Add the view mode property editor, i.e. a combo box for selecting the schedule's active view mode
            NPropertyEditor propertyEditor = NDesigner.GetDesigner(schedule).CreatePropertyEditor(schedule, NSchedule.ViewModeProperty);

            propertyEditor.Margins = new NMargins(0, NDesign.VerticalSpacing, 0, 0);
            stack.Add(propertyEditor);

            // Add a width numeric up down
            m_WidthUpDown               = new NNumericUpDown();
            m_WidthUpDown.Value         = schedule.Width;
            m_WidthUpDown.Minimum       = 100;
            m_WidthUpDown.Step          = 10;
            m_WidthUpDown.ValueChanged += OnWidthUpDownValueChanged;
            stack.Add(NPairBox.Create("Width", m_WidthUpDown));

            // Add a height numeric up down
            m_HeightUpDown               = new NNumericUpDown();
            m_HeightUpDown.Value         = schedule.Height;
            m_HeightUpDown.Minimum       = 100;
            m_HeightUpDown.Step          = 10;
            m_HeightUpDown.ValueChanged += OnHeightUpDownValueChanged;
            stack.Add(NPairBox.Create("Height", m_HeightUpDown));

            // Add a duration numeric up down
            m_DurationUpDown               = new NNumericUpDown();
            m_DurationUpDown.Value         = schedule.ActiveViewMode.Duration;
            m_DurationUpDown.Minimum       = 1;
            m_DurationUpDown.Enabled       = false;
            m_DurationUpDown.ValueChanged += OnDurationUpDownValueChanged;

            NPairBox pairBox = new NPairBox(m_DurationUpDown, "days");

            pairBox.Spacing = NDesign.HorizontalSpacing;
            stack.Add(NPairBox.Create("Duration", pairBox));

            return(new NUniSizeBoxGroup(stack));
        }
            /// <summary>
            /// Creates a custom appointment edit dialog.
            /// </summary>
            /// <returns></returns>
            public override NTopLevelWindow CreateEditDialog()
            {
                NSchedule schedule = (NSchedule)GetFirstAncestor(NSchedule.NScheduleSchema);
                NWindow   window   = schedule != null ? schedule.OwnerWindow : null;

                // Create a dialog window
                NTopLevelWindow dialog = NApplication.CreateTopLevelWindow(NWindow.GetFocusedWindowIfNull(window));

                dialog.SetupDialogWindow("Appointment with Image Editor", true);

                NStackPanel stack = new NStackPanel();

                stack.FillMode = ENStackFillMode.Last;
                stack.FitMode  = ENStackFitMode.Last;

                // Add an image box with the image
                NImageBox imageBox = new NImageBox((NImage)NSystem.SafeDeepClone(Image));

                stack.Add(imageBox);

                // Add property editors for some of the appointment properties
                NDesigner designer = NDesigner.GetDesigner(this);
                NList <NPropertyEditor> editors = designer.CreatePropertyEditors(this,
                                                                                 SubjectProperty,
                                                                                 StartProperty,
                                                                                 EndProperty);

                for (int i = 0; i < editors.Count; i++)
                {
                    stack.Add(editors[i]);
                }

                // Add a button strip with OK and Cancel buttons
                NButtonStrip buttonStrip = new NButtonStrip();

                buttonStrip.InitOKCancelButtonStrip();
                stack.Add(buttonStrip);

                dialog.Content = new NUniSizeBoxGroup(stack);

                return(dialog);
            }
Exemplo n.º 15
0
        protected override void InitSchedule(NSchedule schedule)
        {
            // Rename the first predefined time marker
            schedule.TimeMarkers[0].Name = NLoc.Get("Renamed Time Marker");

            // Create and add some custom time markers
            NTimeMarker timeMarker1 = new NTimeMarker(NLoc.Get("Custom Time Marker 1"), NColor.Khaki);

            schedule.TimeMarkers.Add(timeMarker1);

            NTimeMarker timeMarker2 = new NTimeMarker(NLoc.Get("Custom Time Marker 2"), new NHatchFill(ENHatchStyle.DiagonalBrick, NColor.Red, NColor.Orange));

            schedule.TimeMarkers.Add(timeMarker2);

            // Remove the second time marker
            schedule.TimeMarkers.RemoveAt(1);

            // Remove the time marker called "Busy"
            NTimeMarker timeMarkerToRemove = schedule.TimeMarkers.FindByName(NLoc.Get("Busy"));

            if (timeMarkerToRemove != null)
            {
                schedule.TimeMarkers.Remove(timeMarkerToRemove);
            }

            // Create and add some appointments
            DateTime start = DateTime.Now;

            NAppointment appointment1 = new NAppointment("Meeting 1", start, start.AddHours(2));

            appointment1.TimeMarker = timeMarker1.Name;
            schedule.Appointments.Add(appointment1);

            NAppointment appointment2 = new NAppointment("Meeting 2", appointment1.End.AddHours(0.5), appointment1.End.AddHours(2.5));

            appointment2.TimeMarker = timeMarker2.Name;
            schedule.Appointments.Add(appointment2);

            // Scroll the schedule to the start of the first appointment
            schedule.ScrollToTime(start.TimeOfDay);
        }
Exemplo n.º 16
0
        protected override void InitSchedule(NSchedule schedule)
        {
            // Rename the first predefined category
            schedule.Categories[0].Name = NLoc.Get("Renamed Category");

            // Create and add some custom categories
            NCategory category1 = new NCategory(NLoc.Get("Custom Category 1"), NColor.Khaki);

            schedule.Categories.Add(category1);

            NCategory category2 = new NCategory(NLoc.Get("Custom Category 2"), new NHatchFill(ENHatchStyle.DiagonalBrick, NColor.Red, NColor.Orange));

            schedule.Categories.Add(category2);

            // Remove the second category
            schedule.Categories.RemoveAt(1);

            // Remove the category called "Green"
            NCategory categoryToRemove = schedule.Categories.FindByName(NLoc.Get("Green"));

            if (categoryToRemove != null)
            {
                schedule.Categories.Remove(categoryToRemove);
            }

            // Create and add some appointments
            DateTime start = DateTime.Now;

            NAppointment appointment1 = new NAppointment("Meeting 1", start, start.AddHours(2));

            appointment1.Category = category1.Name;
            schedule.Appointments.Add(appointment1);

            NAppointment appointment2 = new NAppointment("Meeting 2", appointment1.End.AddHours(0.5), appointment1.End.AddHours(2.5));

            appointment2.Category = category2.Name;
            schedule.Appointments.Add(appointment2);

            // Scroll the schedule to the start of the first appointment
            schedule.ScrollToTime(start.TimeOfDay);
        }
        protected override void InitSchedule(NSchedule schedule)
        {
            DateTime start = DateTime.Now;

            // Replace the default Add Appointment command action with a custom one
            NCommandAction addAppointmentCommandAction = m_ScheduleView.Commander.GetCommandAction(NScheduleView.AddAppointmentCommand);

            m_ScheduleView.Commander.Remove(addAppointmentCommandAction);
            m_ScheduleView.Commander.Add(new CustomAddAppointmentCommandAction());

            // Replace the default Appointment Edit tool with a custom one
            NTool appointmentEditTool = m_ScheduleView.Interactor.GetTool(NAppointmentEditTool.NAppointmentEditToolSchema);
            int   index = m_ScheduleView.Interactor.IndexOf(appointmentEditTool);

            m_ScheduleView.Interactor.RemoveAt(index);

            NTool customEditAppointmentTool = new CustomAppointmentEditTool();

            customEditAppointmentTool.Enabled = true;
            m_ScheduleView.Interactor.Insert(index, customEditAppointmentTool);

            // Create some custom appointments
            AppointmentWithLocation appointmentWithLocation = new AppointmentWithLocation(
                "Appointment with Location", start, start.AddHours(2));

            appointmentWithLocation.Location = "New York";
            schedule.Appointments.Add(appointmentWithLocation);

            AppointmentWithImage appointmentWithImage = new AppointmentWithImage(
                "Appointment with Image", start.AddHours(3), start.AddHours(5));

            appointmentWithImage.Image    = NResources.Image_MobileComputers_UMPC_jpg;
            appointmentWithImage.Category = NLoc.Get("Orange");
            schedule.Appointments.Add(appointmentWithImage);

            schedule.ScrollToTime(start.TimeOfDay);
        }
Exemplo n.º 18
0
        protected override void InitSchedule(NSchedule schedule)
        {
            schedule.ViewMode = ENScheduleViewMode.Day;

            // Create an old appointment
            DateTime     oldStart       = DateTime.Now.AddHours(-3);
            NAppointment oldAppointment = new NAppointment("Old Meeting", oldStart, oldStart.AddHours(2));

            oldAppointment.Notification = TimeSpan.Zero;
            schedule.Appointments.Add(oldAppointment);

            // Create an appointment and assign a notification 10 minutes before its start
            DateTime     newStart       = DateTime.Now.AddMinutes(10);
            NAppointment newAppointment = new NAppointment("New Meeting", newStart, newStart.AddHours(2));

            newAppointment.Notification = TimeSpan.FromMinutes(10);
            schedule.Appointments.Add(newAppointment);

            // Scroll the schedule to the current hour
            schedule.ScrollToTime(TimeSpan.FromHours(Math.Floor((double)oldStart.Hour)));

            // Configure the schedule view to check for pending notifications every 60 seconds
            m_ScheduleView.NotificationCheckInterval = 60;
        }
Exemplo n.º 19
0
 protected abstract void InitSchedule(NSchedule schedule);