private void UserBeginButton_Click(object sender, RoutedEventArgs e)
        {
            DB.RemoveGenerics();
            DB.RemoveIncomplete();
            if (UserBeginButton.Content.ToString() == "Potwierdź")
            {
                DisplayFrame.Content    = null;
                UserBeginButton.Content = "Zaloguj lub Zarejestruj";
            }
            else if (DB.CheckCredentials(Login_UserName.Text.ToString(), Login_Password.Text.ToString()) == 0)
            {
                Car newCar = new Car(Login_UserName.Text.ToString(), Login_Password.Text.ToString());
                newCar.SaveToDb(DB);

                UserBeginButton.Content = "Potwierdź";
                DisplayFrame.Content    = new CarCreationFrame();
            }
            else
            {
                Car newCar = new Car();
                newCar = DB.ReturnByCredentials(Login_UserName.Text.ToString(), Login_Password.Text.ToString());
                DB.RemoveByPlate(newCar.PlateNumber);
                newCar.SaveToDb(DB);


                UserPanel Usrpnl = new UserPanel();
                Usrpnl.Show();
                this.Close();
            }
        }
        private void Choose_Click(object sender, RoutedEventArgs e)
        {
            int    SenderIndex = int.Parse((sender as Button).Name.Substring((sender as Button).Name.IndexOf("_") + 1));
            string Plate       = "";

            foreach (Grid Grid in _Standard.Children)
            {
                int GridIndex = int.Parse(Grid.Name.Substring(Grid.Name.IndexOf("_") + 1));
                if (GridIndex == SenderIndex)
                {
                    foreach (Control Control in Grid.Children)
                    {
                        if (Control is TextBox)
                        {
                            if (Control.Name == $"PlateNumber_{GridIndex}")
                            {
                                Plate = (Control as TextBox).Text;
                            }
                        }
                    }
                }
            }

            Car newCar = new Car();

            newCar = DB.ReturnByPlateNumber(Plate);
            DB.RemoveByPlate(Plate);
            newCar.SaveToDb(DB);
            DB.RemoveGenerics();

            Window Reset = new UserPanel();

            Reset.Show();
            Window.GetWindow(this).Close();
        }
        private void BeginButton_Click(object sender, RoutedEventArgs e)
        {
            DB.RemoveGenerics();
            DB.RemoveIncomplete();
            if (BeginButton.Content.ToString() == "Potwierdź")
            {
                DisplayFrame.Content = null;
                BeginButton.Content  = "Rozpocznij";
            }
            else if (DB.CheckPlateCredential(S1Plate.Text, S1Password.Text) == 0)
            {
                Car newCar = new Car(S1Plate.Text, S1Password.Text, 0);
                newCar.SaveToDb(DB);

                BeginButton.Content  = "Potwierdź";
                DisplayFrame.Content = new CarCreationFrame();
            }
            else
            {
                Car newCar = new Car();
                newCar = DB.ReturnByPlateNumber(S1Plate.Text);
                DB.RemoveByPlate(S1Plate.Text);
                newCar.SaveToDb(DB);


                UserPanel Usrpnl = new UserPanel();
                Usrpnl.Show();
                this.Close();
            }
        }