private void OnDisconnect(object sender, SmppEventArgs ea) { // Assure we are on the UI thread if (InvokeRequired) { BeginInvoke((OnDisconnectHandler)OnDisconnect, sender, ea); return; } AddLogText(StatusCode.Session, string.Format("Connection from {0} dropped.", ea.Session.IPAddress.ToString())); SessionListViewItem lvi = (SessionListViewItem)ea.Session.Tag; if (lvi != null) { lvi.Remove(); } // Turn off the generate if no sessions. if (server_.CurrentSessions.Count == 1) { btnGenerateSms.Enabled = false; } SmppDisconnectEventArgs dea = (SmppDisconnectEventArgs)ea; if (dea.Exception != null) { AddLogText(StatusCode.Error, dea.Exception.ToString()); } }
private void OnSessionDisconnected(object sender, SmppEventArgs args) { SmppDisconnectEventArgs dea = (SmppDisconnectEventArgs)args; if (dea.Exception != null) { MessageBox.Show("Socket error: " + ((dea.Exception.Message != null) ? dea.Exception.Message : dea.Exception.ToString())); } else { MessageBox.Show("Smsc Session/Connection was dropped"); } SetSmscConnectionStatus(SmscConnectionStatus.Disconnected); }