Ejemplo n.º 1
0
 private bool StartConnection()
 {
     if (!IsSmtpRunning)
     {
         ButtonSendMessage.Enabled = false;
         Service = new SmtpService();
         Service.PushNewConfig(SmtpConfig);
         Service.OnConnectionOpened   += OnSmtpConnectionEstablished;
         Service.OnConnectionClosed   += OnSmtpConnectionClosed;
         Service.OnLineSentOrReceived += ParseDebugMessage;
         try { Service.RequestStartService(); return(true); }
         catch (Exception E)
         {
             ButtonSendMessage.Enabled = true;
             MessageBox.Show("Could not connect to the server. Reason: " + E.ToString());
         }
     }
     else
     {
         throw new Exception("connection_exists");
     }
     return(false);
 }
Ejemplo n.º 2
0
 //on goodbye handshake
 private void OnCleanShutdown()
 {
     Service.RequestStopService();
     Service = null;
 }