How to create a simple view

There are three options for you to begin.

Create the view from scratch

The only thing that your view needs to do to be a legal Site Manager view is to inherit from the base Site Manager view:

public partial class SimpleView : LSOne.ViewCore.ViewBase

You will then have to overwrite key methods from the base class to get your functionality ready. To get an idea of which functions to overload, see the functions overview below.

Copy Simple view from the Hello World plugin

You can copy almost any view from the Site Manager and customize it based on your needs. To make this process simpler we have created view templates with minimal functionality included. You can find a template view for a simple view in the Hello World plugin from the Site Manager part of the development package. The view is called SimpleView and you can copy it into your plugin. The view contains a shell for the basic functionality of a simple view.

Functions overview

Base functions

This is a list of functions that are most commonly overwritten to add logic to your view:

Base functions

Description

void LoadData(

 bool isRevert)

Here we load the data for our view. This involves fetching the data object and populating the view. The isRevert variable is false unless the user pressed the Revert button above the Context bar. That function is supposed to revert to the last saved state of the view (basically reverting all changes that have not yet been saved).

bool DataIsModified()

In this function you determine if the view needs to be saved or not. Here you check to see if any of your data has been changed, and if it has this function should return true and then the SaveData() function will automatically be called.

bool SaveData()

 

Here you save the data in your view. Please note that you NEVER call this function yourself, the Site Manager framework handles calling it at appropriate times.

void OnDelete()

 

Occurs when the user presses the Delete button above the Context bar on the view.

RecordIdentifier ID

 

Returns the ID of the view and is used to determine if the view is already visible and does not need to be reloaded. Usually you return the ID of the object you are working with, or if you have a list view you return RecordIdentifier.Empty

string LogicalContextName

 

Returns the string that should appear directly above the Context bar.

void GetAuditDescriptors(

List<AuditDescriptor> contexts)

 

Connects the view with an audit view. See chapter Auditing for more details.

Sample code walkthrough