Exemple #1
0
 private async void sendButton_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(request.Text))
     {
         await Task.Run(() =>
         {
             lock (comm)
             {
                 try
                 {
                     comm.GetProtocol().ExecAndReceiveMultiple(request.Text);
                 }
                 catch (Exception ex)
                 {
                     ErrorLog.LogError(ex);
                     MessageBox.Show(ex.Message);
                 }
                 finally
                 {
                     System.Threading.Thread.Sleep(2000);
                     comm.ReleaseProtocol();
                 }
             }
         });
     }
 }