wip 7
This commit is contained in:
parent
eb08ae12c6
commit
e22da57340
@ -83,8 +83,12 @@ public abstract class AbstractCompany
|
|||||||
SetObjectsPosition();
|
SetObjectsPosition();
|
||||||
for (int i = 0; i < (_collection?.Count ?? 0); ++i)
|
for (int i = 0; i < (_collection?.Count ?? 0); ++i)
|
||||||
{
|
{
|
||||||
DrawningTrackedVehicle? obj = _collection?.Get(i);
|
try
|
||||||
obj?.DrawTransport(graphics);
|
{
|
||||||
|
DrawningTrackedVehicle? obj = _collection?.Get(i);
|
||||||
|
obj?.DrawTransport(graphics);
|
||||||
|
}
|
||||||
|
catch (Exception) { }
|
||||||
}
|
}
|
||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
|
@ -47,7 +47,6 @@ public interface ICollectionGenericObjects<T>
|
|||||||
/// Получение типа коллекции
|
/// Получение типа коллекции
|
||||||
/// </summary>
|
/// </summary>
|
||||||
CollectionType GetCollectionType { get; }
|
CollectionType GetCollectionType { get; }
|
||||||
int SetMaxCount { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Получение объектов коллекции по одному
|
/// Получение объектов коллекции по одному
|
||||||
|
@ -47,11 +47,12 @@ public class TrackedVehicleSharingService : AbstractCompany
|
|||||||
int curHeight = 0;
|
int curHeight = 0;
|
||||||
for (int i = 0; i < (_collection?.Count ?? 0); i++)
|
for (int i = 0; i < (_collection?.Count ?? 0); i++)
|
||||||
{
|
{
|
||||||
if (_collection.Get(i) != null)
|
try
|
||||||
{
|
{
|
||||||
_collection.Get(i).SetPictureSize(_pictureWidth, _pictureHeight);
|
_collection?.Get(i)?.SetPictureSize(_pictureWidth, _pictureHeight);
|
||||||
_collection.Get(i).SetPosition(_placeSizeWidth * curWidth + 45, curHeight * _placeSizeHeight + 30);
|
_collection?.Get(i)?.SetPosition(_placeSizeWidth * curWidth+28, curHeight * _placeSizeHeight + 28);
|
||||||
}
|
}
|
||||||
|
catch (Exception) { }
|
||||||
if (curWidth > 0)
|
if (curWidth > 0)
|
||||||
curWidth--;
|
curWidth--;
|
||||||
else
|
else
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using System;
|
using Microsoft.Extensions.Logging;
|
||||||
|
using Serilog;
|
||||||
|
using Microsoft.Extensions.Configuration;
|
||||||
|
|
||||||
namespace lab1
|
namespace lab1
|
||||||
{
|
{
|
||||||
@ -27,14 +29,21 @@ namespace lab1
|
|||||||
/// <param name="services"></param>
|
/// <param name="services"></param>
|
||||||
private static void ConfigureServices(ServiceCollection services)
|
private static void ConfigureServices(ServiceCollection services)
|
||||||
{
|
{
|
||||||
|
string[] path = Directory.GetCurrentDirectory().Split('\\');
|
||||||
|
string pathNeed = "";
|
||||||
|
for (int i = 0; i < path.Length - 3; i++)
|
||||||
|
{
|
||||||
|
pathNeed += path[i] + "\\";
|
||||||
|
}
|
||||||
services.AddSingleton<FormTrackedVehicleCollection>()
|
services.AddSingleton<FormTrackedVehicleCollection>()
|
||||||
.AddLogging(option =>
|
.AddLogging(option =>
|
||||||
{
|
{
|
||||||
option.SetMinimumLevel(LogLevel.Information);
|
option.SetMinimumLevel(LogLevel.Information);
|
||||||
option.AddSerilog(new LoggerConfiguration()
|
option.AddSerilog(new LoggerConfiguration()
|
||||||
.WriteTo.File("log.txt")
|
.ReadFrom.Configuration(new ConfigurationBuilder()
|
||||||
.CreateLogger());
|
.AddJsonFile($"{pathNeed}serilog.json")
|
||||||
|
.Build())
|
||||||
|
.CreateLogger());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,14 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
|
||||||
|
<PackageReference Include="NLog.Extensions.Logging" Version="5.3.12" />
|
||||||
|
<PackageReference Include="Serilog" Version="4.0.1" />
|
||||||
|
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
|
||||||
|
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.2" />
|
||||||
|
<PackageReference Include="Serilog.Sinks.File" Version="6.0.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
15
solution/lab1/serilog.json
Normal file
15
solution/lab1/serilog.json
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"Serilog": {
|
||||||
|
"Using": [ "Serilog.Sinks.File" ],
|
||||||
|
"MinimumLevel": "Debug",
|
||||||
|
"WriteTo": [
|
||||||
|
{
|
||||||
|
"Name": "File",
|
||||||
|
"Args": { "path": "log.log" }
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"Properties": {
|
||||||
|
"Application": "Sample"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user