Bladeren bron

Добавьте файлы проекта.

lyudmila.archackowa 9 maanden geleden
bovenliggende
commit
6871388ddf
23 gewijzigde bestanden met toevoegingen van 580 en 0 verwijderingen
  1. 25 0
      AvaloniaApplicationPersonalPage.sln
  2. 15 0
      AvaloniaApplicationPersonalPage/App.axaml
  3. 29 0
      AvaloniaApplicationPersonalPage/App.axaml.cs
  4. BIN
      AvaloniaApplicationPersonalPage/Assets/avalonia-logo.ico
  5. 31 0
      AvaloniaApplicationPersonalPage/AvaloniaApplicationPersonalPage.csproj
  6. 13 0
      AvaloniaApplicationPersonalPage/Models/GenderTable.cs
  7. 19 0
      AvaloniaApplicationPersonalPage/Models/LoginTable.cs
  8. 13 0
      AvaloniaApplicationPersonalPage/Models/RoleTable.cs
  9. 108 0
      AvaloniaApplicationPersonalPage/Models/UserBaseContext.cs
  10. 19 0
      AvaloniaApplicationPersonalPage/Models/UserTable.cs
  11. 24 0
      AvaloniaApplicationPersonalPage/Program.cs
  12. 28 0
      AvaloniaApplicationPersonalPage/ViewLocator.cs
  13. 20 0
      AvaloniaApplicationPersonalPage/ViewModels/AutoPageViewModel.cs
  14. 36 0
      AvaloniaApplicationPersonalPage/ViewModels/MainWindowViewModel.cs
  15. 67 0
      AvaloniaApplicationPersonalPage/ViewModels/PersonalPageViewModel.cs
  16. 8 0
      AvaloniaApplicationPersonalPage/ViewModels/ViewModelBase.cs
  17. 19 0
      AvaloniaApplicationPersonalPage/Views/AutoPage.axaml
  18. 13 0
      AvaloniaApplicationPersonalPage/Views/AutoPage.axaml.cs
  19. 20 0
      AvaloniaApplicationPersonalPage/Views/MainWindow.axaml
  20. 12 0
      AvaloniaApplicationPersonalPage/Views/MainWindow.axaml.cs
  21. 30 0
      AvaloniaApplicationPersonalPage/Views/PersonalPage.axaml
  22. 13 0
      AvaloniaApplicationPersonalPage/Views/PersonalPage.axaml.cs
  23. 18 0
      AvaloniaApplicationPersonalPage/app.manifest

+ 25 - 0
AvaloniaApplicationPersonalPage.sln

@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.6.33829.357
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvaloniaApplicationPersonalPage", "AvaloniaApplicationPersonalPage\AvaloniaApplicationPersonalPage.csproj", "{E90F1D11-AD56-41FD-9E6E-0DD74AF98C66}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{E90F1D11-AD56-41FD-9E6E-0DD74AF98C66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{E90F1D11-AD56-41FD-9E6E-0DD74AF98C66}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{E90F1D11-AD56-41FD-9E6E-0DD74AF98C66}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{E90F1D11-AD56-41FD-9E6E-0DD74AF98C66}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {09A97BF3-DE70-42CD-B55A-AA2BD32CBF74}
+	EndGlobalSection
+EndGlobal

+ 15 - 0
AvaloniaApplicationPersonalPage/App.axaml

@@ -0,0 +1,15 @@
+<Application xmlns="https://github.com/avaloniaui"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             x:Class="AvaloniaApplicationPersonalPage.App"
+             xmlns:local="using:AvaloniaApplicationPersonalPage"
+             RequestedThemeVariant="Default">
+             <!-- "Default" ThemeVariant follows system theme variant. "Dark" or "Light" are other available options. -->
+
+    <Application.DataTemplates>
+        <local:ViewLocator/>
+    </Application.DataTemplates>
+  
+    <Application.Styles>
+        <FluentTheme />
+    </Application.Styles>
+</Application>

+ 29 - 0
AvaloniaApplicationPersonalPage/App.axaml.cs

@@ -0,0 +1,29 @@
+using Avalonia;
+using Avalonia.Controls.ApplicationLifetimes;
+using Avalonia.Markup.Xaml;
+using AvaloniaApplicationPersonalPage.ViewModels;
+using AvaloniaApplicationPersonalPage.Views;
+
+namespace AvaloniaApplicationPersonalPage
+{
+    public partial class App : Application
+    {
+        public override void Initialize()
+        {
+            AvaloniaXamlLoader.Load(this);
+        }
+
+        public override void OnFrameworkInitializationCompleted()
+        {
+            if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
+            {
+                desktop.MainWindow = new MainWindow
+                {
+                    DataContext = new MainWindowViewModel(),
+                };
+            }
+
+            base.OnFrameworkInitializationCompleted();
+        }
+    }
+}

BIN
AvaloniaApplicationPersonalPage/Assets/avalonia-logo.ico


+ 31 - 0
AvaloniaApplicationPersonalPage/AvaloniaApplicationPersonalPage.csproj

@@ -0,0 +1,31 @@
+<Project Sdk="Microsoft.NET.Sdk">
+  <PropertyGroup>
+    <OutputType>WinExe</OutputType>
+    <TargetFramework>net7.0</TargetFramework>
+    <Nullable>enable</Nullable>
+    <BuiltInComInteropSupport>true</BuiltInComInteropSupport>
+    <ApplicationManifest>app.manifest</ApplicationManifest>
+    <AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <Folder Include="Models\" />
+    <AvaloniaResource Include="Assets\**" />
+  </ItemGroup>
+
+
+  <ItemGroup>
+    <PackageReference Include="Avalonia" Version="11.0.2" />
+    <PackageReference Include="Avalonia.Desktop" Version="11.0.2" />
+    <PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.2" />
+    <PackageReference Include="Avalonia.Fonts.Inter" Version="11.0.2" />
+    <!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
+    <PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.2" />
+    <PackageReference Include="Avalonia.ReactiveUI" Version="11.0.2" />
+    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.14">
+      <PrivateAssets>all</PrivateAssets>
+      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+    </PackageReference>
+    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.11" />
+  </ItemGroup>
+</Project>

+ 13 - 0
AvaloniaApplicationPersonalPage/Models/GenderTable.cs

@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+
+namespace AvaloniaApplicationPersonalPage.Models;
+
+public partial class GenderTable
+{
+    public int IdGender { get; set; }
+
+    public string Gender { get; set; } = null!;
+
+    public virtual ICollection<UserTable> UserTables { get; set; } = new List<UserTable>();
+}

+ 19 - 0
AvaloniaApplicationPersonalPage/Models/LoginTable.cs

@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+
+namespace AvaloniaApplicationPersonalPage.Models;
+
+public partial class LoginTable
+{
+    public int IdLogin { get; set; }
+
+    public string Login { get; set; } = null!;
+
+    public string Password { get; set; } = null!;
+
+    public int IdRole { get; set; }
+
+    public virtual RoleTable IdRoleNavigation { get; set; } = null!;
+
+    public virtual UserTable? UserTable { get; set; }
+}

+ 13 - 0
AvaloniaApplicationPersonalPage/Models/RoleTable.cs

@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+
+namespace AvaloniaApplicationPersonalPage.Models;
+
+public partial class RoleTable
+{
+    public int IdRole { get; set; }
+
+    public string Role { get; set; } = null!;
+
+    public virtual ICollection<LoginTable> LoginTables { get; set; } = new List<LoginTable>();
+}

+ 108 - 0
AvaloniaApplicationPersonalPage/Models/UserBaseContext.cs

@@ -0,0 +1,108 @@
+using System;
+using System.Collections.Generic;
+using Microsoft.EntityFrameworkCore;
+
+namespace AvaloniaApplicationPersonalPage.Models;
+
+public partial class UserBaseContext : DbContext
+{
+    public UserBaseContext()
+    {
+    }
+
+    public UserBaseContext(DbContextOptions<UserBaseContext> options)
+        : base(options)
+    {
+    }
+
+    public virtual DbSet<GenderTable> GenderTables { get; set; }
+
+    public virtual DbSet<LoginTable> LoginTables { get; set; }
+
+    public virtual DbSet<RoleTable> RoleTables { get; set; }
+
+    public virtual DbSet<UserTable> UserTables { get; set; }
+
+    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+#warning To protect potentially sensitive information in your connection string, you should move it out of source code. You can avoid scaffolding the connection string by using the Name= syntax to read it from configuration - see https://go.microsoft.com/fwlink/?linkid=2131148. For more guidance on storing connection strings, see http://go.microsoft.com/fwlink/?LinkId=723263.
+        => optionsBuilder.UseNpgsql("Host=edu.pg.ngknn.local;Port=5432;Database=UserBase;Username=43P;Password=444444");
+
+    protected override void OnModelCreating(ModelBuilder modelBuilder)
+    {
+        modelBuilder.Entity<GenderTable>(entity =>
+        {
+            entity.HasKey(e => e.IdGender).HasName("gender_table_pk");
+
+            entity.ToTable("gender_table");
+
+            entity.Property(e => e.IdGender).HasColumnName("id_gender");
+            entity.Property(e => e.Gender)
+                .HasColumnType("character varying")
+                .HasColumnName("gender");
+        });
+
+        modelBuilder.Entity<LoginTable>(entity =>
+        {
+            entity.HasKey(e => e.IdLogin).HasName("login_table_pk");
+
+            entity.ToTable("login_table");
+
+            entity.Property(e => e.IdLogin).HasColumnName("id_login");
+            entity.Property(e => e.IdRole).HasColumnName("id_role");
+            entity.Property(e => e.Login)
+                .HasColumnType("character varying")
+                .HasColumnName("login");
+            entity.Property(e => e.Password)
+                .HasColumnType("character varying")
+                .HasColumnName("password");
+
+            entity.HasOne(d => d.IdRoleNavigation).WithMany(p => p.LoginTables)
+                .HasForeignKey(d => d.IdRole)
+                .OnDelete(DeleteBehavior.ClientSetNull)
+                .HasConstraintName("login_table_fk");
+        });
+
+        modelBuilder.Entity<RoleTable>(entity =>
+        {
+            entity.HasKey(e => e.IdRole).HasName("role_table_pk");
+
+            entity.ToTable("role_table");
+
+            entity.Property(e => e.IdRole).HasColumnName("id_role");
+            entity.Property(e => e.Role)
+                .HasColumnType("character varying")
+                .HasColumnName("role");
+        });
+
+        modelBuilder.Entity<UserTable>(entity =>
+        {
+            entity.HasKey(e => e.IdUser).HasName("user_table_pk");
+
+            entity.ToTable("user_table");
+
+            entity.Property(e => e.IdUser)
+                .ValueGeneratedNever()
+                .HasColumnName("id_user");
+            entity.Property(e => e.Date)
+                .HasColumnType("timestamp without time zone")
+                .HasColumnName("date");
+            entity.Property(e => e.IdGender).HasColumnName("id_gender");
+            entity.Property(e => e.Name)
+                .HasColumnType("character varying")
+                .HasColumnName("name");
+
+            entity.HasOne(d => d.IdGenderNavigation).WithMany(p => p.UserTables)
+                .HasForeignKey(d => d.IdGender)
+                .OnDelete(DeleteBehavior.ClientSetNull)
+                .HasConstraintName("user_table_fk");
+
+            entity.HasOne(d => d.IdUserNavigation).WithOne(p => p.UserTable)
+                .HasForeignKey<UserTable>(d => d.IdUser)
+                .HasConstraintName("user_table_fk_1");
+        });
+
+        OnModelCreatingPartial(modelBuilder);
+    }
+
+    partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
+}

+ 19 - 0
AvaloniaApplicationPersonalPage/Models/UserTable.cs

@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+
+namespace AvaloniaApplicationPersonalPage.Models;
+
+public partial class UserTable
+{
+    public int IdUser { get; set; }
+
+    public string Name { get; set; } = null!;
+
+    public DateTime Date { get; set; }
+
+    public int IdGender { get; set; }
+
+    public virtual GenderTable IdGenderNavigation { get; set; } = null!;
+
+    public virtual LoginTable IdUserNavigation { get; set; } = null!;
+}

+ 24 - 0
AvaloniaApplicationPersonalPage/Program.cs

@@ -0,0 +1,24 @@
+using Avalonia;
+using Avalonia.ReactiveUI;
+using System;
+
+namespace AvaloniaApplicationPersonalPage
+{
+    internal class Program
+    {
+        // Initialization code. Don't use any Avalonia, third-party APIs or any
+        // SynchronizationContext-reliant code before AppMain is called: things aren't initialized
+        // yet and stuff might break.
+        [STAThread]
+        public static void Main(string[] args) => BuildAvaloniaApp()
+            .StartWithClassicDesktopLifetime(args);
+
+        // Avalonia configuration, don't remove; also used by visual designer.
+        public static AppBuilder BuildAvaloniaApp()
+            => AppBuilder.Configure<App>()
+                .UsePlatformDetect()
+                .WithInterFont()
+                .LogToTrace()
+                .UseReactiveUI();
+    }
+}

+ 28 - 0
AvaloniaApplicationPersonalPage/ViewLocator.cs

@@ -0,0 +1,28 @@
+using Avalonia.Controls;
+using Avalonia.Controls.Templates;
+using AvaloniaApplicationPersonalPage.ViewModels;
+using System;
+
+namespace AvaloniaApplicationPersonalPage
+{
+    public class ViewLocator : IDataTemplate
+    {
+        public Control Build(object data)
+        {
+            var name = data.GetType().FullName!.Replace("ViewModel", "View");
+            var type = Type.GetType(name);
+
+            if (type != null)
+            {
+                return (Control)Activator.CreateInstance(type)!;
+            }
+
+            return new TextBlock { Text = "Not Found: " + name };
+        }
+
+        public bool Match(object data)
+        {
+            return data is ViewModelBase;
+        }
+    }
+}

+ 20 - 0
AvaloniaApplicationPersonalPage/ViewModels/AutoPageViewModel.cs

@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using ReactiveUI;
+
+namespace AvaloniaApplicationPersonalPage.ViewModels
+{
+	public class AutoPageViewModel : ReactiveObject
+	{
+        // ïîëÿ äëÿ ëîãèíà è ïàðîëÿ (èçíà÷àëüíî îíè çàãðóæàþòñÿ ïóñòûìè):
+		string login = "";
+		string password = "";
+        string message; // ïîëÿ äëÿ õðàíåíèÿ ñîäåðæàíèÿ ñîîáùåíèÿ
+
+        public string Login { get => login; set => login = value; }  // äëÿ ïðèâÿçêè ê ïîëþ äëÿ ââîäà ëîãèíà
+        public string Password { get => password; set => password = value; }  // äëÿ ïðèâÿçêè ê ïîëþ äëÿ ââîäà ïàðîëÿ
+        public string Message { get => message; set => this.RaiseAndSetIfChanged(ref message, value); } // äëÿ ïðèâÿçêè ê ïîëþ äëÿ âûâîäà ñîîáùåíèÿ, åñëè ïîëüçîâàòåëü íå áóäåò íàéäåí
+
+        
+    }
+}

+ 36 - 0
AvaloniaApplicationPersonalPage/ViewModels/MainWindowViewModel.cs

@@ -0,0 +1,36 @@
+using Avalonia.Controls;
+using AvaloniaApplicationPersonalPage.Models;
+using AvaloniaApplicationPersonalPage.Views;
+using ReactiveUI;
+using System.Linq;
+
+namespace AvaloniaApplicationPersonalPage.ViewModels
+{
+    public class MainWindowViewModel : ViewModelBase
+    {
+       public static UserBaseContext myConnection = new UserBaseContext(); // создаем объект для обращения к БД
+
+        UserControl uc = new AutoPage();  // для смены страниц, страница с авторизацией будет загружена по умолчанию
+        AutoPageViewModel autoPage = new AutoPageViewModel(); // для обращения к свойсвам, которые находятся на странице авторизации
+        PersonalPageViewModel personalPage; // для обращения к свойствам, которые находятся на стпранице личного кабинета (будет инициализировано позднее, в момент перехода на данную страницу)
+
+        public UserControl UC { get => uc; set => this.RaiseAndSetIfChanged(ref uc,value); } // свойство для обращения к полю для смены страниц
+        public AutoPageViewModel AutoPage { get => autoPage; set => autoPage = value; } // свойство для обращения к полю для обращения к странице авторизации
+        public PersonalPageViewModel PersonalPage { get => personalPage; set => personalPage = value; } // свойство для обращения к полю для обращения к странице личного кабинета
+
+        public void Auto() // метод для авторизации
+        {
+            // ищем в БД пользователя по введенному логину и паролю
+            LoginTable? currentUser = myConnection.LoginTables.FirstOrDefault(x => x.Login == AutoPage.Login && x.Password == AutoPage.Password);
+            if (currentUser == null)
+            {
+                AutoPage.Message = "Пользователь не найден";
+                return;
+            }
+            // если пользователь найден, то переходим на страницу личного кабинета
+            // в конструктор этой страницы передаем объект для обращения к БД и id найденного пользователя
+            personalPage = new PersonalPageViewModel(myConnection, currentUser.IdLogin);
+            UC = new PersonalPage();
+        }
+    }
+}

+ 67 - 0
AvaloniaApplicationPersonalPage/ViewModels/PersonalPageViewModel.cs

@@ -0,0 +1,67 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using AvaloniaApplicationPersonalPage.Models;
+using Microsoft.EntityFrameworkCore;
+using ReactiveUI;
+
+namespace AvaloniaApplicationPersonalPage.ViewModels
+{
+	public class PersonalPageViewModel : ReactiveObject
+	{
+        UserBaseContext myConnection; // поле для передаваемого объекта для обращения к БД
+        LoginTable? currentUser; // поле для заполнения данных о пользователе
+        string oldPassword; // для хранения пароля пользователя
+        bool isPasswordChange = false; // нужно ли показывать поля для изменения пароля (изначально они будут скрыты)
+
+        public PersonalPageViewModel(UserBaseContext myConnection, int id)
+        {
+            this.myConnection = myConnection; // заполнение поля для обращения к БД
+            // нахождение всей информации о пользователе по переданному id:
+            CurrentUser = myConnection.LoginTables.Include(x=>x.IdRoleNavigation).Include(x=>x.UserTable.IdGenderNavigation).FirstOrDefault(x => x.IdLogin == id);
+            oldPassword = currentUser.Password; // заполнение поля с паролем паролем найденного пользователя
+        }
+
+        public LoginTable? CurrentUser { get => currentUser; set => currentUser = value; } // свойсво для обращения к данным о пользователе в БД
+
+
+        // свойство для вывода даты на экран и перезаписи даты в БД, если пользователь ее изменит
+        public string DR
+        {
+            get => CurrentUser.UserTable.Date.ToString(); // считываем дату из БД
+            set => CurrentUser.UserTable.Date = DateTime.Parse(value); // изменяем поле даты в БД на выбранное пользователем значение
+        }
+        public List<string> Genders =>myConnection.GenderTables.Select(x=>x.Gender).ToList(); // свойство дял заполнения списка с возможными значениями полов
+
+
+        // свойство для вывода поля пользователя на экран и его изменения
+        public string SelectedGender
+        {
+            get => CurrentUser.UserTable.IdGenderNavigation.Gender; // считываем пол из БД
+            set => CurrentUser.UserTable.IdGender = myConnection.GenderTables.FirstOrDefault(x => x.Gender == value).IdGender; // изменяем поле с полом пользователя в таблице БД
+        }
+        public string Message { get => message; set => this.RaiseAndSetIfChanged(ref message,value); }  // для вывода сообщении об изменении сохранений
+        public string RepeatPassword { get => repeatPassword; set => repeatPassword = value; } // свойство, привязанное к полю для ввода повторения пароля
+        public bool IsPasswordChange { get => isPasswordChange; set => this.RaiseAndSetIfChanged(ref isPasswordChange,value); } // свойство, привязанное к флажку, показывающему (или не показывающему) панель для изменения пароля
+
+        string message; // поля для сообщения
+
+        string repeatPassword; // поля для повторения
+       
+
+        public void SaveData() // метод для сохранения изменений
+        {
+            if (CurrentUser.Password == null || CurrentUser.Password == "") CurrentUser.Password = oldPassword; // если поля для изменения пароля не заполнены, то в базе оставляем старый пароль
+            if (IsPasswordChange==(CurrentUser.Password == repeatPassword)) 
+            {
+            myConnection.SaveChanges();
+            Message = "Изменения сохранены";
+            }
+            else
+            {
+                Message = "Пароли не совпадают";
+            }
+            
+        }
+    }
+}

+ 8 - 0
AvaloniaApplicationPersonalPage/ViewModels/ViewModelBase.cs

@@ -0,0 +1,8 @@
+using ReactiveUI;
+
+namespace AvaloniaApplicationPersonalPage.ViewModels
+{
+    public class ViewModelBase : ReactiveObject
+    {
+    }
+}

+ 19 - 0
AvaloniaApplicationPersonalPage/Views/AutoPage.axaml

@@ -0,0 +1,19 @@
+<UserControl xmlns="https://github.com/avaloniaui"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+			 xmlns:vm="using:AvaloniaApplicationPersonalPage.ViewModels"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
+			 x:DataType="vm:MainWindowViewModel"
+             x:Class="AvaloniaApplicationPersonalPage.Views.AutoPage">
+	<Grid>
+		<StackPanel>
+			<TextBlock>Введите логин</TextBlock>
+			<TextBox Text="{Binding AutoPage.Login}"></TextBox>
+			<TextBlock>Введите пароль</TextBlock>
+			<TextBox PasswordChar="*" Text="{Binding AutoPage.Password}"></TextBox>
+			<TextBlock Text="{Binding AutoPage.Message}"></TextBlock>
+			<Button Command="{Binding Auto}">Авторизация</Button>
+		</StackPanel>
+	</Grid>
+</UserControl>

+ 13 - 0
AvaloniaApplicationPersonalPage/Views/AutoPage.axaml.cs

@@ -0,0 +1,13 @@
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Markup.Xaml;
+
+namespace AvaloniaApplicationPersonalPage.Views;
+
+public partial class AutoPage : UserControl
+{
+    public AutoPage()
+    {
+        InitializeComponent();
+    }
+}

+ 20 - 0
AvaloniaApplicationPersonalPage/Views/MainWindow.axaml

@@ -0,0 +1,20 @@
+<Window xmlns="https://github.com/avaloniaui"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        xmlns:vm="using:AvaloniaApplicationPersonalPage.ViewModels"
+        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+        mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
+        x:Class="AvaloniaApplicationPersonalPage.Views.MainWindow"
+        x:DataType="vm:MainWindowViewModel"
+        Icon="/Assets/avalonia-logo.ico"
+        Title="AvaloniaApplicationPersonalPage">
+
+    <Design.DataContext>
+        <!-- This only sets the DataContext for the previewer in an IDE,
+             to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
+        <vm:MainWindowViewModel/>
+    </Design.DataContext>
+
+	<ContentControl Content="{Binding UC}"></ContentControl>
+
+</Window>

+ 12 - 0
AvaloniaApplicationPersonalPage/Views/MainWindow.axaml.cs

@@ -0,0 +1,12 @@
+using Avalonia.Controls;
+
+namespace AvaloniaApplicationPersonalPage.Views
+{
+    public partial class MainWindow : Window
+    {
+        public MainWindow()
+        {
+            InitializeComponent();
+        }
+    }
+}

+ 30 - 0
AvaloniaApplicationPersonalPage/Views/PersonalPage.axaml

@@ -0,0 +1,30 @@
+<UserControl xmlns="https://github.com/avaloniaui"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+			 xmlns:vm="using:AvaloniaApplicationPersonalPage.ViewModels"
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
+			 x:DataType="vm:MainWindowViewModel"
+             x:Class="AvaloniaApplicationPersonalPage.Views.PersonalPage">
+	<Grid>
+		<StackPanel>
+			<TextBlock>Имя:</TextBlock>
+			<TextBox Text="{Binding PersonalPage.CurrentUser.UserTable.Name}"></TextBox>
+			<TextBlock>Логин:</TextBlock>
+			<TextBox Text="{Binding PersonalPage.CurrentUser.Login}"></TextBox>
+			<CheckBox IsChecked="{Binding PersonalPage.IsPasswordChange}">Изменить пароль?</CheckBox>
+			<StackPanel IsVisible="{Binding PersonalPage.IsPasswordChange}">
+				<TextBlock>Введите пароль</TextBlock>
+				<TextBox PasswordChar="*" Text="{Binding PersonalPage.CurrentUser.Password, Mode=OneWayToSource}"></TextBox>
+				<TextBlock>Подтвердите пароль</TextBlock>
+				<TextBox PasswordChar="*" Text="{Binding PersonalPage.RepeatPassword}"></TextBox>	
+			</StackPanel>	
+			<TextBlock>Дата:</TextBlock>
+			<DatePicker SelectedDate="{Binding PersonalPage.DR}"></DatePicker>
+			<TextBlock>Пол:</TextBlock>
+			<ComboBox ItemsSource="{Binding PersonalPage.Genders}" SelectedItem="{Binding PersonalPage.SelectedGender}"></ComboBox>
+			<Button Command="{Binding PersonalPage.SaveData}">Сохранить изменения</Button>
+			<TextBlock Text="{Binding PersonalPage.Message}"></TextBlock>
+		</StackPanel>
+	</Grid>
+</UserControl>

+ 13 - 0
AvaloniaApplicationPersonalPage/Views/PersonalPage.axaml.cs

@@ -0,0 +1,13 @@
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Markup.Xaml;
+
+namespace AvaloniaApplicationPersonalPage.Views;
+
+public partial class PersonalPage : UserControl
+{
+    public PersonalPage()
+    {
+        InitializeComponent();
+    }
+}

+ 18 - 0
AvaloniaApplicationPersonalPage/app.manifest

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
+  <!-- This manifest is used on Windows only.
+       Don't remove it as it might cause problems with window transparency and embeded controls.
+       For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
+  <assemblyIdentity version="1.0.0.0" name="AvaloniaApplicationPersonalPage.Desktop"/>
+
+  <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+    <application>
+      <!-- A list of the Windows versions that this application has been tested on
+           and is designed to work with. Uncomment the appropriate elements
+           and Windows will automatically select the most compatible environment. -->
+
+      <!-- Windows 10 -->
+      <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />
+    </application>
+  </compatibility>
+</assembly>