private static void OnShutdown(object sender, EventArgs e) { if (FSBL != null) { lock (lockObj) { // Disable log timer timer.Stop(); if (FSBL != null) { try { // Dispose of Finsemble. FSBL.Dispose(); } catch { } finally { FSBL = null; } } } } // Release main thread so application can exit. autoEvent.Set(); }
static void Main(string[] args) { #if DEBUG System.Diagnostics.Debugger.Launch(); #endif FSBL = new Finsemble.Core.Finsemble(args, null); FSBL.Connected += OnConnected; FSBL.Disconnected += OnShutdown; FSBL.Connect("WindowlessExample.Core", JWK); // Block main thread until worker is finished. autoEvent.WaitOne(); }