diff --git a/App.xaml.cs b/App.xaml.cs
index 6231dc8..1e70c23 100644
--- a/App.xaml.cs
+++ b/App.xaml.cs
@@ -9,6 +9,7 @@
MainPage = new MainPage();
+ MainPage = new NavigationPage(new MainPage());
}
}
}
diff --git a/BuyPage.xaml b/BuyPage.xaml
index effdf67..7c138af 100644
--- a/BuyPage.xaml
+++ b/BuyPage.xaml
@@ -26,10 +26,10 @@
HeightRequest="50"
VerticalOptions="Center"
HorizontalOptions="Fill">
-
+
+ VerticalOptions="Center"/>
diff --git a/BuyPage.xaml.cs b/BuyPage.xaml.cs
index f5543d9..c515af3 100644
--- a/BuyPage.xaml.cs
+++ b/BuyPage.xaml.cs
@@ -1,5 +1,10 @@
using CommunityToolkit.Maui.Views;
+using MyDiplom.Models;
+using MyDiplom.ViewModels;
+
+using Windows.System;
+
namespace MyDiplom;
public partial class BuyPage : Popup
@@ -7,14 +12,32 @@ public partial class BuyPage : Popup
public BuyPage()
{
InitializeComponent();
- }
+ }
+ ApplicationUser User { get; set; } = new ApplicationUser();
private void CloseButtonClicked(object sender, EventArgs e)
{
Close();
}
private void BuyButtonCliked(object sender, EventArgs e)
{
+ 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;
+ //}
+ var userViewModel = (BindingContext as UserViewModels);
+ if (userViewModel != null)
+ {
+ userViewModel.UpdateBalance(amount);
+
+ }
+ }
}
-}
+ }
+
diff --git a/MainPage.xaml b/MainPage.xaml
index 503abd2..d4e1a51 100644
--- a/MainPage.xaml
+++ b/MainPage.xaml
@@ -15,10 +15,12 @@
-
+ HorizontalOptions="Fill">
-
+
-
+
+ BackgroundColor="Transparent" Clicked="UsersButtonClicked" />