Click or drag to resize

BasicNoUIObjDisconnect Method

Disconnects the language extensions.

Namespace: WinWrap.Basic.Server
Assembly: WinWrap.Basic.Server (in WinWrap.Basic.Server.dll)
Syntax
public bool Disconnect()

Return Value

Boolean
True if successfully disconnected.

Implements

IBasicNoUIDisconnect
Remarks
Use this method to insure proper release of all resources. If Disconnect returns True, WinWrap Basic is no longer functional.
Example
Close the containing form safely:
private void Form1_FormClosing(object sender, System.ComponentModel.FormClosingEventArgs e)
{
    // prevent form closing until WinWrap Basic has exited all nested execution
    // prevent form closing if user cancels the request
    switch (basicIdeCtl1.Shutdown())
    {
        case -1: // Basic engine execution is nested.
            timer1.Enabled = true;
            e.Cancel = true;
            break;
        case 0:
            break;
        case 1: // cancelled by user
            e.Cancel = true;
            break;
    }
}

private void Form1_FormClosed(object sender, System.ComponentModel.FormClosedEventArgs e)
{
    // disconnect and release all COM objects used by WinWrap Basic
    bool okay = basicIdeCtl1.Disconnect();
    Debug.Assert(okay, "Disconnect must return true.");
}

private void timer1_Tick(object sender, System.EventArgs e)
{
    // poll the idectl until InEvent returns False
    // only then is it okay to close the form containing the idectl
    if (!basicIdeCtl1.InEvent)
    {
        timer1.Enabled = false;
        Close();
    }
}
See Also