Wednesday, 15 May 2013

c# - how to implement while loop for processing when clicking -


I hope you can help me with this problem. When I click on an email button, before successfully sending it, it takes a few seconds to process. I need to insert the process image but how to implement it with the "while" loop for processing.
Here is the code: I think I should apply with the customer. Send (msg); for processing. how does it work? I appreciate your example code thanks! (I am using C # and WPF)

  Private Zero BtnSendEmailClick (Object Sender, RoutedEventArgs e) {SmtpClient Client = Zero; Mail message msg = null; {Msg = new mailmessage {{try new mailorder ("me@hotmail.com", "Me Hotmail")}; Msg.To.Add (txtEmailAddress.Text); message. Priority = Mail Preference High; Msg.subject = "Blow Blah"; Msg.Body = "& lt ;; DOCTYPE html> gt; html lang = 'n' xmlns = 'http: //www.w3.org/1999/xhtml'>" + "& Lt; head> gt; & lt; / head & gt;" + "& Lt; body & gt;" + "& Lt; h3> messages & lt; / h3 & gt;" + "& Lt; p & gt;" + LblEmailMessage.Content + "& lt; / p & gt;" + "& Lt; / body & gt;" + "& Lt; / html & gt;"; Msg.IsBodyHtml = True; Client = New SmtpClient {host = "smtp.live.com", port = 25, EnableSsl = true, UseDefaultCredentials = false, credentials = new network credentials ("me@hotmail.com", "password"), DeliveryMethod = SmtpDeliveryMethod. Network}; // How to implement when looping for the processing client Send (msg); LblMessage.Content = "Your mail has been successfully sent!"; } Hold (Exception pre) {lblMessage.Content = ex.Message; }}    

You will need to return immediately, and BackgroundWorker Once it's finished to send an email, you can use the Dispatcher to notify the GUI. For more information, see.

Also see.

No comments:

Post a Comment