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); }
private void UpdateBarcode() { NAppointmentBase appointment = this.Appointment; if (appointment == null) { return; } // Serialize the appointment to string NIcalFormat format = new NIcalFormat(); string text = format.SerializeAppointment(appointment, false); // Update the text of the matrix barcode widget NMatrixBarcode barcode = (NMatrixBarcode)GetFirstDescendant(NMatrixBarcode.NMatrixBarcodeSchema); barcode.Text = text; }