2.1.4 BeginSession


Description

The BeginSession method reserves the current Origin session for exclusive use. It has no meaning in the case of multi-instance Origin automation objects (Origin.Application,), in which case, any connection creates a separate Origin session.

After a client calls BeginSession no other clients will be able to connect to Origin until the client that called BeginSession calls EndSession. This allows a client to perform its tasks to completion without interference from other clients. This behavior is only available with Origin Pro. The BeginSession and EndSession methods have no affect on non-Pro Origin.

Syntax

VB: Function BeginSession As Boolean
C++: bool BeginSession
C#: bool BeginSession
Python: def BeginSession(self)

Return

Remark

Examples

VBA

Dim oApp As Origin.ApplicationSI
Dim bb As Boolean
Set oApp = GetObject("", "Origin.ApplicationSI")
bb = BeginSession()
'other commands
bb = EndSession()

C#

private Origin.ApplicationSI originApp;
try
{
    originApp = new Origin.ApplicationSIClass();
}
catch (Exception ex1)
{
    return;
}

bool bSessionStarted = false;
try
{
    bSessionStarted = originApp.BeginSession();
}
catch (Exception ex2)
{
}

if (bSessionStarted)
{
    // perform tasks

    originApp.EndSession();
    bSessionStarted = false;
}

originApp = null;

Python

import OriginExt as O
app = O.ApplicationSI(); app.Visible = app.MAINWND_SHOW
if app.BeginSession():
    app.EndSession()

Version Information

8.0SR2

See Also

EndSession