2
This commit is contained in:
parent
41527a95b2
commit
f8ca7c1833
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
|
|
||||||
MainPage = new MainPage();
|
MainPage = new MainPage();
|
||||||
|
MainPage = new NavigationPage(new MainPage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -26,10 +26,10 @@
|
|||||||
HeightRequest="50"
|
HeightRequest="50"
|
||||||
VerticalOptions="Center"
|
VerticalOptions="Center"
|
||||||
HorizontalOptions="Fill">
|
HorizontalOptions="Fill">
|
||||||
<Entry WidthRequest="300"/>
|
<Entry WidthRequest="300" Placeholder="Введите сумму" Keyboard="Numeric" x:Name="AmountEntry"/>
|
||||||
<Label Text="₽"
|
<Label Text="₽"
|
||||||
FontSize="18"
|
FontSize="18"
|
||||||
VerticalOptions="Center" />
|
VerticalOptions="Center"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,10 @@
|
|||||||
using CommunityToolkit.Maui.Views;
|
using CommunityToolkit.Maui.Views;
|
||||||
|
|
||||||
|
using MyDiplom.Models;
|
||||||
|
using MyDiplom.ViewModels;
|
||||||
|
|
||||||
|
using Windows.System;
|
||||||
|
|
||||||
namespace MyDiplom;
|
namespace MyDiplom;
|
||||||
|
|
||||||
public partial class BuyPage : Popup
|
public partial class BuyPage : Popup
|
||||||
@ -7,14 +12,32 @@ public partial class BuyPage : Popup
|
|||||||
public BuyPage()
|
public BuyPage()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
|
ApplicationUser User { get; set; } = new ApplicationUser();
|
||||||
private void CloseButtonClicked(object sender, EventArgs e)
|
private void CloseButtonClicked(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
private void BuyButtonCliked(object sender, EventArgs e)
|
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);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,10 +15,12 @@
|
|||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<StackLayout Grid.ColumnSpan="2" Orientation="Horizontal" Padding="10"
|
<StackLayout Grid.ColumnSpan="2"
|
||||||
Background="black"
|
Orientation="Horizontal"
|
||||||
|
Padding="10"
|
||||||
|
Background="Black"
|
||||||
HeightRequest="80"
|
HeightRequest="80"
|
||||||
HorizontalOptions="Fill" >
|
HorizontalOptions="Fill">
|
||||||
|
|
||||||
|
|
||||||
<Label Text="TgBots" TextColor="White" FontSize="40"
|
<Label Text="TgBots" TextColor="White" FontSize="40"
|
||||||
@ -26,7 +28,7 @@
|
|||||||
HorizontalOptions="StartAndExpand"/>
|
HorizontalOptions="StartAndExpand"/>
|
||||||
|
|
||||||
<StackLayout HorizontalOptions="End" Orientation="Horizontal" Padding="0,0,10,0" Spacing="20">
|
<StackLayout HorizontalOptions="End" Orientation="Horizontal" Padding="0,0,10,0" Spacing="20">
|
||||||
<Label Text="{Binding User.Balance, StringFormat='Ваш Баланс {0} Р'}" TextColor="White" VerticalOptions="Center" />
|
<Label x:Name="BalanceLabel" Text="{Binding User.Balance, StringFormat='Ваш Баланс {0} Р'}" TextColor="White" VerticalOptions="Center" />
|
||||||
|
|
||||||
|
|
||||||
<Button Text="Пополнить"
|
<Button Text="Пополнить"
|
||||||
@ -37,7 +39,7 @@
|
|||||||
HeightRequest="20"
|
HeightRequest="20"
|
||||||
Clicked="OnButtonClicked" />
|
Clicked="OnButtonClicked" />
|
||||||
|
|
||||||
<Label Text="{Binding User.DisplayName}" TextColor="White" />
|
<Label Text="{Binding User.DisplayName}" TextColor="White" Padding="0,20,0,0" />
|
||||||
|
|
||||||
<Button Text="Профиль"
|
<Button Text="Профиль"
|
||||||
TextColor="White"
|
TextColor="White"
|
||||||
@ -59,7 +61,7 @@
|
|||||||
<Button Text="Главная" TextColor="Black"
|
<Button Text="Главная" TextColor="Black"
|
||||||
BackgroundColor="Transparent"/>
|
BackgroundColor="Transparent"/>
|
||||||
<Button Text="Личный кабинет" TextColor="Black"
|
<Button Text="Личный кабинет" TextColor="Black"
|
||||||
BackgroundColor="Transparent" />
|
BackgroundColor="Transparent" Clicked="UsersButtonClicked" />
|
||||||
<Button Text="О нас" TextColor="Black"
|
<Button Text="О нас" TextColor="Black"
|
||||||
BackgroundColor="Transparent"/>
|
BackgroundColor="Transparent"/>
|
||||||
<Button Text="Новости" TextColor="Black"
|
<Button Text="Новости" TextColor="Black"
|
||||||
|
@ -22,6 +22,10 @@ namespace MyDiplom
|
|||||||
{
|
{
|
||||||
var buyPopup = new BuyPage();
|
var buyPopup = new BuyPage();
|
||||||
this.ShowPopup(buyPopup);
|
this.ShowPopup(buyPopup);
|
||||||
}
|
}
|
||||||
|
private async void UsersButtonClicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
await Navigation.PushAsync(new UsersPage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,12 +4,14 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
using Windows.System;
|
||||||
|
|
||||||
namespace MyDiplom.Models
|
namespace MyDiplom.Models
|
||||||
{
|
{
|
||||||
public class ApplicationUser
|
public class ApplicationUser
|
||||||
{
|
{
|
||||||
public string? DisplayName { get; set; }
|
public string? DisplayName { get; set; }
|
||||||
public decimal Balance { get; set; } = 0;
|
public decimal Balance { get; set; } = 0.0m;
|
||||||
public string? InvitedUserId { get; set; }
|
public string? InvitedUserId { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -68,6 +68,9 @@
|
|||||||
<MauiXaml Update="BuyPage.xaml">
|
<MauiXaml Update="BuyPage.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</MauiXaml>
|
</MauiXaml>
|
||||||
|
<MauiXaml Update="UsersPage.xaml">
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</MauiXaml>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
@ -9,6 +9,9 @@
|
|||||||
<MauiXaml Update="BuyPage.xaml">
|
<MauiXaml Update="BuyPage.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</MauiXaml>
|
</MauiXaml>
|
||||||
|
<MauiXaml Update="UsersPage.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
</MauiXaml>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="App.xaml">
|
<None Update="App.xaml">
|
||||||
|
166
UsersPage.xaml
Normal file
166
UsersPage.xaml
Normal file
@ -0,0 +1,166 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||||
|
x:Class="MyDiplom.UsersPage">
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="90"/>
|
||||||
|
<RowDefinition Height="550"/>
|
||||||
|
<RowDefinition Height="*"/>
|
||||||
|
<RowDefinition Height="100"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="260"/>
|
||||||
|
<ColumnDefinition Width="*"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<StackLayout Grid.ColumnSpan="2"
|
||||||
|
Orientation="Horizontal"
|
||||||
|
Padding="10"
|
||||||
|
Background="Black"
|
||||||
|
HeightRequest="80"
|
||||||
|
HorizontalOptions="Fill">
|
||||||
|
|
||||||
|
|
||||||
|
<Label Text="TgBots" TextColor="White" FontSize="40"
|
||||||
|
VerticalOptions="Center"
|
||||||
|
HorizontalOptions="StartAndExpand"/>
|
||||||
|
|
||||||
|
<StackLayout HorizontalOptions="End" Orientation="Horizontal" Padding="0,0,10,0" Spacing="20">
|
||||||
|
<Label Text="{Binding User.Balance, StringFormat='Ваш Баланс {0} Р'}" TextColor="White" VerticalOptions="Center" />
|
||||||
|
|
||||||
|
|
||||||
|
<Button Text="Пополнить"
|
||||||
|
Background="White"
|
||||||
|
TextColor="Black"
|
||||||
|
HorizontalOptions="EndAndExpand"
|
||||||
|
WidthRequest="110"
|
||||||
|
HeightRequest="20"
|
||||||
|
Clicked="OnButtonClicked" />
|
||||||
|
|
||||||
|
<Label Text="{Binding User.DisplayName}" TextColor="White" />
|
||||||
|
|
||||||
|
<Button Text="Профиль"
|
||||||
|
TextColor="White"
|
||||||
|
BackgroundColor="Transparent"
|
||||||
|
HorizontalOptions="EndAndExpand"/>
|
||||||
|
|
||||||
|
</StackLayout>
|
||||||
|
|
||||||
|
</StackLayout>
|
||||||
|
|
||||||
|
<StackLayout Grid.Row="1" Grid.RowSpan="4" WidthRequest="250" Spacing="5" Padding="0,5,0,0">
|
||||||
|
|
||||||
|
<Border Stroke="Gray">
|
||||||
|
<Border.StrokeShape>
|
||||||
|
<RoundRectangle CornerRadius="25"/>
|
||||||
|
</Border.StrokeShape>
|
||||||
|
<StackLayout Background="#F3F3F3" Spacing="2">
|
||||||
|
|
||||||
|
<Button Text="Главная" TextColor="Black"
|
||||||
|
BackgroundColor="Transparent"/>
|
||||||
|
<Button Text="Личный кабинет" TextColor="Black"
|
||||||
|
BackgroundColor="Transparent"/>
|
||||||
|
<Button Text="О нас" TextColor="Black"
|
||||||
|
BackgroundColor="Transparent"/>
|
||||||
|
<Button Text="Новости" TextColor="Black"
|
||||||
|
BackgroundColor="Transparent"/>
|
||||||
|
<Button Text="FAQ" TextColor="Black"
|
||||||
|
BackgroundColor="Transparent"/>
|
||||||
|
<Button Text="Контакты" TextColor="Black"
|
||||||
|
BackgroundColor="Transparent"/>
|
||||||
|
<Button Text="О ботах" TextColor="Black"
|
||||||
|
BackgroundColor="Transparent"/>
|
||||||
|
</StackLayout>
|
||||||
|
</Border>
|
||||||
|
<StackLayout Spacing="5" WidthRequest="250">
|
||||||
|
|
||||||
|
<Border Stroke="Gray">
|
||||||
|
<Border.StrokeShape>
|
||||||
|
<RoundRectangle CornerRadius="25"/>
|
||||||
|
</Border.StrokeShape>
|
||||||
|
|
||||||
|
<StackLayout Background="#6D87D3"
|
||||||
|
Spacing="2" Padding="0,10,0,0">
|
||||||
|
<Label Text="Боты" HorizontalOptions="Center" Scale="2"/>
|
||||||
|
<Button Text="TG FREELANCE ПОМОЩНИК" TextColor="Black" Background="Transparent"/>
|
||||||
|
<Button Text="Раскрутка TG Группы" TextColor="Black" Background="Transparent"/>
|
||||||
|
<Button Text="Интернет Магазин" TextColor="Black" Background="Transparent"/>
|
||||||
|
</StackLayout>
|
||||||
|
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
|
||||||
|
</StackLayout>
|
||||||
|
<Border>
|
||||||
|
<Border.StrokeShape>
|
||||||
|
<RoundRectangle CornerRadius="25"/>
|
||||||
|
</Border.StrokeShape>
|
||||||
|
<StackLayout Background="Black" Grid.Row="1" WidthRequest="250" >
|
||||||
|
<Button Text="Помощь" Background="Transparent"/>
|
||||||
|
|
||||||
|
</StackLayout>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
|
||||||
|
</StackLayout>
|
||||||
|
|
||||||
|
<StackLayout Grid.Row="1" Grid.Column="1">
|
||||||
|
|
||||||
|
<Grid>
|
||||||
|
|
||||||
|
<Border>
|
||||||
|
<Border.StrokeShape>
|
||||||
|
<RoundRectangle CornerRadius="25"/>
|
||||||
|
</Border.StrokeShape>
|
||||||
|
|
||||||
|
<VerticalStackLayout Background="#F3F3F3" HeightRequest="285" >
|
||||||
|
|
||||||
|
<VerticalStackLayout Padding="20" Spacing="10">
|
||||||
|
<Label Text="ЛИЧНЫЙ НАБИНЕТ" FontSize="20" FontAttributes="Bold" HorizontalOptions="Start"/>
|
||||||
|
|
||||||
|
|
||||||
|
<Grid ColumnDefinitions="Auto,*,Auto" ColumnSpacing="10">
|
||||||
|
<Label Text="Имя пользователя" VerticalOptions="Center"/>
|
||||||
|
<Entry Text="" Grid.Column="1"/>
|
||||||
|
<Button Text="Изменить"
|
||||||
|
Grid.Column="2"
|
||||||
|
WidthRequest="100"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
|
||||||
|
<Grid ColumnDefinitions="Auto,*,Auto" ColumnSpacing="10">
|
||||||
|
<Label Text="Электронная почта" VerticalOptions="Center"/>
|
||||||
|
<Entry Text="" Grid.Column="1"/>
|
||||||
|
<Button Text="Изменить"
|
||||||
|
Grid.Column="2"
|
||||||
|
WidthRequest="100"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
|
||||||
|
<Grid ColumnDefinitions="Auto,*,Auto" ColumnSpacing="10">
|
||||||
|
<Label Text="Мобильный телефон" VerticalOptions="Center"/>
|
||||||
|
<Entry Text="" Grid.Column="1" Keyboard="Telephone"/>
|
||||||
|
<Button Text="Изменить"
|
||||||
|
Grid.Column="2"
|
||||||
|
WidthRequest="100"/>
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
|
||||||
|
<Grid ColumnDefinitions="Auto,*,Auto" ColumnSpacing="10">
|
||||||
|
<Label Text="Телеграмм" VerticalOptions="Center"/>
|
||||||
|
<Entry Text="" Grid.Column="1"/>
|
||||||
|
<Button Text="Изменить"
|
||||||
|
Grid.Column="2"
|
||||||
|
WidthRequest="100"/>
|
||||||
|
</Grid>
|
||||||
|
</VerticalStackLayout>
|
||||||
|
|
||||||
|
|
||||||
|
</VerticalStackLayout>
|
||||||
|
</Border>
|
||||||
|
</Grid>
|
||||||
|
</StackLayout>
|
||||||
|
</Grid>
|
||||||
|
</ContentPage>
|
17
UsersPage.xaml.cs
Normal file
17
UsersPage.xaml.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
using CommunityToolkit.Maui.Views;
|
||||||
|
|
||||||
|
namespace MyDiplom;
|
||||||
|
|
||||||
|
public partial class UsersPage : ContentPage
|
||||||
|
{
|
||||||
|
public UsersPage()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
private void OnButtonClicked(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
var buyPopup = new BuyPage();
|
||||||
|
this.ShowPopup(buyPopup);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -2,18 +2,48 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
using Windows.System;
|
||||||
|
|
||||||
namespace MyDiplom.ViewModels
|
namespace MyDiplom.ViewModels
|
||||||
{
|
{
|
||||||
public class UserViewModels:BaseViewModel
|
public class UserViewModels : BaseViewModel
|
||||||
{
|
{
|
||||||
public ApplicationUser User { get; set; } = new ApplicationUser();
|
public ApplicationUser User { get; set; } = new ApplicationUser();
|
||||||
public UserViewModels()
|
public UserViewModels()
|
||||||
{
|
{
|
||||||
User = new ApplicationUser { DisplayName = "Вася", Balance = 10.0m };
|
User = new ApplicationUser { DisplayName = "Вася" };
|
||||||
|
LoadUserData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UpdateBalance(decimal amount)
|
||||||
|
{
|
||||||
|
if (amount != 0)
|
||||||
|
{
|
||||||
|
User.Balance += amount;
|
||||||
|
OnPropertyChanged(nameof(User));
|
||||||
|
SaveUserData();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void SaveUserData()
|
||||||
|
{
|
||||||
|
Preferences.Set("UserBalance", User.Balance.ToString());
|
||||||
|
Preferences.Set("UserDisplayName", User.DisplayName);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void LoadUserData()
|
||||||
|
{
|
||||||
|
|
||||||
|
string balanceString = Preferences.Get("UserBalance", "0");
|
||||||
|
User.Balance = decimal.TryParse(balanceString, out var balance) ? balance : 0;
|
||||||
|
|
||||||
|
User.DisplayName = Preferences.Get("UserDisplayName", "Вася");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user