Contents
Exercise outline
The goal of this exercise is to visualize some information about created volume models in the Properties window.
Fixme
[TODO] Fixme
Fixme
[TODO] Fixme
Exercise results
[TODO] Description of the exercise results
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