Micro Focus Content Manager SDK 10.1
TRIM.SDK.WgsProgressNotifier Class Reference

The WgsProgressNotifier class provides a mechanism for SDK applications to receive progress updates while the SDK is communicating with a workgroup server. It also allows SDK applications to cancel ongoing operations. More...

Inheritance diagram for TRIM.SDK.WgsProgressNotifier:
TRIM.SDK.WgsProgressNotifierBase

Public Member Functions

 WgsProgressNotifier (Database db)
 
delegate void OnWgsProgressEventHandler (WgsProgressInfo wgsProgressInfo)
 
- Public Member Functions inherited from TRIM.SDK.WgsProgressNotifierBase
void Dispose ()
 
 WgsProgressNotifierBase (Database db)
 
delegate void SwigDelegateWgsProgressNotifierBase_0 (global::System.IntPtr args)
 

Events

OnWgsProgressEventHandler OnWgsProgress
 

Detailed Description

The WgsProgressNotifier class provides a mechanism for SDK applications to receive progress updates while the SDK is communicating with a workgroup server. It also allows SDK applications to cancel ongoing operations.

When a WgsProgressNotifier is constructed, it is associated with a Database instance, and when the Database instance is interacting with a workgroup server, WgsProgressNotifier will periodically call a user-specified event (WgsProgressNotifier.OnWgsProgress), with information about the currently executing operation (see the WgsProgressInfo class).

It is possible for the application to cancel ongoing workgroup server operations, by setting WgsProgressInfo.ShouldCancel to true.

The following is a simple example of how to use WgsProgressNotifier.

private void Notifier_OnWgsProgress(WgsProgressInfo progressInfo)
{
    if (progressInfo.WgsMethod != "")
    {
        System.Console.WriteLine("Calling WGS method: " + progressInfo.WgsMethod);
        System.Console.WriteLine("Elapsed time for current operation (ms): " + progressInfo.WgsMethodElapsedMs);
    }

    if (progressInfo.IsDownloadingFile || progressInfo.IsUploadingFile)
    {
        string msg = String.Format(
            "Transferring {0} bytes. Percentage transferred so far: {1}", 
            progressInfo.FileTransferTotalSize, 
            progressInfo.FileTransferPerCentCompleted);

        System.Console.WriteLine(msg);
    }

    // Cancel any operation that takes more than a minute.
    if (progressInfo.WgsMethodElapsedMs > 60*1000)
    {
        progressInfo.ShouldCancel = true;
    }
}

using (WgsProgressNotifier notifier = new WgsProgressNotifier(db))
{
    notifier.OnWgsProgress += Notifier_OnWgsProgress;

    Record rec = new Record(db, "Some Record");
    string downloadTo = "C:\\Some Record.doc";
    rec.GetDocument(downloadTo, false, "", "");
}

Constructor & Destructor Documentation

◆ WgsProgressNotifier()

TRIM.SDK.WgsProgressNotifier.WgsProgressNotifier ( Database  db)

Member Function Documentation

◆ OnWgsProgressEventHandler()

delegate void TRIM.SDK.WgsProgressNotifier.OnWgsProgressEventHandler ( WgsProgressInfo  wgsProgressInfo)

Event Documentation

◆ OnWgsProgress

OnWgsProgressEventHandler TRIM.SDK.WgsProgressNotifier.OnWgsProgress