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

Compare with Current View Page History

« Previous Version 27 Next »

Contents

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

Exercise outline

The goal of this exercise is to visualize some information about created volume models in the Properties window.

Create a new object properties class

Add a new folder to the plugin project named ObjectProperties. In this folder, create a new class named VolumeModelObjectProperties.cs and add the following code:

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

namespace DeltaShell.Plugin.DemoApp.ObjectProperties
{
    [DisplayName("Volume model information")]
    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 the basin")]
        public int NumberOfCatchments
        {
            get { return data.Basin.Catchments.Count; }
        }

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

The object properties class derives the ObjectProperties base class so that it can be registered in the gui plugin (see the next step).

The [DisplayName], [Category] and [Description] aspects are used for categorizing and decorating the object properties (see the results of the exercise).

Register the object properties in the gui plugin class

Register the object properties in the gui plugin by adding the following code to VolumeModelGuiPlugin.cs:


and


Delta Shell should now be able to find matching object properties after selecting a volume model in the Project window.

Exercise results

  • No labels