Prechádzať zdrojové kódy

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

flytogo 2 mesiacov pred
rodič
commit
9fc8bba2de

+ 25 - 0
AvaloniaApplication2.sln

@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.11.35303.130
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AvaloniaApplication2", "AvaloniaApplication2\AvaloniaApplication2.csproj", "{75BAADD7-B408-45A9-9BEB-1292E3142EA4}"
+EndProject
+Global
+	GlobalSection(SolutionConfigurationPlatforms) = preSolution
+		Debug|Any CPU = Debug|Any CPU
+		Release|Any CPU = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(ProjectConfigurationPlatforms) = postSolution
+		{75BAADD7-B408-45A9-9BEB-1292E3142EA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{75BAADD7-B408-45A9-9BEB-1292E3142EA4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{75BAADD7-B408-45A9-9BEB-1292E3142EA4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{75BAADD7-B408-45A9-9BEB-1292E3142EA4}.Release|Any CPU.Build.0 = Release|Any CPU
+	EndGlobalSection
+	GlobalSection(SolutionProperties) = preSolution
+		HideSolutionNode = FALSE
+	EndGlobalSection
+	GlobalSection(ExtensibilityGlobals) = postSolution
+		SolutionGuid = {108C9CAF-7AF1-4C5E-B78E-DC4891C33016}
+	EndGlobalSection
+EndGlobal

+ 15 - 0
AvaloniaApplication2/App.axaml

@@ -0,0 +1,15 @@
+<Application xmlns="https://github.com/avaloniaui"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             x:Class="AvaloniaApplication2.App"
+             xmlns:local="using:AvaloniaApplication2"
+             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>

+ 34 - 0
AvaloniaApplication2/App.axaml.cs

@@ -0,0 +1,34 @@
+using Avalonia;
+using Avalonia.Controls.ApplicationLifetimes;
+using Avalonia.Data.Core;
+using Avalonia.Data.Core.Plugins;
+using Avalonia.Markup.Xaml;
+using AvaloniaApplication2.ViewModels;
+using AvaloniaApplication2.Views;
+
+namespace AvaloniaApplication2
+{
+    public partial class App : Application
+    {
+        public override void Initialize()
+        {
+            AvaloniaXamlLoader.Load(this);
+        }
+
+        public override void OnFrameworkInitializationCompleted()
+        {
+            if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
+            {
+                // Line below is needed to remove Avalonia data validation.
+                // Without this line you will get duplicate validations from both Avalonia and CT
+                BindingPlugins.DataValidators.RemoveAt(0);
+                desktop.MainWindow = new MainWindow
+                {
+                    DataContext = new MainWindowViewModel(),
+                };
+            }
+
+            base.OnFrameworkInitializationCompleted();
+        }
+    }
+}

BIN
AvaloniaApplication2/Assets/avalonia-logo.ico


+ 35 - 0
AvaloniaApplication2/AvaloniaApplication2.csproj

@@ -0,0 +1,35 @@
+<Project Sdk="Microsoft.NET.Sdk">
+  <PropertyGroup>
+    <OutputType>WinExe</OutputType>
+    <TargetFramework>net8.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.1.0" />
+    <PackageReference Include="Avalonia.Desktop" Version="11.1.0" />
+    <PackageReference Include="Avalonia.Themes.Fluent" Version="11.1.0" />
+    <PackageReference Include="Avalonia.Fonts.Inter" Version="11.1.0" />
+    <!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
+    <PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.1.0" />
+    <PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.1" />
+    <PackageReference Include="Microsoft.EntityFrameworkCore" Version="7.0.18" />
+    <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.18">
+      <PrivateAssets>all</PrivateAssets>
+      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+    </PackageReference>
+    <PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="7.0.18">
+      <PrivateAssets>all</PrivateAssets>
+      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+    </PackageReference>
+    <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.18" />
+  </ItemGroup>
+</Project>

+ 13 - 0
AvaloniaApplication2/Models/Gender.cs

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

+ 19 - 0
AvaloniaApplication2/Models/Logined.cs

@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+
+namespace AvaloniaApplication2.Models;
+
+public partial class Logined
+{
+    public int Id { get; set; }
+
+    public string Login { get; set; } = null!;
+
+    public string Password { get; set; } = null!;
+
+    public int IdRole { get; set; }
+
+    public virtual Role IdRoleNavigation { get; set; } = null!;
+
+    public virtual User? User { get; set; }
+}

+ 13 - 0
AvaloniaApplication2/Models/Role.cs

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

+ 108 - 0
AvaloniaApplication2/Models/TestBase41pContext.cs

@@ -0,0 +1,108 @@
+using System;
+using System.Collections.Generic;
+using Microsoft.EntityFrameworkCore;
+
+namespace AvaloniaApplication2.Models;
+
+public partial class TestBase41pContext : DbContext
+{
+    public TestBase41pContext()
+    {
+    }
+
+    public TestBase41pContext(DbContextOptions<TestBase41pContext> options)
+        : base(options)
+    {
+    }
+
+    public virtual DbSet<Gender> Genders { get; set; }
+
+    public virtual DbSet<Logined> Logineds { get; set; }
+
+    public virtual DbSet<Role> Roles { get; set; }
+
+    public virtual DbSet<User> Users { 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=localhost;Port=5432;Database=test_base_41P;Username=postgres;Password=postgres");
+
+    protected override void OnModelCreating(ModelBuilder modelBuilder)
+    {
+        modelBuilder.Entity<Gender>(entity =>
+        {
+            entity.HasKey(e => e.IdGender).HasName("genders_pk");
+
+            entity.ToTable("genders");
+
+            entity.Property(e => e.IdGender).HasColumnName("id_gender");
+            entity.Property(e => e.Gender1)
+                .HasColumnType("character varying")
+                .HasColumnName("gender");
+        });
+
+        modelBuilder.Entity<Logined>(entity =>
+        {
+            entity.HasKey(e => e.Id).HasName("logined_pk");
+
+            entity.ToTable("logined");
+
+            entity.Property(e => e.Id).HasColumnName("id");
+            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.Logineds)
+                .HasForeignKey(d => d.IdRole)
+                .OnDelete(DeleteBehavior.Restrict)
+                .HasConstraintName("logined_roles_fk");
+        });
+
+        modelBuilder.Entity<Role>(entity =>
+        {
+            entity.HasKey(e => e.IdRole).HasName("roles_pk");
+
+            entity.ToTable("roles");
+
+            entity.Property(e => e.IdRole).HasColumnName("id_role");
+            entity.Property(e => e.RoleName)
+                .HasColumnType("character varying")
+                .HasColumnName("role_name");
+        });
+
+        modelBuilder.Entity<User>(entity =>
+        {
+            entity.HasKey(e => e.IdUser).HasName("users_pk");
+
+            entity.ToTable("users");
+
+            entity.Property(e => e.IdUser)
+                .ValueGeneratedNever()
+                .HasColumnName("id_user");
+            entity.Property(e => e.BirthDate)
+                .HasColumnType("timestamp without time zone")
+                .HasColumnName("birth_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.Users)
+                .HasForeignKey(d => d.IdGender)
+                .OnDelete(DeleteBehavior.ClientSetNull)
+                .HasConstraintName("users_genders_fk");
+
+            entity.HasOne(d => d.IdUserNavigation).WithOne(p => p.User)
+                .HasForeignKey<User>(d => d.IdUser)
+                .HasConstraintName("users_logined_fk");
+        });
+
+        OnModelCreatingPartial(modelBuilder);
+    }
+
+    partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
+}

+ 19 - 0
AvaloniaApplication2/Models/User.cs

@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+
+namespace AvaloniaApplication2.Models;
+
+public partial class User
+{
+    public int IdUser { get; set; }
+
+    public string Name { get; set; } = null!;
+
+    public DateTime? BirthDate { get; set; }
+
+    public int IdGender { get; set; }
+
+    public virtual Gender IdGenderNavigation { get; set; } = null!;
+
+    public virtual Logined IdUserNavigation { get; set; } = null!;
+}

+ 22 - 0
AvaloniaApplication2/Program.cs

@@ -0,0 +1,22 @@
+using Avalonia;
+using System;
+
+namespace AvaloniaApplication2
+{
+    internal sealed 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();
+    }
+}

+ 34 - 0
AvaloniaApplication2/ViewLocator.cs

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

+ 68 - 0
AvaloniaApplication2/ViewModels/MainWindowViewModel.cs

@@ -0,0 +1,68 @@
+using Avalonia.Controls;
+using AvaloniaApplication2.Models;
+using CommunityToolkit.Mvvm.ComponentModel;
+using CommunityToolkit.Mvvm.Input;
+using Microsoft.EntityFrameworkCore;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+namespace AvaloniaApplication2.ViewModels
+{
+    public partial class MainWindowViewModel : ViewModelBase
+    {
+        TestBase41pContext db = new TestBase41pContext();
+
+        
+        
+        [ObservableProperty] string buttonText;
+        [ObservableProperty] string login;
+        [ObservableProperty] string password;
+        [ObservableProperty] string info;
+        [ObservableProperty] Logined? currentUser;
+        [ObservableProperty] List<Gender> gendersList;
+        
+        [ObservableProperty] UserControl page = new Page1();
+        
+        public MainWindowViewModel()
+        {
+            gendersList = db.Genders.ToList();
+        }
+       
+        public DateTimeOffset DateTimeOffset 
+        { 
+            get=>new DateTimeOffset((DateTime)currentUser.User.BirthDate,TimeSpan.Zero); 
+            set => currentUser.User.BirthDate = new DateTime(value.Year,value.Month,value.Day); 
+        }
+
+        public void GoBack() => Page = new Page1();
+
+        public void Save() => db.SaveChanges();
+
+
+        public void Enter()
+        {
+            currentUser = db.Logineds.Include(x=>x.User.IdGenderNavigation).FirstOrDefault(x=>x.Login == login && x.Password == password);
+            if (currentUser != null)
+            {
+                switch (CurrentUser.IdRole)
+                {
+                    case 1:
+                        Page = new PageStartAdmin(db.Users.Include(x=>x.IdUserNavigation.IdRoleNavigation).ToList());
+                        break;
+                    case 2:
+                        Page = new Page2();
+                        break;
+                }                   
+            }
+            else
+            {
+                Info = "Неверный логин или пароль";
+                Password = "";
+            }
+        }
+
+
+
+    }
+}

+ 61 - 0
AvaloniaApplication2/ViewModels/PageStartAdminViewModel.cs

@@ -0,0 +1,61 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Avalonia.Controls;
+using AvaloniaApplication2.Models;
+using CommunityToolkit.Mvvm.ComponentModel;
+using CommunityToolkit.Mvvm.Input;
+using Microsoft.EntityFrameworkCore;
+
+
+namespace AvaloniaApplication2.ViewModels
+{
+    partial class PageStartAdminViewModel:ViewModelBase
+    {
+        [ObservableProperty] List<User> users;
+        [ObservableProperty] List<User> users0;
+        [ObservableProperty] string textFind;
+        [ObservableProperty] List<Gender> genders;
+        [ObservableProperty] Gender filteredGender;
+      public PageStartAdminViewModel(List<User> users) 
+        {
+            this.users = users;
+            genders =
+            [
+                new Gender() { Gender1 = "Сбросить фильтр", IdGender = 0 },
+                .. users.Select(x => x.IdGenderNavigation).Distinct().OrderBy(x=>x.IdGender).ToList()
+            ];
+            
+            users0 = users;
+        }
+
+        partial void OnTextFindChanged(string value) => AllFilters();
+ 
+
+        public void DateSort(int idCB)
+        {
+            switch (idCB)
+            {
+                case 1:
+                    Users = Users.OrderBy(x=>x.BirthDate).ToList();
+                    break;
+                case 2:
+                    Users = Users.OrderByDescending(x => x.BirthDate).ToList();
+                    break;
+            }
+        }
+
+        partial void OnFilteredGenderChanged(Gender value) => AllFilters();
+
+
+        void AllFilters()
+        {
+            Users = Users0;
+            if (!string.IsNullOrEmpty(textFind)) Users = Users.Where(x => x.Name.Contains(textFind)).ToList();
+            if (filteredGender!=null && filteredGender.IdGender !=0) Users = Users.Where(x => x.IdGenderNavigation == filteredGender).ToList();
+        }
+
+    }
+}

+ 8 - 0
AvaloniaApplication2/ViewModels/ViewModelBase.cs

@@ -0,0 +1,8 @@
+using CommunityToolkit.Mvvm.ComponentModel;
+
+namespace AvaloniaApplication2.ViewModels
+{
+    public class ViewModelBase : ObservableObject
+    {
+    }
+}

+ 28 - 0
AvaloniaApplication2/Views/MainWindow.axaml

@@ -0,0 +1,28 @@
+<Window xmlns="https://github.com/avaloniaui"
+        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+        xmlns:vm="using:AvaloniaApplication2.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="AvaloniaApplication2.Views.MainWindow"
+        x:DataType="vm:MainWindowViewModel"
+        Icon="/Assets/avalonia-logo.ico"
+        Title="AvaloniaApplication2"
+		>
+
+    <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 Page}" />-->
+	<Grid ColumnDefinitions="200,*" RowDefinitions="50,*,50">
+		<TextBlock Text="Заголовок" Grid.ColumnSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center"/>
+		<TextBlock Text="Меню" Grid.Row="1" Grid.RowSpan="2" HorizontalAlignment="Center" VerticalAlignment="Center"/>
+		<TextBlock Text="Футер" Grid.Column="1" Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Center"/>
+		<ContentControl Content="{Binding Page}" Grid.Column="1" Grid.Row="1"/>
+	</Grid>
+	
+	
+
+</Window>

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

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

+ 17 - 0
AvaloniaApplication2/Views/Page1.axaml

@@ -0,0 +1,17 @@
+<UserControl xmlns="https://github.com/avaloniaui"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             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="AvaloniaApplication2.Page1"
+			 xmlns:vm="using:AvaloniaApplication2.ViewModels"
+			 x:DataType="vm:MainWindowViewModel">
+	<StackPanel VerticalAlignment="Center">
+		<TextBlock Text="Введите логин:"/> 
+		<TextBox Text="{Binding Login}" Watermark="Введите логин"/>
+		<TextBlock Text="Введите пароль:"/>
+		<TextBox Text="{Binding Password}" Watermark="Введите пароль" PasswordChar="☢"/>
+		<Button Content="Войти" Command="{Binding Enter}"/>
+		<TextBlock Text="{Binding Info}" Foreground="Red"/>
+	</StackPanel>
+</UserControl>

+ 13 - 0
AvaloniaApplication2/Views/Page1.axaml.cs

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

+ 25 - 0
AvaloniaApplication2/Views/Page2.axaml

@@ -0,0 +1,25 @@
+<UserControl xmlns="https://github.com/avaloniaui"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             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="AvaloniaApplication2.Page2"
+			  xmlns:vm="using:AvaloniaApplication2.ViewModels"
+			 x:DataType="vm:MainWindowViewModel">
+	<StackPanel>
+		<TextBox Text="{Binding CurrentUser.User.Name}"/>
+		<TextBox Text="{Binding CurrentUser.User.BirthDate}"/>		
+		<DatePicker SelectedDate="{Binding DateTimeOffset}"/>
+		
+		<ComboBox ItemsSource="{Binding GendersList}" SelectedItem="{Binding CurrentUser.User.IdGenderNavigation}">
+			<ComboBox.ItemTemplate>
+				<DataTemplate>
+					<TextBlock Text="{Binding Gender1}"/>
+				</DataTemplate>
+			</ComboBox.ItemTemplate>
+		</ComboBox>
+		<Button Content="Сохранить изменения" Command="{Binding Save}"/>
+		<Button Content="Развойти обратно" Command="{Binding GoBack}"/>
+	</StackPanel>
+	
+</UserControl>

+ 13 - 0
AvaloniaApplication2/Views/Page2.axaml.cs

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

+ 40 - 0
AvaloniaApplication2/Views/PageStartAdmin.axaml

@@ -0,0 +1,40 @@
+<UserControl xmlns="https://github.com/avaloniaui"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             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="AvaloniaApplication2.PageStartAdmin"
+			 xmlns:vm="using:AvaloniaApplication2.ViewModels"
+			 x:DataType="vm:PageStartAdminViewModel">
+	<Grid RowDefinitions="70,*">		
+			<StackPanel Orientation="Horizontal" Grid.Row="0">
+				<TextBlock Text="Поиск:"/>
+				<TextBox Text="{Binding TextFind}" Watermark="Введите текст для поиска"/>
+				<TextBlock Text="Сортировка по дате рождения:"/>
+				<StackPanel>
+					<RadioButton Content="По возрастанию" Command="{Binding DateSort}" CommandParameter="1"/>
+					<RadioButton Content="По убыванию" Command="{Binding DateSort}" CommandParameter="2"/>
+				</StackPanel>
+				<TextBlock Text="Фильтр по полу"/>
+				<ComboBox ItemsSource="{Binding Genders}" SelectedItem="{Binding FilteredGender}">
+					<ComboBox.ItemTemplate>
+						<DataTemplate>
+							<TextBlock Text="{Binding Gender1}"/>
+						</DataTemplate>
+					</ComboBox.ItemTemplate>
+				</ComboBox>
+			</StackPanel>			
+			<ListBox ItemsSource="{Binding Users}" Grid.Row="1">
+				<ListBox.ItemTemplate>
+					<DataTemplate>
+						<StackPanel>
+							<TextBlock Text="{Binding Name, StringFormat=Имя: {0}}"/>
+							<TextBlock Text="{Binding BirthDate,StringFormat=Дата рождения: {0:dd/MM/yyyy}}"/>
+							<TextBlock Text="{Binding IdGenderNavigation.Gender1, StringFormat=Пол: {0}}"/>
+							<TextBlock Text="{Binding IdUserNavigation.IdRoleNavigation.RoleName, StringFormat=Роль в системе: {0}}"/>
+						</StackPanel>
+					</DataTemplate>
+				</ListBox.ItemTemplate>
+			</ListBox>		
+	</Grid>		
+</UserControl>

+ 17 - 0
AvaloniaApplication2/Views/PageStartAdmin.axaml.cs

@@ -0,0 +1,17 @@
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Markup.Xaml;
+using AvaloniaApplication2.Models;
+using AvaloniaApplication2.ViewModels;
+using System.Collections.Generic;
+
+namespace AvaloniaApplication2;
+
+public partial class PageStartAdmin : UserControl
+{
+    public PageStartAdmin(List<User> users)
+    {
+        InitializeComponent();
+        DataContext = new PageStartAdminViewModel(users);
+    }
+}

+ 18 - 0
AvaloniaApplication2/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 embedded controls.
+       For more details visit https://learn.microsoft.com/en-us/windows/win32/sbscs/application-manifests -->
+  <assemblyIdentity version="1.0.0.0" name="AvaloniaApplication2.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>