Back to Devexpress

SchedulerDataStorage.Statuses Property

windowsforms-devexpress-dot-xtrascheduler-dot-schedulerdatastorage-970d2fe2.md

latest4.4 KB
Original Source

SchedulerDataStorage.Statuses Property

Gets a storage object that contains appointment statuses.

Namespace : DevExpress.XtraScheduler

Assembly : DevExpress.XtraScheduler.v25.2.dll

NuGet Package : DevExpress.Win.Scheduler

Declaration

csharp
public AppointmentStatusDataStorage Statuses { get; }
vb
Public ReadOnly Property Statuses As AppointmentStatusDataStorage

Property Value

TypeDescription
AppointmentStatusDataStorage

A AppointmentStatusDataStorage object that stores appointment statuses.

|

Remarks

The following code snippet implements the AddCustomLabelsAndStatuses method that adds custom appointment labels and statuses.

csharp
using DevExpress.XtraScheduler;

public Form1() {
    InitializeComponent();
    AddCustomLabelsAndStatuses(schedulerControl);
}

void AddCustomLabelsAndStatuses(SchedulerControl schedulerControl) {
    // Define custom label metadata.
    var issues = new Dictionary<string, Color> {
        { "Consultation", Color.Ivory },
        { "Treatment", Color.Pink },
        { "X-Ray", Color.Plum }
    };

    // Define custom status metadata.
    var paymentStatuses = new Dictionary<string, Color> {
        { "Paid", Color.Green },
        { "Unpaid", Color.Red }
    };

    // Add custom appointment labels.
    IAppointmentLabelStorage labelStorage = schedulerControl.DataStorage.Appointments.Labels;
    foreach (var issue in issues) {
        IAppointmentLabel label = labelStorage.CreateNewLabel(labelStorage.Count, issue.Key);
        label.SetColor(issue.Value);
        labelStorage.Add(label);
    }

    // Add custom appointment statuses.
    IAppointmentStatusStorage statusStorage = schedulerControl.DataStorage.Appointments.Statuses;
    foreach (var status in paymentStatuses) {
        IAppointmentStatus appStatus = statusStorage.CreateNewStatus(statusStorage.Count, status.Key, status.Key);
        appStatus.SetBrush(new SolidBrush(status.Value));
        statusStorage.Add(appStatus);
    }
}
vb
Imports DevExpress.XtraScheduler
Imports System.Drawing

Public Class Form1
    Public Sub New()
        InitializeComponent()
        AddCustomLabelsAndStatuses(schedulerControl)
    End Sub

    Private Sub AddCustomLabelsAndStatuses(schedulerControl As SchedulerControl)
        ' Define custom label metadata.
        Dim issues As New Dictionary(Of String, Color) From {
            {"Consultation", Color.Ivory},
            {"Treatment", Color.Pink},
            {"X-Ray", Color.Plum}
        }

        ' Define custom status metadata.
        Dim paymentStatuses As New Dictionary(Of String, Color) From {
            {"Paid", Color.Green},
            {"Unpaid", Color.Red}
        }

        ' Add custom appointment labels.
        Dim labelStorage As IAppointmentLabelStorage = schedulerControl.DataStorage.Appointments.Labels
        For Each issue In issues
            Dim label As IAppointmentLabel = labelStorage.CreateNewLabel(labelStorage.Count, issue.Key)
            label.SetColor(issue.Value)
            labelStorage.Add(label)
        Next

        ' Add custom appointment statuses.
        Dim statusStorage As IAppointmentStatusStorage = schedulerControl.DataStorage.Appointments.Statuses
        For Each status In paymentStatuses
            Dim appStatus As IAppointmentStatus = statusStorage.CreateNewStatus(statusStorage.Count, status.Key, status.Key)
            appStatus.SetBrush(New SolidBrush(status.Value))
            statusStorage.Add(appStatus)
        Next
    End Sub
End Class

See Also

SchedulerDataStorage Class

SchedulerDataStorage Members

DevExpress.XtraScheduler Namespace