private void OnSessionTerminate(object sender, SessionTerminatedEventArgs e) { connected = false; // Dispose of our connection, and set it to null ThinClient.Dispose(); ThinClient = null; }
private void onSessionTerminated(object sender, SessionTerminatedEventArgs e) { //Disconnect(); status = NetworkStatus.Disconnected; client = null; voiceClient = null; // add the new message to the message list NetworkMessage message = new NetworkMessage(0, (byte)ReservedMessageType.HostDisconnected, null); lock (networkMessages) { networkMessages.Enqueue(message); } }
private void SessionTerminated(object sender, SessionTerminatedEventArgs dpMessage) { // This session is being terminated, let the user know if (dpMessage.Message.ResultCode == ResultCode.HostTerminatedSession) { MessageBox.Show("The Host has terminated this session. This sample will now exit.", "Exiting", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("The session has been lost. This sample will now exit.", "Exiting", MessageBoxButtons.OK, MessageBoxIcon.Information); } // This will post a message on the main thread to shut down our form parent.BeginInvoke(new PeerCloseCallback(parent.PeerClose)); }
private void SessionLost(object sender, SessionTerminatedEventArgs e) { if (e.Message.TerminateData.Length != 0) // We've received terminate session data. { MessageType msg = (MessageType)e.Message.TerminateData.Read(typeof(MessageType)); object[] logOffParams = { msg }; this.BeginInvoke(new ServerExitCallback(this.ServerExit), logOffParams); } else { object[] discParams = { MessageType.AddFriend }; // Doesn't really matter, just disconnect // We need to inform the user of the disconnection. We will call BeginInvoke as to not // block this thread this.BeginInvoke(new ServerExitCallback(this.ServerExit), discParams); } }
/// <summary> /// Handler for incoming DirectPlay SessionTerminated events /// </summary> public void SessionTerminatedHandler(object sender, SessionTerminatedEventArgs args) { MessageBox.Show(m_Form, "Connect lost or host terminated session", "DirectPlay Tutorial"); m_Connection = ConnectionType.Disconnected; UpdateUI(); }
private void SessionTerminated(object sender, SessionTerminatedEventArgs stea) { inSession = false; isHost = false; }
private void SessionTerminated(object sender, SessionTerminatedEventArgs dpMessage) { // This session is being terminated, let the user know if (dpMessage.Message.ResultCode == ResultCode.HostTerminatedSession) MessageBox.Show("The Host has terminated this session. This sample will now exit.", "Exiting", MessageBoxButtons.OK, MessageBoxIcon.Information); else MessageBox.Show("The session has been lost. This sample will now exit.", "Exiting", MessageBoxButtons.OK, MessageBoxIcon.Information); // This will post a message on the main thread to shut down our form parent.BeginInvoke(new PeerCloseCallback(parent.PeerClose)); }