コード例 #1
0
        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);
        }
コード例 #2
0
            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));
                }
            }
コード例 #3
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);
        }
コード例 #4
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);
        }
コード例 #5
0
        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);
        }
コード例 #6
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;
        }