Пример #1
0
        private async void GetDriver()
        {
            try
            {
                pictureBox2.Image = ScannedFingerPrint;

                UserFunctions uf = new UserFunctions();

                label2.Text = "Scanning...";

                int y = await uf.GetDriver(new Imc().ToBase64String(new Imc().ToByteArr(ScannedFingerPrint)));

                if (y == 0)
                {
                    pictureBox1.Image = Properties.Resources.fingerdumbwrong;
                    label2.Text       = "Failed to find Driver";
                }
                else
                {
                    UserID = y;

                    // System.Diagnostics.Debug.WriteLine("Current Gate: "+h.CurrentGate.ToString());
                    try
                    {
                        if (h.CurrentGate == GateSide.Entrance)
                        {
                            pictureBox1.Image = Properties.Resources.fingerdumbcorrect;
                            label2.Text       = "Success";

                            this.Close();

                            MessageBox.Show(h, String.Format("{0} Car has Entered Parking", h.DetectedLicenseNumber));
                        }
                        else
                        {
                            bool result = await uf.ExitParking(23, h.CarID, UserID);

                            if (result)
                            {
                                pictureBox1.Image = Properties.Resources.fingerdumbcorrect;
                                label2.Text       = "Success";

                                this.Close();

                                MessageBox.Show(h, String.Format("{0} Car has Exited Parking", h.DetectedLicenseNumber));
                            }
                            else
                            {
                                pictureBox1.Image = Properties.Resources.fingerdumbwrong;
                                label2.Text       = "Failed to find Driver";
                            }
                        }
                    }
                    catch
                    {
                    }
                }
            }
            catch
            {
            }
        }