public LoginWindow()
        {
            InitializeComponent();

            Items.loginWindow = this;

            Items.InitializeItems();
            Client.InitializeItems();
            FinalRent.InitializeDialog();

            Client.Server.InitializeConnection();

            UiOperation.SetPage(UIPage.Main);
            this.Closing += new System.ComponentModel.CancelEventHandler(OnMainWindow_Closing);
        }
        private void onCancelRent(object sender, RoutedEventArgs e)
        {
            Vehicle Vehicle;
            int     Days = (DateTime.Now - Client.Vehicle.FinalDate).Days;

            if (Days < 1)
            {
                int CheckDays = (Client.Vehicle.FinalDate - DateTime.Now).Days;

                if (CheckDays > 0)
                {
                    float price = Client.Vehicle.Price * CheckDays;

                    if (FinalRent.Show(Client.Vehicle, out Vehicle) == DialogResult.Ok)
                    {
                        Client.Vehicle       = Vehicle;
                        Client.User.Balance += CheckDays * Client.Vehicle.Price;

                        Client.Server.ConnectProvider.log_RemoveRent(Client.User.Id, Client.Vehicle.RentLogId, DateTime.Now, price, 0);

                        Client.Vehicle.ClientId  = 0;
                        Client.Vehicle.RentLogId = 0;

                        Client.Server.ConnectProvider.SaveUser(Client.User);
                        Client.Server.ConnectProvider.saveVehicle(Client.Vehicle);

                        Client.Vehicle.VIN = "null";

                        string message = $"Ви сдали автомобіль з оренди достроково. Ви отримали назад (₴‎ {price})";
                        DialogWindow.Show(message, "Відміна оренди", DialogButtons.Ok, DialogStyle.Information);
                    }

                    //DialogWindow.Show(message, "Відміна оренди", DialogButtons.OkNo, DialogStyle.Information) == DialogResult.Ok
                }
                else
                {
                    if (FinalRent.Show(Client.Vehicle, out Vehicle) == DialogResult.Ok)
                    {
                        Client.Vehicle = Vehicle;

                        Client.Server.ConnectProvider.log_RemoveRent(Client.User.Id, Client.Vehicle.RentLogId, DateTime.Now, 0, 0);

                        Client.Vehicle.ClientId  = 0;
                        Client.Vehicle.RentLogId = 0;

                        Client.Server.ConnectProvider.saveVehicle(Client.Vehicle);

                        Client.Vehicle.VIN = "null";
                    }

                    //DialogWindow.Show("Ви дійсно хочете відмінити оренду:", "Відміна оренди", DialogButtons.OkNo, DialogStyle.Information) == DialogResult.Ok
                }
            }

            if (Days > 0 && Client.User.Balance < Days * Client.Vehicle.Price)
            {
                DialogWindow.Show("Ви просрочили термін здачі автомобіля в автосалон.\n\n" +
                                  "На ваш аккаунт був накладений борг в розмірі - " + Days * Client.Vehicle.Price +
                                  "грн.\nДнів просрочено - " + Days + ".\nЦіна оренди в день - " + Client.Vehicle.Price + "грн.\n\nВи не зможете сдати автомобіль, поки не поповните баланс на сумму боргу.",
                                  "Борг", DialogButtons.Ok, DialogStyle.Information);

                return;
            }

            if (Days > 0 && Client.User.Balance >= Days * Client.Vehicle.Price)
            {
                if (FinalRent.Show(Client.Vehicle, out Vehicle) == DialogResult.Ok)
                {
                    Client.Vehicle = Vehicle;

                    float price = Days * Client.Vehicle.Price;
                    Client.User.Balance -= Days * Client.Vehicle.Price;

                    Client.Server.ConnectProvider.log_RemoveRent(Client.User.Id, Client.Vehicle.RentLogId, DateTime.Now, 0, price);

                    Client.Vehicle.ClientId  = 0;
                    Client.Vehicle.RentLogId = 0;

                    Client.Server.ConnectProvider.SaveUser(Client.User);
                    Client.Server.ConnectProvider.saveVehicle(Client.Vehicle);

                    Client.Vehicle.VIN = "null";

                    string message = $"Ви сдали автомобіль з оренди. З вашого рахунку був стягнутий борг (₴‎ {price})";

                    DialogWindow.Show(message, "Відміна оренди", DialogButtons.Ok, DialogStyle.Information);
                }
            }
        }