Exemplo n.º 1
0
 void m_instance_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     jm.Dispose();
     if (client != null && client.IsConnected)
     {
         UnSubscribeClientFromEvents();
         client.Disconnect();
         client.Dispose();
         client = null;
     }
 }
Exemplo n.º 2
0
 private void UnSubscribeClientFromEvents()
 {
     if (client == null) client = Client.Instance;
     client.Connected -= OnConnected;
     client.ConnectFailed -= OnConnectFailed;
     client.Disconnected -= OnDisconnected;
     client.ServerDisconnected -= OnServerDisconnected;
     client.CommandReceived -= OnCommandReceived;
 }