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

@ -2,7 +2,7 @@
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="MyDiplom.MainPage">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="80"/>
@ -16,18 +16,35 @@
</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"/>
Background="black"
HeightRequest="80"
HorizontalOptions="Fill" >
<Button Text="Регистироваться/Вход"
TextColor="White"
BackgroundColor="Transparent"
HorizontalOptions="EndAndExpand"/>
<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"/>
<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">
@ -36,7 +53,7 @@
<Border.StrokeShape>
<RoundRectangle CornerRadius="25"/>
</Border.StrokeShape>
<StackLayout Background="LightGray" Spacing="2">
<StackLayout Background="#F3F3F3" Spacing="2">
<Button Text="Главная" TextColor="Black"
BackgroundColor="Transparent"/>
@ -60,8 +77,8 @@
<Border.StrokeShape>
<RoundRectangle CornerRadius="25"/>
</Border.StrokeShape>
<StackLayout Background="AliceBlue"
<StackLayout Background="#F3F3F3"
Spacing="2" >
<Label Text="Боты" HorizontalOptions="Center" Scale="2"/>
<Button Text="1" TextColor="Black" Background="Transparent"/>
@ -99,14 +116,14 @@
<RoundRectangle CornerRadius="25"/>
</Border.StrokeShape>
<VerticalStackLayout Background="Aqua" HeightRequest="235" >
<VerticalStackLayout Background="#F3F3F3" HeightRequest="235" >
<StackLayout>
<Label Text="Выберите фриланс биржу, с которой хотите работать:" FontSize="45" Padding="1" />
</StackLayout>
<StackLayout VerticalOptions="Center" >
<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" />
@ -137,35 +154,35 @@
</Border>
</Grid>
</StackLayout>
<ScrollView Grid.Row="2" Grid.Column="1">
<VerticalStackLayout >
<Grid>
<Border >
<Border.StrokeShape>
<RoundRectangle CornerRadius="25"/>
</Border.StrokeShape>
<Grid>
<Grid Background="#F3F3F3">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<VerticalStackLayout Grid.ColumnSpan="2" Margin="10" >
<Label Text="Выберите подходящую категорию:" FontSize="18" />
<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" />
</StackLayout>
</VerticalStackLayout>
<StackLayout Grid.Row="1" Margin="40,0,0,0">
<StackLayout Grid.Row="1" Margin="40,0,0,0" >
<HorizontalStackLayout>
<CheckBox/>
<Label Text="Категория" Margin="25,15,0,0" Scale="2"/>
@ -191,8 +208,8 @@
<Label Text="Категория " Margin="-5,10,0,0" />
</HorizontalStackLayout>
</StackLayout>
<StackLayout Grid.Row="2" Margin="40,0,0,0">
<HorizontalStackLayout>
@ -220,9 +237,9 @@
<Label Text="Категория " Margin="-5,10,0,0" />
</HorizontalStackLayout>
</StackLayout>
<StackLayout Grid.Row="1" Grid.Column="1">
<HorizontalStackLayout>
<CheckBox/>
@ -249,8 +266,8 @@
<Label Text="Категория " Margin="-5,10,0,0" />
</HorizontalStackLayout>
</StackLayout>
<StackLayout Grid.Row="2" Grid.Column="1">
<HorizontalStackLayout>
@ -285,13 +302,9 @@
</Grid>
</Border>
</Grid>
</VerticalStackLayout>
</ScrollView>
<StackLayout Grid.Row="3" Background="Black" Grid.ColumnSpan="2">
</StackLayout>
</VerticalStackLayout>
</ScrollView>
</Grid>
</ContentPage>

View File

@ -1,4 +1,6 @@
namespace MyDiplom
using MyDiplom.ViewModels;
namespace MyDiplom
{
public partial class MainPage : ContentPage
{
@ -7,6 +9,8 @@
public MainPage()
{
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" />
</ItemGroup>
<ItemGroup>
<MauiXaml Update="BuyPage.xaml">
<Generator>MSBuild:Compile</Generator>
</MauiXaml>
</ItemGroup>
</Project>

View File

@ -6,6 +6,11 @@
<ActiveDebugProfile>Windows Machine</ActiveDebugProfile>
</PropertyGroup>
<ItemGroup>
<MauiXaml Update="BuyPage.xaml">
<SubType>Designer</SubType>
</MauiXaml>
</ItemGroup>
<ItemGroup>
<None Update="App.xaml">
<SubType>Designer</SubType>
</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 };
}
}
}