private void AddToListBox(LicensePlateModel licensePlate)
        {
            //if (MemoryDictionaryHelper.Count() > 0 &&
            //    MemoryDictionaryHelper.LastIndex < MemoryDictionaryHelper.AddedLastIndex)
            //{
            //    var itmBox = new ListBoxItem();
            //    itmBox.Content = MemoryDictionaryHelper.GetLatLicensePlate().LicensePlate;

            //    if (!LicensePlateList.Items.Contains(itmBox))
            //    {
            //        LicensePlateList.Items.Add(itmBox);
            //        MemoryDictionaryHelper.LastIndex = MemoryDictionaryHelper.AddedLastIndex;
            //    }
            //}

            licensePlate.LicensePlate = CleaningLicensePlate.Cleaning(licensePlate.LicensePlate);
            var user = _userManagement.GetUser(licensePlate.LicensePlate);

            if (user != null)
            {
                LicensePlateList.Items.Add(UserHelper.ConverToLicensePlateUserModel(user));
            }
            else
            {
                user = new UserModel
                {
                    LicensePlate = licensePlate.LicensePlate
                };

                LicensePlateList.Items.Add(UserHelper.ConverToLicensePlateUserModel(user));
            }

            TaskScheduler.FromCurrentSynchronizationContext();
        }
        private LicensePlateModel ProcessImage(IInputOutputArray image)
        {
            List <IInputOutputArray> licensePlateImagesList         = new List <IInputOutputArray>();
            List <IInputOutputArray> filteredLicensePlateImagesList = new List <IInputOutputArray>();
            List <RotatedRect>       licenseBoxList = new List <RotatedRect>();
            List <string>            plates         = _licensePlateDetectorInVideo.DetectLicensePlate(
                image,
                licensePlateImagesList,
                filteredLicensePlateImagesList,
                licenseBoxList);

            LicensePlateModel licensePlateModel = new LicensePlateModel();

            foreach (var plate in plates)
            {
                Debug.WriteLine($"Sosurce string: {plate}");
                var cleanPlate = CleaningLicensePlate.Cleaning(plate);
                if (cleanPlate != null)
                {
                    Debug.WriteLine($"Definit string: {plate}");

                    licensePlateModel.LicensePlate = cleanPlate;
                    licensePlateModel.CountFindItemLicensePlate = plates.Count;

                    return(licensePlateModel);
                }
            }

            return(null);
        }
        private void FindButton_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Title  = "Select a picture";
            openFileDialog.Filter = "All supported graphics|*.jpg;*.jpeg;*.png|" +
                                    "JPEG (*.jpg;*.jpeg)|*.jpg;*.jpeg|" +
                                    "Portable Network Graphic (*.png)|*.png";
            if (openFileDialog.ShowDialog() == true)
            {
                FileNameTextBox.Text = openFileDialog.FileName;
                CarImage.Source      = new BitmapImage(new Uri(openFileDialog.FileName));
            }

            if (!string.IsNullOrEmpty(openFileDialog.FileName))
            {
                LicensePlateModel licensePlate = GetLicensePlate(openFileDialog.FileName);

                if (!string.IsNullOrEmpty(licensePlate.LicensePlate))
                {
                    Dispatcher.Invoke((Action)(() =>
                    {
                        licensePlate.LicensePlate = CleaningLicensePlate.Cleaning(licensePlate.LicensePlate);
                        var user = _userManagement.GetUser(licensePlate.LicensePlate);

                        if (user != null)
                        {
                            InfoNumberListBox.Items.Add(UserHelper.ConverToLicensePlateUserModel(user));
                        }
                        else
                        {
                            user = new UserModel
                            {
                                LicensePlate = licensePlate.LicensePlate
                            };

                            InfoNumberListBox.Items.Add(UserHelper.ConverToLicensePlateUserModel(user));
                        }

                        TimaLabel.Content = licensePlate.Timer;
                        GuantityPlateLable.Content = licensePlate.GuantityPlateResult;

                        CarImage.Source = licensePlate.Image;
                        ImageOriginal.Source = licensePlate.ImageLicensePlate;

                        MemoryDictionaryHelper.AddLicensePlate(licensePlate);
                    }));
                }
            }
        }