예제 #1
0
        private void Disconnect()
        {
            if (disconnecting)
            {
                return;
            }

            disconnecting = true;
            Logger.Info("Disconnect called");

            // Clean up clients that require disposing
            try
            {
                if (logger != null)
                {
                    logger.Dispose();
                }
            }
            catch
            { }
            finally
            {
                logger = null;
            }

            try
            {
                if (LauncherClient != null)
                {
                    LauncherClient.Dispose();
                }
            }
            catch
            { }
            finally
            {
                LauncherClient = null;
            }

            try
            {
                if (RouterClient != null)
                {
                    RouterClient.Transmit("Finsemble.Assimilation.closed." + this.windowName, true);
                    RouterClient.Dispose();
                }
            }
            catch { }
            finally { }

            // Close appropriate connection


            if (socket != null)
            {
                socket.Close();
                socket = null;
            }

            // Notify listeners bridge is disconnected from OpenFin
            Disconnected?.Invoke(this, EventArgs.Empty);
        }