Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The goal of this exercise is to add a Ribbon button for volume models . As a result, it should be possible to configure which helps configuring the input data of volume models in just a couple of clicksa faster way, automatically generating dialogs that prompt the users to select the input files required for a volume model.

Create a new

...

GUI command

Add a new folder named Commands to the plugin project. Inside this folder, create a new class named AddInputDataToVolumeModelCommand.cs and adapt the contents as shown below.

...

Now, add a new folder named Ribbon to the plugin project. Inside this folder, create a new WPF user control named VolumeModelRibbon.xaml and adapt the contents (in the designer) as shown below:

...

Register the Ribbon control in the gui GUI plugin by adding the following code to VolumeModelGuiPlugin.cs:

Code Block
languagec#
using DelftTools.Shell.Gui.Forms;
using DeltaShell.Plugins.VolumeModel.Ribbon;

...



Then create a new volume model item (right click on project | Add | New Model ...), click the volume Ribbon button and, sequentially, select the previously downloaded WaterML2 XML file and shape files in the file selection dialogs.
Afterwards, . Notice that the just created button can only be used when the the volume model is selected in the Project panel. If you select any other item, like the project, or any element inside the volume model, the button will be disabled. Select the added volume model, and then click the volume Ribbon button. In the file selection dialogs that will be automatically prompted, select, sequentially, the previously downloaded precipitation (WaterML2 XML) and basin (shape) files. The model will be fully configured and ready to be run. You can verify that the input data has been correctly added to the volume model by opening the data views or by running the model:

...