Исправление ошибок / второй этап

This commit is contained in:
Максим Егоров 2024-09-03 19:20:36 +04:00
parent 96d343bc3c
commit 1dda5914de
4 changed files with 12 additions and 6 deletions

View File

@ -1,4 +1,5 @@
namespace Sailboat 
namespace Sailboat
{ {
partial class FormBoatCollection partial class FormBoatCollection
{ {
@ -259,5 +260,6 @@
private ToolStripMenuItem LoadToolStripMenuItem; private ToolStripMenuItem LoadToolStripMenuItem;
private OpenFileDialog openFileDialog; private OpenFileDialog openFileDialog;
private SaveFileDialog saveFileDialog; private SaveFileDialog saveFileDialog;
private EventHandler buttonRemoveBoat_Click;
} }
} }

View File

@ -7,7 +7,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using Microsoft.Extensions.Logging;
using Sailboat.DrawingObjects; using Sailboat.DrawingObjects;
using Sailboat.Exceptions; using Sailboat.Exceptions;
using Sailboat.Generics; using Sailboat.Generics;

View File

@ -1,4 +1,5 @@
using System; using System;
using Microsoft.Extensions.DependencyInjection;
namespace Sailboat namespace Sailboat
{ {
@ -15,15 +16,16 @@ namespace Sailboat
ApplicationConfiguration.Initialize(); ApplicationConfiguration.Initialize();
var services = new ServiceCollection(); var services = new ServiceCollection();
ConfigureServices(services); ConfigureServices(services);
using (ServiceProvider serviceProvider = services.BuildServiceProvider()) ServiceProvider serviceProvider = services.BuildServiceProvider();
{ {
Application.Run(serviceProvider.GetRequiredService<FormBoatCollection>()); Application.Run(serviceProvider.GetRequiredService<FormBoatCollection>());
} }
} }
private static void ConfigureServices(ServiceCollection services) private static void ConfigureServices(ServiceCollection services)
{ {
services.AddSingleton<FormBoatCollection>().AddLogging(option => object value = services.AddSingleton<FormBoatCollection>().AddLogging(option =>
{ {
string[] path = Directory.GetCurrentDirectory().Split('\\'); string[] path = Directory.GetCurrentDirectory().Split('\\');
string pathNeed = ""; string pathNeed = "";
@ -37,6 +39,7 @@ namespace Sailboat
option.SetMinimumLevel(LogLevel.Information); option.SetMinimumLevel(LogLevel.Information);
option.AddSerilog(logger); option.AddSerilog(logger);
}); });
} }
} }
} }

View File

@ -9,6 +9,7 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" /> <PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
</ItemGroup> </ItemGroup>