This commit is contained in:
БП 2025-03-14 09:56:57 +03:00
parent 883d1b0a70
commit 161180e5a5
9 changed files with 170 additions and 47 deletions

11
BuyPage.xaml Normal file
View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8" ?>
<ContentView xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MyDiplom.BuyPage">
<VerticalStackLayout>
<Label
Text="Welcome to .NET MAUI!"
VerticalOptions="Center"
HorizontalOptions="Center" />
</VerticalStackLayout>
</ContentView>

9
BuyPage.xaml.cs Normal file
View File

@ -0,0 +1,9 @@
namespace MyDiplom;
public partial class BuyPage : ContentView
{
public BuyPage()
{
InitializeComponent();
}
}

View File

@ -16,27 +16,44 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<StackLayout Grid.ColumnSpan="2" Orientation="Horizontal" Padding="10" <StackLayout Grid.ColumnSpan="2" Orientation="Horizontal" Padding="10"
Background="black" HeightRequest="80" Background="black"
HeightRequest="80"
HorizontalOptions="Fill" > HorizontalOptions="Fill" >
<Label Text="TgBots" TextColor="White" FontSize="40" <Label Text="TgBots" TextColor="White" FontSize="40"
VerticalOptions="Center" VerticalOptions="Center"
HorizontalOptions="StartAndExpand"/> HorizontalOptions="StartAndExpand"/>
<Button Text="Регистироваться/Вход" <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"/>
<Label Text="{Binding User.DisplayName}" TextColor="White" />
<Button Text="Профиль"
TextColor="White" TextColor="White"
BackgroundColor="Transparent" BackgroundColor="Transparent"
HorizontalOptions="EndAndExpand"/> HorizontalOptions="EndAndExpand"/>
</StackLayout> </StackLayout>
</StackLayout>
<StackLayout Grid.Row="1" Grid.RowSpan="4" WidthRequest="250" Spacing="5" Padding="0,5,0,0"> <StackLayout Grid.Row="1" Grid.RowSpan="4" WidthRequest="250" Spacing="5" Padding="0,5,0,0">
<Border Stroke="Gray"> <Border Stroke="Gray">
<Border.StrokeShape> <Border.StrokeShape>
<RoundRectangle CornerRadius="25"/> <RoundRectangle CornerRadius="25"/>
</Border.StrokeShape> </Border.StrokeShape>
<StackLayout Background="LightGray" Spacing="2"> <StackLayout Background="#F3F3F3" Spacing="2">
<Button Text="Главная" TextColor="Black" <Button Text="Главная" TextColor="Black"
BackgroundColor="Transparent"/> BackgroundColor="Transparent"/>
@ -61,7 +78,7 @@
<RoundRectangle CornerRadius="25"/> <RoundRectangle CornerRadius="25"/>
</Border.StrokeShape> </Border.StrokeShape>
<StackLayout Background="AliceBlue" <StackLayout Background="#F3F3F3"
Spacing="2" > Spacing="2" >
<Label Text="Боты" HorizontalOptions="Center" Scale="2"/> <Label Text="Боты" HorizontalOptions="Center" Scale="2"/>
<Button Text="1" TextColor="Black" Background="Transparent"/> <Button Text="1" TextColor="Black" Background="Transparent"/>
@ -99,14 +116,14 @@
<RoundRectangle CornerRadius="25"/> <RoundRectangle CornerRadius="25"/>
</Border.StrokeShape> </Border.StrokeShape>
<VerticalStackLayout Background="Aqua" HeightRequest="235" > <VerticalStackLayout Background="#F3F3F3" HeightRequest="235" >
<StackLayout> <StackLayout>
<Label Text="Выберите фриланс биржу, с которой хотите работать:" FontSize="45" Padding="1" /> <Label Text="Выберите фриланс биржу, с которой хотите работать:" FontSize="45" Padding="1" />
</StackLayout> </StackLayout>
<StackLayout VerticalOptions="Center" > <StackLayout VerticalOptions="Center" >
<StackLayout Padding="10,0,0,0" Orientation="Horizontal" Spacing="10" > <StackLayout Padding="10,0,0,0" Orientation="Horizontal" Spacing="10" >
<Button Text="Выделить всё" WidthRequest="130" TextColor="Black" Background="LightGray" /> <Button Text="Выделить всё" WidthRequest="130" TextColor="Black" Background="LightSlateGray" />
<Button Text="Очистить" WidthRequest="130" TextColor="Black" Background="LightPink" /> <Button Text="Очистить" WidthRequest="130" TextColor="Black" Background="LightPink" />
@ -146,7 +163,7 @@
<Border.StrokeShape> <Border.StrokeShape>
<RoundRectangle CornerRadius="25"/> <RoundRectangle CornerRadius="25"/>
</Border.StrokeShape> </Border.StrokeShape>
<Grid> <Grid Background="#F3F3F3">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/> <RowDefinition Height="Auto"/>
@ -159,7 +176,7 @@
<VerticalStackLayout Grid.ColumnSpan="2" Margin="10" > <VerticalStackLayout Grid.ColumnSpan="2" Margin="10" >
<Label Text="Выберите подходящую категорию:" FontSize="18" /> <Label Text="Выберите подходящую категорию:" FontSize="18" />
<StackLayout Orientation="Horizontal" Spacing="10" > <StackLayout Orientation="Horizontal" Spacing="10" >
<Button Text="Выделить всё" WidthRequest="130" TextColor="Black" Background="LightGray" /> <Button Text="Выделить всё" WidthRequest="130" TextColor="Black" Background="LightSlateGray" />
<Button Text="Очистить" WidthRequest="130" TextColor="Black" Background="LightPink" /> <Button Text="Очистить" WidthRequest="130" TextColor="Black" Background="LightPink" />
</StackLayout> </StackLayout>
</VerticalStackLayout> </VerticalStackLayout>
@ -289,9 +306,5 @@
</VerticalStackLayout> </VerticalStackLayout>
</ScrollView> </ScrollView>
<StackLayout Grid.Row="3" Background="Black" Grid.ColumnSpan="2">
</StackLayout>
</Grid> </Grid>
</ContentPage> </ContentPage>

View File

@ -1,4 +1,6 @@
namespace MyDiplom using MyDiplom.ViewModels;
namespace MyDiplom
{ {
public partial class MainPage : ContentPage public partial class MainPage : ContentPage
{ {
@ -7,6 +9,8 @@
public MainPage() public MainPage()
{ {
InitializeComponent(); InitializeComponent();
this.BindingContext = new UserViewModels();
} }

15
Models/Users.cs Normal file
View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MyDiplom.Models
{
public class ApplicationUser
{
public string? DisplayName { get; set; }
public decimal Balance { get; set; } = 0;
public string? InvitedUserId { get; set; }
}
}

View File

@ -63,4 +63,10 @@
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" /> <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<MauiXaml Update="BuyPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
</ItemGroup>
</Project> </Project>

View File

@ -6,6 +6,11 @@
<ActiveDebugProfile>Windows Machine</ActiveDebugProfile> <ActiveDebugProfile>Windows Machine</ActiveDebugProfile>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<MauiXaml Update="BuyPage.xaml">
<SubType>Designer</SubType>
</MauiXaml>
</ItemGroup>
<ItemGroup>
<None Update="App.xaml"> <None Update="App.xaml">
<SubType>Designer</SubType> <SubType>Designer</SubType>
</None> </None>

View File

@ -0,0 +1,41 @@
using System.ComponentModel;
using System.Runtime.CompilerServices;
namespace MyDiplom.ViewModels
{
public class BaseViewModel : INotifyPropertyChanged
{
bool isBusy = false;
public bool IsBusy
{
get { return isBusy; }
set { SetProperty(ref isBusy, value); }
}
protected bool SetProperty<T>(ref T backingStore, T value,
[CallerMemberName] string propertyName = "",
Action onChanged = null)
{
if (EqualityComparer<T>.Default.Equals(backingStore, value))
return false;
backingStore = value;
onChanged?.Invoke();
OnPropertyChanged(propertyName);
return true;
}
#region INotifyPropertyChanged
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged([CallerMemberName] string propertyName = "")
{
var changed = PropertyChanged;
if (changed == null)
return;
changed.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
#endregion
}
}

View File

@ -0,0 +1,19 @@
using MyDiplom.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MyDiplom.ViewModels
{
public class UserViewModels:BaseViewModel
{
public ApplicationUser User { get; set; } = new ApplicationUser();
public UserViewModels()
{
User = new ApplicationUser { DisplayName = "Вася", Balance = 10.0m };
}
}
}