2025-04-10 15:34:02 +03:00
|
|
|
using CommunityToolkit.Maui.Views;
|
|
|
|
|
2025-04-14 12:49:39 +03:00
|
|
|
using MyDiplom.Models;
|
|
|
|
using MyDiplom.ViewModels;
|
|
|
|
|
|
|
|
using Windows.System;
|
|
|
|
|
2025-03-14 09:56:57 +03:00
|
|
|
namespace MyDiplom;
|
|
|
|
|
2025-04-10 15:34:02 +03:00
|
|
|
public partial class BuyPage : Popup
|
2025-03-14 09:56:57 +03:00
|
|
|
{
|
2025-04-10 15:34:02 +03:00
|
|
|
public BuyPage()
|
|
|
|
{
|
|
|
|
InitializeComponent();
|
|
|
|
|
2025-04-14 12:49:39 +03:00
|
|
|
}
|
|
|
|
ApplicationUser User { get; set; } = new ApplicationUser();
|
2025-04-10 15:34:02 +03:00
|
|
|
private void CloseButtonClicked(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
Close();
|
|
|
|
}
|
|
|
|
private void BuyButtonCliked(object sender, EventArgs e)
|
|
|
|
{
|
2025-04-14 12:49:39 +03:00
|
|
|
string amountText = AmountEntry.Text;
|
|
|
|
if (decimal.TryParse(amountText, out decimal amount))
|
|
|
|
{
|
|
|
|
//User.Balance += amount;
|
|
|
|
//var userViewModel = (BindingContext as UserViewModels);
|
|
|
|
//if (userViewModel != null)
|
|
|
|
//{
|
|
|
|
// userViewModel.User.Balance += amount;
|
2025-04-10 15:34:02 +03:00
|
|
|
|
2025-04-14 12:49:39 +03:00
|
|
|
//}
|
|
|
|
var userViewModel = (BindingContext as UserViewModels);
|
|
|
|
if (userViewModel != null)
|
|
|
|
{
|
|
|
|
userViewModel.UpdateBalance(amount);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
2025-04-10 15:34:02 +03:00
|
|
|
}
|
2025-04-14 12:49:39 +03:00
|
|
|
}
|
|
|
|
|