From 7aa7e6b2b10f464c2d62a8eaa17db5cfc65556c5 Mon Sep 17 00:00:00 2001
From: 328p <328p@BTK.MAIN>
Date: Fri, 20 Nov 2026 15:41:46 +0300
Subject: [PATCH] Fix task-20.11 folder
---
task-20.11 | 1 -
task-20.11/.gitignore | 34 ++++++
.../.idea/.idea.DemoCats/.idea/.gitignore | 15 +++
task-20.11/.idea/.idea.DemoCats/.idea/.name | 1 +
.../.idea.DemoCats/.idea/indexLayout.xml | 8 ++
task-20.11/.idea/.idea.DemoCats/.idea/vcs.xml | 6 ++
task-20.11/DemoCats.sln | 16 +++
task-20.11/DemoCats/App.axaml | 10 ++
task-20.11/DemoCats/App.axaml.cs | 23 ++++
task-20.11/DemoCats/DemoCats.csproj | 20 ++++
task-20.11/DemoCats/MainWindow.axaml | 19 ++++
task-20.11/DemoCats/MainWindow.axaml.cs | 44 ++++++++
task-20.11/DemoCats/Program.cs | 24 +++++
task-20.11/DemoCats/Users.cs | 15 +++
task-20.11/DemoCats/UsersWindow.axaml | 41 +++++++
task-20.11/DemoCats/UsersWindow.axaml.cs | 102 ++++++++++++++++++
task-20.11/DemoCats/app.manifest | 18 ++++
17 files changed, 396 insertions(+), 1 deletion(-)
delete mode 160000 task-20.11
create mode 100644 task-20.11/.gitignore
create mode 100644 task-20.11/.idea/.idea.DemoCats/.idea/.gitignore
create mode 100644 task-20.11/.idea/.idea.DemoCats/.idea/.name
create mode 100644 task-20.11/.idea/.idea.DemoCats/.idea/indexLayout.xml
create mode 100644 task-20.11/.idea/.idea.DemoCats/.idea/vcs.xml
create mode 100644 task-20.11/DemoCats.sln
create mode 100644 task-20.11/DemoCats/App.axaml
create mode 100644 task-20.11/DemoCats/App.axaml.cs
create mode 100644 task-20.11/DemoCats/DemoCats.csproj
create mode 100644 task-20.11/DemoCats/MainWindow.axaml
create mode 100644 task-20.11/DemoCats/MainWindow.axaml.cs
create mode 100644 task-20.11/DemoCats/Program.cs
create mode 100644 task-20.11/DemoCats/Users.cs
create mode 100644 task-20.11/DemoCats/UsersWindow.axaml
create mode 100644 task-20.11/DemoCats/UsersWindow.axaml.cs
create mode 100644 task-20.11/DemoCats/app.manifest
diff --git a/task-20.11 b/task-20.11
deleted file mode 160000
index 9c3e04c..0000000
--- a/task-20.11
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 9c3e04c2e947743674619842f9e68d5359908cf4
diff --git a/task-20.11/.gitignore b/task-20.11/.gitignore
new file mode 100644
index 0000000..9998c3d
--- /dev/null
+++ b/task-20.11/.gitignore
@@ -0,0 +1,34 @@
+# Common IntelliJ Platform excludes
+
+# User specific
+**/.idea/**/workspace.xml
+**/.idea/**/tasks.xml
+**/.idea/shelf/*
+**/.idea/dictionaries
+**/.idea/httpRequests/
+
+# Sensitive or high-churn files
+**/.idea/**/dataSources/
+**/.idea/**/dataSources.ids
+**/.idea/**/dataSources.xml
+**/.idea/**/dataSources.local.xml
+**/.idea/**/sqlDataSources.xml
+**/.idea/**/dynamic.xml
+
+# Rider
+# Rider auto-generates .iml files, and contentModel.xml
+**/.idea/**/*.iml
+**/.idea/**/contentModel.xml
+**/.idea/**/modules.xml
+
+*.suo
+*.user
+.vs/
+[Bb]in/
+[Oo]bj/
+_UpgradeReport_Files/
+[Pp]ackages/
+
+Thumbs.db
+Desktop.ini
+.DS_Store
diff --git a/task-20.11/.idea/.idea.DemoCats/.idea/.gitignore b/task-20.11/.idea/.idea.DemoCats/.idea/.gitignore
new file mode 100644
index 0000000..7cc1698
--- /dev/null
+++ b/task-20.11/.idea/.idea.DemoCats/.idea/.gitignore
@@ -0,0 +1,15 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Rider ignored files
+/modules.xml
+/contentModel.xml
+/projectSettingsUpdater.xml
+/.idea.DemoCats.iml
+# Ignored default folder with query files
+/queries/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/task-20.11/.idea/.idea.DemoCats/.idea/.name b/task-20.11/.idea/.idea.DemoCats/.idea/.name
new file mode 100644
index 0000000..fec5a6e
--- /dev/null
+++ b/task-20.11/.idea/.idea.DemoCats/.idea/.name
@@ -0,0 +1 @@
+DemoCats
\ No newline at end of file
diff --git a/task-20.11/.idea/.idea.DemoCats/.idea/indexLayout.xml b/task-20.11/.idea/.idea.DemoCats/.idea/indexLayout.xml
new file mode 100644
index 0000000..7b08163
--- /dev/null
+++ b/task-20.11/.idea/.idea.DemoCats/.idea/indexLayout.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/task-20.11/.idea/.idea.DemoCats/.idea/vcs.xml b/task-20.11/.idea/.idea.DemoCats/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/task-20.11/.idea/.idea.DemoCats/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/task-20.11/DemoCats.sln b/task-20.11/DemoCats.sln
new file mode 100644
index 0000000..8b8b3fd
--- /dev/null
+++ b/task-20.11/DemoCats.sln
@@ -0,0 +1,16 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DemoCats", "DemoCats\DemoCats.csproj", "{EE2D0DF2-EA86-45FB-9F87-F0EC0B53FAC7}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {EE2D0DF2-EA86-45FB-9F87-F0EC0B53FAC7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {EE2D0DF2-EA86-45FB-9F87-F0EC0B53FAC7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {EE2D0DF2-EA86-45FB-9F87-F0EC0B53FAC7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {EE2D0DF2-EA86-45FB-9F87-F0EC0B53FAC7}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+EndGlobal
diff --git a/task-20.11/DemoCats/App.axaml b/task-20.11/DemoCats/App.axaml
new file mode 100644
index 0000000..aa53992
--- /dev/null
+++ b/task-20.11/DemoCats/App.axaml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/task-20.11/DemoCats/App.axaml.cs b/task-20.11/DemoCats/App.axaml.cs
new file mode 100644
index 0000000..0561e18
--- /dev/null
+++ b/task-20.11/DemoCats/App.axaml.cs
@@ -0,0 +1,23 @@
+using Avalonia;
+using Avalonia.Controls.ApplicationLifetimes;
+using Avalonia.Markup.Xaml;
+
+namespace DemoCats;
+
+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();
+ }
+
+ base.OnFrameworkInitializationCompleted();
+ }
+}
\ No newline at end of file
diff --git a/task-20.11/DemoCats/DemoCats.csproj b/task-20.11/DemoCats/DemoCats.csproj
new file mode 100644
index 0000000..eff8995
--- /dev/null
+++ b/task-20.11/DemoCats/DemoCats.csproj
@@ -0,0 +1,20 @@
+
+
+ WinExe
+ net10.0
+ enable
+ app.manifest
+ DemoCatas
+
+
+
+
+
+
+
+
+ None
+ All
+
+
+
diff --git a/task-20.11/DemoCats/MainWindow.axaml b/task-20.11/DemoCats/MainWindow.axaml
new file mode 100644
index 0000000..62d68a4
--- /dev/null
+++ b/task-20.11/DemoCats/MainWindow.axaml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/task-20.11/DemoCats/MainWindow.axaml.cs b/task-20.11/DemoCats/MainWindow.axaml.cs
new file mode 100644
index 0000000..44588c3
--- /dev/null
+++ b/task-20.11/DemoCats/MainWindow.axaml.cs
@@ -0,0 +1,44 @@
+using System.Linq;
+using Avalonia.Controls;
+using Avalonia.Interactivity;
+
+namespace DemoCats;
+
+public partial class MainWindow : Window
+{
+ public MainWindow()
+ {
+ InitializeComponent();
+ }
+
+ private void LoginButton_OnClick(object? sender, RoutedEventArgs e)
+ {
+ var email = LoginBox.Text;
+ var password = PasswordBox.Text;
+ if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(password))
+ {
+ Error.Text = "Пароль или логин пустые";
+ return;
+ }
+ var user = Users._users.FirstOrDefault(i => i.Email == email);
+ if (user == null)
+ {
+ Error.Text = "Пользователь не найден";
+ return;
+ }
+
+ if (user.Password != password)
+ {
+ Error.Text = "Неправильный пароль";
+ return;
+ }
+ new UsersWindow(user).Show();
+ Close();
+ }
+
+ private void GuestButton_OnClick(object? sender, RoutedEventArgs e)
+ {
+ new UsersWindow(null).Show();
+
+ }
+}
\ No newline at end of file
diff --git a/task-20.11/DemoCats/Program.cs b/task-20.11/DemoCats/Program.cs
new file mode 100644
index 0000000..f7d3948
--- /dev/null
+++ b/task-20.11/DemoCats/Program.cs
@@ -0,0 +1,24 @@
+using Avalonia;
+using System;
+
+namespace DemoCats;
+
+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()
+ .UsePlatformDetect()
+#if DEBUG
+ .WithDeveloperTools()
+#endif
+ .WithInterFont()
+ .LogToTrace();
+}
\ No newline at end of file
diff --git a/task-20.11/DemoCats/Users.cs b/task-20.11/DemoCats/Users.cs
new file mode 100644
index 0000000..0903e21
--- /dev/null
+++ b/task-20.11/DemoCats/Users.cs
@@ -0,0 +1,15 @@
+using System.Collections.Generic;
+
+namespace DemoCats;
+
+public class Users
+{
+ public static List _users = [
+ new User(1, "Кошка Кошковна", "koshka@mur.ru", "meow123", "admin"),
+ new User(2, "Киса Мурлыковна", "kisa@meow.com", "purrfect99", "manager"),
+ new User(3, "Кот Матроскин", "matroskin@prostokvasha.ru", "milk_lover", "user"),
+ new User(4, "Мурка Цараповна", "murka@scratch.net", "fish_stealer", "user"),
+ new User(5, "Барсик Пушистович", "barsik@fluffy.org", "sleep_all_day", "user"),
+ new User(6, "Васька Сметанович", "vasya@sourcream.ru", "tasty_cream7", "admin")
+ ];
+}
\ No newline at end of file
diff --git a/task-20.11/DemoCats/UsersWindow.axaml b/task-20.11/DemoCats/UsersWindow.axaml
new file mode 100644
index 0000000..9c418ee
--- /dev/null
+++ b/task-20.11/DemoCats/UsersWindow.axaml
@@ -0,0 +1,41 @@
+
+
+
+
+
+ Без фильтрации
+ .com
+ .ru
+ .net
+ .org
+
+
+ Без сортировки
+ По убыванию
+ По возрастанию
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/task-20.11/DemoCats/UsersWindow.axaml.cs b/task-20.11/DemoCats/UsersWindow.axaml.cs
new file mode 100644
index 0000000..1b2397e
--- /dev/null
+++ b/task-20.11/DemoCats/UsersWindow.axaml.cs
@@ -0,0 +1,102 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using Avalonia;
+using Avalonia.Controls;
+using Avalonia.Markup.Xaml;
+
+namespace DemoCats;
+public record User(int Id, string Name, string Email, string Password, string Role);
+
+public partial class UsersWindow : Window
+{
+ // Наблюдаемая коллекция, которая автоматически уведомляет интерфейс (ListBox) при изменении элементов
+ private ObservableCollection UsersCollecction = new();
+ public UsersWindow(User? user)
+ {
+ InitializeComponent();
+ // Привязка коллекции UsersCollecction как источника данных для элемента списка UserListBox
+ UserListBox.ItemsSource = UsersCollecction;
+ ShowUsers();
+ switch (user?.Role)
+ {
+ case "admin":
+ {
+ UserProfile.Text = $"{user.Name} - Администратор";
+ break;
+ }
+ case "user":
+ {
+ UserProfile.Text = $"{user.Name} - Ползователь";
+ GuestOrUserView();
+ break;
+ }
+ case "manger":
+ {
+ UserProfile.Text = $"{user.Name} - Менеджер";
+ break;
+ }
+ default:
+ {
+ UserProfile.Text = $"Вы зашли как гость";
+ GuestOrUserView();
+ break;
+ }
+ }
+ }
+
+ // Метод, который делает неактивными фильтр, сортировку и поиск
+ private void GuestOrUserView()
+ {
+ FilterBox.IsEnabled = false;
+ SortBox.IsEnabled = false;
+ SearchBox.IsEnabled = false;
+ }
+ // Главный метод
+ private void ShowUsers()
+ {
+ IEnumerable users = Users._users;
+ var filterItem = FilterBox.SelectionBoxItem as string;
+ if (!string.IsNullOrWhiteSpace(filterItem) && filterItem != "Без фильтрации")
+ {
+ users = users.Where(u => u.Email.EndsWith(filterItem));
+ }
+
+ // Проверяем, введено ли что-то в строку поиска
+ var search = SearchBox.Text;
+ if (!string.IsNullOrWhiteSpace(search))
+ {
+ // Оставляем только тех, у кого в почте есть введенные буквы
+ users = users.Where(u => u.Email.Contains(search));
+ }
+
+ // Смотрим, какая выбрана сортировка, и меняем порядок пользователей по почте
+ var sort = SortBox.SelectionBoxItem as string;
+ switch (sort)
+ {
+ case "По возрастанию": users = users.OrderBy(u => u.Email); break;
+ case "По убыванию": users = users.OrderByDescending(u => u.Email); break;
+ }
+
+ // Очищаем старый список на экране
+ UsersCollecction.Clear();
+ // Заполняем экран новым, уже отфильтрованным списком
+ foreach (var user in users) UsersCollecction.Add(user);
+ }
+
+ private void FilterBox_OnSelectionChanged(object? sender, SelectionChangedEventArgs e)
+ {
+ ShowUsers();
+ }
+
+ private void SortBox_OnSelectionChanged(object? sender, SelectionChangedEventArgs e)
+ {
+ ShowUsers();
+ }
+
+ private void SearchBox_OnTextChanged(object? sender, TextChangedEventArgs e)
+ {
+ ShowUsers();
+ }
+}
\ No newline at end of file
diff --git a/task-20.11/DemoCats/app.manifest b/task-20.11/DemoCats/app.manifest
new file mode 100644
index 0000000..de78996
--- /dev/null
+++ b/task-20.11/DemoCats/app.manifest
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+