private void ClearGlobalClient() { if (globalClient != null) { globalClient.Logout(); if (globalClient.IsConnected) { globalClient.Disconnect(); } globalClient.Dispose(); globalClient = null; } }