You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 14 Next »

The root page TOOLS:Tutorial could not be found in space Delta Shell.


1. Add a new folder to the project named "ObjectProperties"

2. Create a new class named "VolumeModelProperties"

3. Add the following contents to this class:

using System.ComponentModel;
using DelftTools.Shell.Gui;
using DeltaShell.Plugin.DemoApp.Models;

namespace DeltaShell.Plugin.DemoApp.ObjectProperties
{
    [DisplayName("Volume model parameters")]
    public class VolumeModelProperties : ObjectProperties<VolumeModel>
    {
        [Category("General")]
        [DisplayName("Name")]
        [Description("Name of this volume model")]
        public string Name
        {
            get { return data.Name; }
        }

        [Category("Input")]
        [DisplayName("Number of catchments")]
        [Description("Number of catchments in basin")]
        public int NumberOfCatchments
        {
            get { return data.Basin.Catchments.Count; }
        }

        [Category("Input")]
        [DisplayName("Number of time steps")]
        [Description("Number of time steps in precipitation time series")]
        public int PrecipitationTimeSteps
        {
            get { return data.Precipitation.Time.Values.Count; }
        }
    }
}

4. Register the object properties in the gui plugin class by adding the following code to DemoAppGuiPlugin:

        public override IEnumerable<PropertyInfo> GetPropertyInfos()
        {
            yield return new PropertyInfo<VolumeModel, VolumeModelProperties>();
        }

5. Run the application, create a volume model, click the volume model item in the Project Explorer and ensure the newly create object properties are visible in the property grid Image


  • No labels