Scheduler for WPF | ComponentOne
Appointments / Resources
In This Topic
    Resources
    In This Topic

    A resource is a keyword or a phrase that defines a source of support for a particular task. Resources, which are stored in the ResourceCollection class, are optional and an appointment can have one or more resources assigned to it.

    Add Resources to the Resources List

    Scheduler supports resources created at run time through the Resources dialog box and programmatically as well. Once added to the list, the resource can be assigned to an appointment.

    The new resource appears in the Resources dialog box when the Resources button is clicked in the Appointment dialog box:

    Resources Dialog in WPF Scheduler

    To add a resource at run time:

    1. Add a new or open an existing appointment.
    2. Click the Resources button in the Appointment dialog box. The Resources dialog box appears.
    3. Enter a resource in the Available text box and click Add. The new resource is added to the list.
    4. Click Ok to close the Resources dialog box.

    To add resources programmatically, use the following code:

    C#
    Copy Code
    ObservableCollection<string> resources = new ObservableCollection<string>();
    private void Add_Resources(object sender, RoutedEventArgs e)
    {
        resources.Add("Venue");
        resources.Add("Speakers");
        resources.Add("Document");
        resources.Add("Event");
        resources.Add("Presentation");
        resources.Add("Mentor");
        resources.Add("Idea");
        resources.Add("Budgeting");
        resources.Add("Fund Raising");
        resources.Add("Feedback");
    
        foreach (string resource in resources)
        {
            Resource res = new Resource();
            res.MenuCaption = resource;
            if (!sched1.DataStorage.ResourceStorage.Resources.Any(x => x.MenuCaption == resource))
                sched1.DataStorage.ResourceStorage.Resources.Add(res);
        }
    }