void _BackgroundWorker_DoWork(object sender, DoWorkEventArgs e) { try { while (isSending) { Thread.Sleep(10); if (!IsSuspending) { _OnQueueChanged(queue.Count); if (queue.Count > 0) { HISLISItem item = queue.Dequeue() as HISLISItem; item._OnAction += new HISLISItem.OnAction(item__OnAction); item._OnDoing += new HISLISItem.OnDoing(item__OnDoing); item.DoSend(); while (item.isSending) { Application.DoEvents(); } } } } } catch { } }
public void AddItems2Queue(HISLISItem _newItem) { try { if (!isSending) StartUp(); queue.Enqueue(_newItem); } catch { } }
public void AddItems2Queue(HISLISItem _newItem) { try { if (!isSending) { StartUp(); } queue.Enqueue(_newItem); } catch { } }
private void cmdPush2Lab_Click(object sender, EventArgs e) { try { if (cmdPush2Lab.Tag.ToString() == "0") { cmdPush2Lab.Text = "Dừng đẩy"; cmdPush2Lab.Tag = "1"; progressImport.Value = 0; progressImport.Maximum = grdData.GetCheckedRows().Count(); foreach (GridEXRow row in grdData.GetCheckedRows()) { string ma_chidinh = Utility.sDbnull(row.Cells["assign_code"].Value, "Unknown"); long assign_id = Utility.Int32Dbnull(row.Cells["assign_id"].Value, -1); int AssignDetail_Status = Utility.Int32Dbnull(row.Cells["AssignDetail_Status"].Value, 0); string patient_code = Utility.sDbnull(row.Cells["patient_code"].Value, "Unknown"); if (AssignDetail_Status == 0 && ma_chidinh != "" && patient_code != "" && assign_id != -1) { var _HISLISItem = new HISLISItem(ma_chidinh, (int) assign_id, patient_code, log); _HISLISManager.AddItems2Queue(_HISLISItem); } if (progressImport.Value + 1 <= progressImport.Maximum) progressImport.Value += 1; } } else { cmdPush2Lab.Text = "Đẩy vào Lab"; cmdPush2Lab.Tag = "0"; _HISLISManager.Stop(); } } catch { } }