private void timer_Tick(object sender, EventArgs e) { string qrdecode = ""; if (BitImage is null) { return; } Bitmap bit = BitmapImageToBitmap(BitImage); BarcodeReader Reader = new BarcodeReader(); Result qrResult = Reader.Decode(bit); try { qrdecode = qrResult?.Text.Trim(); } catch (Exception ex) { qrdecode = "error"; } QRString = qrdecode; if (!string.IsNullOrEmpty(qrdecode)) { CloseQRDialog(); if (_ActionCode == 1) { AddToBorrow(QRString); } else { CTPTS t = MyList.FirstOrDefault(x => x.MACTS.ToString() == QRString); if (t is null) { this.eventAggregator.PublishOnCurrentThread(new Models.Message("Thông báo", "Không tìm thấy")); return; } ReturnBookBill.Add(t); MyList.Remove(t); SumMoney += t.TIENPHAT ?? 0; } } }
public void Add(CTPTS t) { ReturnBookBill.Add(t); MyList.Remove(t); SumMoney += t.TIENPHAT ?? 0; }