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 }
void scheduler_AppointmentViewInfoCustomizing(object sender, DevExpress.Xpf.Scheduler.AppointmentViewInfoCustomizingEventArgs e) { AppointmentViewInfo viewInfo = e.ViewInfo; if (chkCustomText.IsChecked.GetValueOrDefault()) { UpdateText(viewInfo); } CustomAppointmentData data = new CustomAppointmentData(); data.Filtered = false; data.ShowImages = chkCustomImage.IsChecked.GetValueOrDefault(); viewInfo.CustomViewInfo = data; if (!IsEmptyFilter(cbSearch.Text)) { string searchText = cbSearch.Text.ToUpper(); if (IsAppointmentFiltered(searchText, e.ViewInfo.Appointment)) { data.Filtered = true; } } if (!data.Filtered) { IAppointmentLabel label = this.scheduler.Storage.AppointmentStorage.Labels.CreateNewLabel(string.Empty); label.SetColor(Colors.LightGray); viewInfo.Label = label; IAppointmentStatus status = this.scheduler.Storage.AppointmentStorage.Statuses.CreateNewStatus(string.Empty, string.Empty); status.Type = AppointmentStatusType.Custom; status.SetBrush(new SolidColorBrush(Colors.LightGray)); viewInfo.Status = status; } }
private static IAppointmentStatus CreateNewAppointmentStatus(IAppointmentStatusStorage storage, AppointmentStatusType type, Color color, string name, string caption) { IAppointmentStatus status = storage.CreateNewStatus(null, name, caption); status.Type = type; status.SetBrush(new SolidColorBrush(color)); return(status); }
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 }
void InitializeLabelsAndStutuses() { Labels = new AppointmentLabelCollection(); int count = IssueList.Length; for (int i = 0; i < count; i++) { AppointmentLabel label = Labels.CreateNewLabel(i, IssueList[i]); label.SetColor(IssueColorList[i]); Labels.Add(label); } Statuses = new AppointmentStatusCollection(); count = PaymentStatuses.Length; for (int i = 0; i < count; i++) { IAppointmentStatus status = Statuses.CreateNewStatus(PaymentStatuses[i], string.Empty); status.Type = AppointmentStatusType.Custom; status.SetBrush(new SolidColorBrush(PaymentColorStatuses[i])); Statuses.Add(status); } }