How to create a dialog

In the Site Manager there are two options for you to start with when creating a dialog:

Create the dialog from scratch

For a dialog to be a legal Site Manager dialog it needs to inherit from the dialog base:

public partial class SampleDialog : LSOne.ViewCore.Dialogs.DialogBase

Copy another dialog

The faster way to create a dialog is to copy another dialog from the Site Manager and modify it to fit your needs. The best dialog for you to copy will probably be a dialog that is similar in functionality to the dialog that you need.

In our sample plugin, HelloWorld, we have dialogs that are rather simple and are very convenient to copy. However if your dialog is very different from those and you need a dialog similar to another Site Manager dialog it might be better to simply copy that dialog.

Functions overview

A list of commonly used functions when creating a dialog:

Base functions

Description

void CheckEnabled(object sender, EventArgs e)

Here we check if the requirements are met for the OK button to be enabled.

void btnOK_Click(object sender, EventArgs e)

When we press OK, the data in the business objects is altered and you save the instance of the business object to the database.

void btnCancel_Click

Closes a dialog and no data is changed.

protected override IApplicationCallbacks OnGetFramework()

Needs to return the Site Manager framework instance. This instance is usually kept in the: PluginEntry.Framework.

Dialog Sample Code

Below we can see examples of each basic function of a dialog.

 

Now you should exercise in creating a dialog in the second exercise: Lesson 5 - Plugins: views, tabs and dialogs