namespace CSMsystem { public partial class adminwelcome : Page { private string[] ports; ............... ............... .............. private readonly BackgroundWorker worker = new BackgroundWorker(); public adminwelcome() { InitializeComponent(); loaduserbut(); worker.DoWork += sendingSMS; worker.RunWorkerCompleted += smsCompleted; } public void loaduserbut() { loadPorts(); .......... .......... .............. if (status == "thankYou") { worker.RunWorkerAsync(); ........... ........... ........... } else if (status == "comments") { .............. ............... ............ } else if (status == "final") { ..................... ................ } } ................... ...................... ...................... .................... //Loading ports private void loadPorts() { ports = new string[3]; ports = SerialPort.GetPortNames(); } //sendSMS private void sendingSMS(object sender, DoWorkEventArgs e) { SmsClass sm = new SmsClass(ports[0]); try { foreach (MobileDtl_Base mobBase in adminwelcome.mobilNumList) { sm.Opens(); //sendSMS(mobBase.MobileNo.ToString()); sm.sendSms("0" + mobBase.MobileNo.ToString(), "There is a feedback from a customer :" + custName + ", R.O.NUM :" + roNum); sm.Closes(); System.Threading.Thread.Sleep(1000); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } // private void smsCompleted(object sender, RunWorkerCompletedEventArgs e) { MessageBox.Show("Messages are sent !!"); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)