I am writing a very basic InSim program, connecting to a local LFS client. I am polling the connection periodically, by calling insim.Initialize() if IsConnected is false, to connect when the LFS client is started, which works fine. When LFS is closed however, the next attempt to connect finds my InSim object to have Disposed of itself, and an exception is thrown.
Questions:
Is catching the ObjectDisposed event the correct way to handle this?
Is it ok to just create a new instance at that point & continue with that?
Will all my event binds be ok bound to the new instance? The old instance still appears to exist, even though it 'isDisposed' and still appears to be bound to all my event handlers.
Is there a better way I could handle it, say on the Disconnected event, and somehow keep my existing InSim object alive?
Questions:
Is catching the ObjectDisposed event the correct way to handle this?
Is it ok to just create a new instance at that point & continue with that?
Will all my event binds be ok bound to the new instance? The old instance still appears to exist, even though it 'isDisposed' and still appears to be bound to all my event handlers.
Is there a better way I could handle it, say on the Disconnected event, and somehow keep my existing InSim object alive?