using System; using System.IO; using System.Threading; using System.Windows.Forms; namespace ATModem { public partial class frmMain : Form { public AutoResetEvent receiveNow = new AutoResetEvent(false); Queue<string> q = new Queue<string>(); public frmMain() { InitializeComponent(); objclsSMS.incoming += objclsSMS_incoming; } void objclsSMS_incoming(string response) { log_events("Incoming Event: " + response); q.Enqueue(response); receiveNow.Set(); } private void test_Click(object sender, EventArgs e) { receiveNow.Reset(); test.Enabled = false; test.Text = "Waiting..."; if (receiveNow.WaitOne(5000)){ while (q.Count != 0) { try{ MessageBox.Show(q.Dequeue()); } catch (Exception ex){ MessageBox.Show("Error: \n" + ex.Message); } } }else{ MessageBox.Show("Request Timed out"); } } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)