In This Topic
Tutorials / Server Side Events in DocuVieware

Server Side Events in DocuVieware

In This Topic

There are three different events server side for DocuVieware™. All of them are accessible through the dedicated DocuViewareEventsHandler class.

As advised in the tutorials, the first DocuVieware™ calls you should have in your applications are to set up the configuration and register your license key.
Event subscription should be done subsequently, for instance like this:

Setting up the configuration and registering.
Copy Code
DocuViewareManager.SetupConfiguration(true, DocuViewareSessionStateMode.InProc, "\\Cache");
DocuViewareLicensing.RegisterKEY("XXXX"); //Unlocking DocuVieware
DocuViewareEventsHandler.NewDocumentLoaded += NewDocumentLoadedHandler;

This will make the NewDocumentLoadedHandler function to be run when a new document is loaded. The same applies for other events too, but with different arguments.

Keeping the same event subscription for this tutorial, we want to change the PagePreload property depending on how many pages the loaded document has.
We want to preload every page if the document is less than 20 pages long but only adjacent pages if the document is bigger. In order to do that, we can simply use the following code:

Changing the PagePreload property.
Copy Code
private static void NewDocumentLoadedHandler(object sender, NewDocumentLoadedEventArgs e)
    e.docuVieware.PagePreload = e.docuVieware.PageCount <= 20 ? PagePreloadMode.AllPages : PagePreloadMode.AdjacentPages;

Every event arguments object contains (possibly with other elements) the corresponding DocuVieware™ object.
This allows to do everything you might need to the control and/or the document it contains (if any).
This is noticeably demonstrated in the Barcode Recognition demo (and tutorial) so it is strongly recommended to take a closer look at it.

See Also