Example #1
0
 private static void SendCompletedCallback(object sender, AsyncCompletedEventArgs e)
 {
     try
     {
         if (e.Cancelled)
         {
             Console.WriteLine("发送已取消!");
             Environment.Exit(0);
         }
         if (e.Error != null)
         {
             Console.WriteLine("邮件发送失败!" + "\n" + "技术信息:\n" + e.ToString());
             Environment.Exit(0);
         }
         else
         {
             Console.WriteLine("邮件成功发出!");
             Environment.Exit(0);
         }
     }
     catch (Exception Ex)
     {
         Console.WriteLine("邮件发送失败!" + "\n" + "技术信息:\n" + Ex.Message);
     }
 }
 private void SendCompleted(object sender, AsyncCompletedEventArgs args)
 {
     if (!args.Cancelled && args.Error == null)
     {
         _handler.Invoke(args.UserState.ToString());
         Console.WriteLine(args.ToString());
     }
 }
Example #3
0
        void deployment_UpdateCompleted(object sender, AsyncCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                Debug.WriteLine(e.ToString());
                return;
            }
            MainWindow w = this.windows[0];

            w.UpdateAvailableLabel.Visibility = Visibility.Hidden;
        }
Example #4
0
 void sendcomplete(object sender, AsyncCompletedEventArgs e)
 {
     if (e.Error != null)
     {
         MessageBox.Show("Attachment are greater then 3MB" + e.ToString());
     }
     else
     {
         MessageBox.Show("Mail Send");
     }
 }
Example #5
0
 private void downloadFileCompletedPatch(object sender, AsyncCompletedEventArgs e)
 {
     if (e.Error == null && !e.Cancelled)
     {
         this.extractFiles();
     }
     else
     {
         int num = (int)MessageBox.Show(e.ToString() + " " + e.Error?.ToString(), "An error occurred!", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         this.updateProgressBar.Value = 0;
         this.updateButton.Enabled    = true;
         this.updateButton.Text       = "Update";
         this.launchButton.Enabled    = true;
     }
 }
 private void Completed(object sender, AsyncCompletedEventArgs e)
 {
     lock (_lockingObject)
     {
         var  url   = (DownloadItem)e.UserState;
         bool error = false;
         if (e.Cancelled)
         {
             url.DownloadAborted = true;//Progress = "download cancelled";
             error = true;
             lock (_urlsToDownload)
                 _urlsToDownload.AddFirst(url);
         }
         else if (e.Error != null)
         {
             url.OtherError = true;
             url.Error      = "Error: " + e.ToString();
             error          = true;
         }
         if (error)
         {
             string tempFileLocation = GetFullTempLocation(url.FileName);
             FileOperations.Enqueue(new FileWorkerArgs()
             {
                 action          = "removeTemp",
                 orginalLocation = tempFileLocation
             });
         }
         else
         {
             string tempFileLocation = GetFullTempLocation(url.FileName);
             string fileLocation     = GetFullLocation(url.FileName);
             FileOperations.Enqueue(new FileWorkerArgs()
             {
                 action          = "moveTemp",
                 orginalLocation = tempFileLocation,
                 desiredLocation = fileLocation
             });
         }
         downloadCheck[url.WebClient.ClientId].Reset();
         Clients.Enqueue(url.WebClient);
     }
 }
Example #7
0
 private void smtpClient_SendCompleted(object sender, AsyncCompletedEventArgs e)
 {
     try
     {
         if (e.Cancelled)
         {
             result = "发送已取消!";
         }
         if (e.Error != null)
         {
             result = "邮件发送失败!" + "\n" + "技术信息:\n" + e.ToString();
         }
         else
         {
             result = "邮件成功发出!";
         }
     }
     catch (Exception Ex)
     {
         result = "邮件发送失败!" + "\n" + "技术信息:\n" + Ex.Message;
     }
 }
Example #8
0
 private static void SendCompletedCallback(object sender, AsyncCompletedEventArgs e)
 {
     try
     {
         if (e.Cancelled)
         {
             MessageBoxHelper.Show("发送已取消!");
         }
         if (e.Error != null)
         {
             MessageBoxHelper.Show("邮件发送失败!" + "\n" + "技术信息:\n" + e.ToString());
         }
         else
         {
             MessageBoxHelper.Show("邮件成功发出!");
         }
     }
     catch (Exception Ex)
     {
         MessageBoxHelper.Show("邮件发送失败!" + "\n" + "技术信息:\n" + Ex.Message);
     }
 }
 private static void SendCompletedCallback(object sender, AsyncCompletedEventArgs e)
 {
     try
     {
         if (e.Cancelled)
         {
             MessageBox.Show("发送已取消!");
         }
         if (e.Error != null)
         {
             MessageBox.Show("邮件发送失败!" + "\n" + "技术信息:\n" + e.ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             MessageBox.Show("邮件成功发出!", "恭喜!", MessageBoxButtons.OK, MessageBoxIcon.Information);
         }
     }
     catch (Exception Ex)
     {
         MessageBox.Show("邮件发送失败!" + "\n" + "技术信息:\n" + Ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #10
0
 public void client_SendCompleted(object sender, AsyncCompletedEventArgs e)
 {
     try
     {
         if (e.Cancelled)
         {
             log.WriteLog(LogLevel.Warn, "发送已取消!");
         }
         if (e.Error != null)
         {
             log.WriteLog(LogLevel.Error, "邮件发送失败!" + "\n" + "技术信息:\n" + e.ToString() + "错误");
         }
         else
         {
             log.WriteLog(LogLevel.Info, "邮件成功发出! 恭喜!");
         }
     }
     catch (Exception Ex)
     {
         log.WriteLog(LogLevel.Fatal, "邮件发送失败!" + "\n" + "技术信息:\n" + Ex.Message + "致命的错误");
         throw new Exception("邮件发送失败!" + "\n" + "技术信息:\n" + Ex.Message + "致命的错误");
     }
 }
Example #11
0
 private void ProcessDownloadComplete(DownloadItem item, AsyncCompletedEventArgs e)
 {
     item.IProc.Error = ex => {
         this.Invoke((Delegate)(Action)(() => {
             lvDownloads.Items.Remove(item.LVI);
             Sys.Message(new WMessage()
             {
                 Text = "Error " + item.LVI.Text + ": " + e.ToString()
             });
         }));
     };
     item.IProc.Complete       = () => CompleteIProc(item, e);
     item.LVI.SubItems[2].Text = "Installing";
     item.PCComplete           = 0;
     item.IProc.SetPCComplete  = i => {
         if (item.PCComplete != i)
         {
             item.PCComplete = i;
             this.Invoke((Delegate)(Action)lvDownloads.Invalidate);
         }
     };
     item.IProc.Schedule();
 }
Example #12
0
        void smtp_SendCompleted(object sender, AsyncCompletedEventArgs e)
        {
            if (e.Cancelled)
            {
                // MessageBox.Show("Sending of Email Cancelled.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                //Mark in the monthly transaction file whether or not the email was successful
                //File.AppendAllText("Transactions/Monthly/" + DateTime.Now.Month + ".csv", "Email Cancelled\r\n", Encoding.Unicode);

                KeyCabinetKiosk.Program.logEvent("email cancelled " + e.ToString());
                //If the previous server IP did not work, use the next one. Try up to five different IPs if there are that many
                if (EmailTryCounter < EmailTryCount)
                {
                    EmailTryCounter++;
                    MailClient.Host = SmtpServerIP.AddressList.GetValue(EmailTryCounter % SmtpServerIP.AddressList.Length).ToString();
                    MailClient.SendAsync(Message, "Email Try" + EmailTryCounter);
                }
            }
            if (e.Error != null)
            {
                KeyCabinetKiosk.Program.logEvent("email -response " + e.Error.Message.ToString());
                //MessageBox.Show("Process Error: " + e.Error.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                //If the previous server IP did not work, use the next one. Try up to five different IPs if there are that many
                if (EmailTryCounter < EmailTryCount)
                {
                    EmailTryCounter++;
                    MailClient.Host = SmtpServerIP.AddressList.GetValue(EmailTryCounter % SmtpServerIP.AddressList.Length).ToString();
                    MailClient.SendAsync(Message, "Email Try" + EmailTryCounter);
                }
            }
            else
            {
                KeyCabinetKiosk.Program.logEvent("email - sucess ");
                //MessageBox.Show("Email Success", "Success", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            clearAttachments();
        }
Example #13
0
 void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
 {
     System.Media.SystemSounds.Asterisk.Play();
     listBoxLog.Items.Add(e.ToString() + "\n Finished");
 }
Example #14
0
        private void DownloadFileCallback2(Object sender, AsyncCompletedEventArgs e)
        {
            string reply = e.ToString();

            Log.Debug("Device CGI returned info: " + reply);
        }