From 354adb75daff8c8212bd409445eee7aeba6e5a48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B8=D0=BB=D0=B8=D0=BF=D0=B5=D0=BD=D0=BA=D0=BE=20?= =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B8=CC=86=20=D0=91=D0=BE=D1=80?= =?UTF-8?q?=D0=B8=D1=81=D0=BE=D0=B2=D0=B8=D1=87?= Date: Fri, 21 Nov 2025 19:54:28 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B0=20=D1=81?= =?UTF-8?q?=D0=BE=D0=B7=D0=B4=D0=B0=D0=BD=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.xaml.cs | 31 ++++++++++++++++++------------- AppShell.xaml | 6 ++---- AppShell.xaml.cs | 3 ++- MainPage.xaml | 10 +++++----- 4 files changed, 27 insertions(+), 23 deletions(-) diff --git a/App.xaml.cs b/App.xaml.cs index 46d1a1a..8e74d48 100644 --- a/App.xaml.cs +++ b/App.xaml.cs @@ -8,21 +8,26 @@ public partial class App : Application public App() { InitializeComponent(); - - var services = new ServiceCollection(); - ConfigureServices(services); - var serviceProvider = services.BuildServiceProvider(); - - MainPage = serviceProvider.GetService(); } - private void ConfigureServices(ServiceCollection services) + protected override Window CreateWindow(IActivationState? activationState) { - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); + // Создаем сервисы непосредственно в CreateWindow + var fileService = new FileSystemService(); + var panelManager = new PanelManager(); + var fileOperations = new FileOperations(); + var keyboardService = new KeyboardService(); + var pathHelper = new PathHelper(); + + var mainPage = new MainPage(fileService, panelManager, fileOperations, keyboardService, pathHelper); + var window = new Window(new AppShell(mainPage)); + + // Обработка закрытия окна + window.Destroying += (s, e) => + { + // keyboardService?.Dispose(); + }; + + return window; } } \ No newline at end of file diff --git a/AppShell.xaml b/AppShell.xaml index f4857ae..b2f0ef4 100644 --- a/AppShell.xaml +++ b/AppShell.xaml @@ -3,12 +3,10 @@ x:Class="CommanderApp.AppShell" xmlns="http://schemas.microsoft.com/dotnet/2021/maui" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" - xmlns:local="clr-namespace:CommanderApp" - Title="MAUI Comander"> + Title="MAUI Commander"> - diff --git a/AppShell.xaml.cs b/AppShell.xaml.cs index 64f0f20..87143a8 100644 --- a/AppShell.xaml.cs +++ b/AppShell.xaml.cs @@ -2,9 +2,10 @@ { public partial class AppShell : Shell { - public AppShell() + public AppShell(MainPage mainPage) { InitializeComponent(); + MainContent.Content = mainPage; } } } diff --git a/MainPage.xaml b/MainPage.xaml index 36ecfbe..3707378 100644 --- a/MainPage.xaml +++ b/MainPage.xaml @@ -1,8 +1,8 @@ - - + +