private async void SyncEntranceOperations(object sender, EventArgs e) { if (EntranceGateOpened) { tm1.Stop(); CloseGate(GateSide.Entrance); } else { LicenseBitmap = (Bitmap)FeedBox.Image; if (LicenseBitmap == null) { DetectedLicense.Text = "NULL"; } else { DetectedLicense.Text = "LOADING"; pictureBox1.Image = FeedBox.Image; OCR ocr = new OCR(); DetectedLicense.Text = ocr.GetLicense(Get24bppRgb(LicenseBitmap)); if (!DetectedLicense.Text.Equals("INVALID")) { DetectedLicenseNumber = DetectedLicense.Text; tm1.Stop(); ufunctions = new UserFunctions(); UserFunctions uf = new UserFunctions(); int y = await uf.RegisterCar(DetectedLicense.Text); CarID = y; Enroller en = new Enroller(this); en.ShowDialog(); bool t = await ufunctions.GetParking(23, y, en.UserID); ProcessTicket(23, y); } } } }
private void GetLicense(Bitmap bm) { Task T = Task.Run(() => { OCR ocr = new OCR(); if (DetectedLicense.InvokeRequired) { DetectedLicense.Invoke(new MethodInvoker(delegate { DetectedLicense.Text = ocr.GetLicense(bm); })); } }); }
private async void SyncExitOperations(object sender, EventArgs e) { if (ExitGateOpened) { tm2.Stop(); CloseGate(GateSide.Exit); } else { LicenseBitmap = (Bitmap)FeedBox.Image; if (LicenseBitmap == null) { DetectedLicense.Text = "NULL"; } else { DetectedLicense.Text = "LOADING"; pictureBox1.Image = FeedBox.Image; OCR ocr = new OCR(); DetectedLicense.Text = ocr.GetLicense(Get24bppRgb(LicenseBitmap)); if (!DetectedLicense.Text.Equals("INVALID")) { DetectedLicenseNumber = DetectedLicense.Text; tm2.Stop(); ufunctions = new UserFunctions(); UserFunctions uf = new UserFunctions(); int y = await uf.RegisterCar(DetectedLicense.Text); CarID = y; Enroller en = new Enroller(this); en.ShowDialog(); } } //Capture Image from here and process it } }