static void CustomLabelsAndStatusesAction(SchedulerControl scheduler) { #region #CustomLabelsAndStatuses scheduler.DataStorage.Appointments.Clear(); string[] IssueList = { "Consultation", "Treatment", "X-Ray" }; Color[] IssueColorList = { Color.Ivory, Color.Pink, Color.Plum }; string[] PaymentStatuses = { "Paid", "Unpaid" }; Color[] PaymentColorStatuses = { Color.Green, Color.Red }; IAppointmentLabelStorage labelStorage = scheduler.DataStorage.Appointments.Labels; labelStorage.Clear(); int count = IssueList.Length; for (int i = 0; i < count; i++) { IAppointmentLabel label = labelStorage.CreateNewLabel(i, IssueList[i]); label.SetColor(IssueColorList[i]); labelStorage.Add(label); } IAppointmentStatusStorage statuses = scheduler.DataStorage.Appointments.Statuses; statuses.Clear(); count = PaymentStatuses.Length; for (int i = 0; i < count; i++) { IAppointmentStatus status = statuses.CreateNewStatus(i, PaymentStatuses[i], PaymentStatuses[i]); status.SetBrush(new SolidBrush(PaymentColorStatuses[i])); statuses.Add(status); } #endregion #CustomLabelsAndStatuses }
static void InitCustomAppointmentStatuses(SchedulerStorage storage) { storage.BeginUpdate(); try { IAppointmentStatusStorage statuses = storage.AppointmentStorage.Statuses; statuses.Clear(); statuses.Add(CreateNewAppointmentStatus(statuses, AppointmentStatusType.Free, Colors.White, "Free", "Free")); statuses.Add(CreateNewAppointmentStatus(statuses, AppointmentStatusType.Custom, Colors.SkyBlue, "Wash", "Wash")); statuses.Add(CreateNewAppointmentStatus(statuses, AppointmentStatusType.Custom, Colors.SteelBlue, "Maintenance", "Maintenance")); statuses.Add(CreateNewAppointmentStatus(statuses, AppointmentStatusType.Custom, Colors.YellowGreen, "Rent", "Rent")); statuses.Add(CreateNewAppointmentStatus(statuses, AppointmentStatusType.Custom, Colors.Coral, "CheckUp", "CheckUp")); } finally { storage.EndUpdate(); } }
static void CustomLabelsAndStatusesAction(SchedulerControl scheduler) { #region #CustomLabelsAndStatuses scheduler.Storage.AppointmentStorage.Clear(); string[] IssueList = { "Consultation", "Treatment", "X-Ray" }; Color[] IssueColorList = { Colors.Ivory, Colors.Pink, Colors.Plum }; string[] PaymentStatuses = { "Paid", "Unpaid" }; Color[] PaymentColorStatuses = { Colors.Green, Colors.Red }; IAppointmentLabelStorage labelStorage = scheduler.Storage.AppointmentStorage.Labels; labelStorage.Clear(); int count = IssueList.Length; for (int i = 0; i < count; i++) { IAppointmentLabel label = labelStorage.CreateNewLabel(i, IssueList[i]); label.SetColor(IssueColorList[i]); labelStorage.Add(label); } IAppointmentStatusStorage statusStorage = scheduler.Storage.AppointmentStorage.Statuses; statusStorage.Clear(); count = PaymentStatuses.Length; for (int i = 0; i < count; i++) { IAppointmentStatus status = statusStorage.CreateNewStatus(i, PaymentStatuses[i], PaymentStatuses[i]); status.SetBrush(new SolidColorBrush(PaymentColorStatuses[i])); statusStorage.Add(status); } // Create a new appointment. Appointment apt = scheduler.Storage.CreateAppointment(AppointmentType.Normal); apt.Subject = "Test"; apt.Start = DateTime.Now; apt.End = DateTime.Now.AddHours(2); apt.ResourceId = scheduler.Storage.ResourceStorage[0].Id; apt.LabelKey = labelStorage.GetByIndex(2).Id; scheduler.Storage.AppointmentStorage.Add(apt); #endregion #CustomLabelsAndStatuses }