protected override NAppointmentBase CreateAppointmentForGridCell(NScheduleGridCell gridCell) { AppointmentWithImage appointment = new AppointmentWithImage(null, gridCell.StartTime, gridCell.EndTime); appointment.Image = NResources.Image_Artistic_Plane_png; return(appointment); }
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); }