I'm coding an application in C# with the JForex API imported using IKVM. I've noticed that once my code connects using this kind of thing:
private void btnConnect_Click( object sender, EventArgs e )
{
Client = ClientFactory.getDefaultInstance();
slDukascopy = new SystemListener( Client, JForexString, UsernameString, PasswordString );
Client.setSystemListener( slDukascopy );
AttemptLogin(); // first login attempt always fails (timeout issue of some sort?)
btnConnect.Enabled = false;
btnLogin.Enabled = true;
btnDisconnect.Enabled = true;
}
It does not matter what I do, but I cannot get the JForex client to disconnect / unload -- it remains running in the background, passing traffic back and forth to the Dukascopy side, no matter what I do. (The only thing that works to unload the client is Environment.Exit( 0 ); which is a little too drastic...)
I've tried things like:
private void btnLogout_Click( object sender, EventArgs e )
{
Client.connect( null, null, null );
btnLogin.Enabled = true;
btnLogout.Enabled = false;
btnDisconnect.Enabled = true;
}
and:
private void btnDisconnect_Click( object sender, EventArgs e )
{
Client.setSystemListener( null );
slDukascopy = null;
Client = null;
btnConnect.Enabled = true;
btnLogin.Enabled = false;
btnDisconnect.Enabled = false;
}
but nothing I do is effective to drop the client communication except dumping the environment itself. I'm wondering if anyone has any ideas or knows how to reset the JForex client in code?
thx! t.