Добавлен Studio
This commit is contained in:
17
Lattice.Core/Abstractions/INotificationService.cs
Normal file
17
Lattice.Core/Abstractions/INotificationService.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Lattice.Core.Models;
|
||||
using Lattice.Core.Models.Enums;
|
||||
|
||||
namespace Lattice.Core.Abstractions;
|
||||
|
||||
/// <summary>
|
||||
/// Описывает сервис для рассылки уведомлений внутри системы Lattice.
|
||||
/// </summary>
|
||||
public interface INotificationService
|
||||
{
|
||||
/// <summary>
|
||||
/// Событие, возникающее при отправке нового сообщения.
|
||||
/// </summary>
|
||||
event EventHandler<NotificationEventArgs> NotificationReceived;
|
||||
|
||||
void Show(string message, NotificationSeverity severity = NotificationSeverity.Info, int durationSeconds = 5);
|
||||
}
|
||||
@@ -1,28 +1,25 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<!-- Поддержка LTS версий и актуальной на 2026 год .NET 10 -->
|
||||
<TargetFrameworks>net8.0;net9.0;net10.0</TargetFrameworks>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<AssemblyName>Lattice.Core</AssemblyName>
|
||||
<RootNamespace>Lattice.Core</RootNamespace>
|
||||
|
||||
<!-- Метаданные разработчика -->
|
||||
<Authors>FrigaT</Authors>
|
||||
<Company>FrigaT</Company>
|
||||
<RepositoryUrl>https://git.frigat.duckdns.org/FrigaT/Lattice</RepositoryUrl>
|
||||
<PackageProjectUrl>https://git.frigat.duckdns.org/FrigaT/Lattice</PackageProjectUrl>
|
||||
<Description>Core docking and layout engine for Lattice UI (WinUI 3 / Uno Platform).</Description>
|
||||
|
||||
<!-- Совместимость с Uno Platform (Trimming и AOT) -->
|
||||
<IsTrimmable Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">true</IsTrimmable>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
|
||||
<PackageReference Include="System.Text.Json" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.1" />
|
||||
<PackageReference Include="System.Text.Json" Version="10.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -8,4 +8,4 @@ public enum DockDirection
|
||||
Top,
|
||||
Bottom,
|
||||
Floating,
|
||||
}
|
||||
}
|
||||
|
||||
8
Lattice.Core/Models/Enums/NotificationSeverity.cs
Normal file
8
Lattice.Core/Models/Enums/NotificationSeverity.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace Lattice.Core.Models.Enums;
|
||||
|
||||
public enum NotificationSeverity {
|
||||
Info,
|
||||
Success,
|
||||
Warning,
|
||||
Error,
|
||||
}
|
||||
5
Lattice.Core/Models/NotificationEventArgs.cs
Normal file
5
Lattice.Core/Models/NotificationEventArgs.cs
Normal file
@@ -0,0 +1,5 @@
|
||||
using Lattice.Core.Models.Enums;
|
||||
|
||||
namespace Lattice.Core.Models;
|
||||
|
||||
public record NotificationEventArgs(string Message, NotificationSeverity Severity, int DurationSeconds);
|
||||
@@ -1,11 +1,11 @@
|
||||
using Lattice.Core.Abstractions;
|
||||
|
||||
namespace Lattice.Core.Context;
|
||||
namespace Lattice.Core.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Реализация сервиса управления контекстом приложения.
|
||||
/// </summary>
|
||||
public class ContextManager : IContextService
|
||||
public class ContextService : IContextService
|
||||
{
|
||||
private string _currentContext = "Common";
|
||||
|
||||
@@ -6,12 +6,12 @@ using Microsoft.Extensions.Logging;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Lattice.Core.Engine;
|
||||
namespace Lattice.Core.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Реализация сервиса управления макетом.
|
||||
/// </summary>
|
||||
public class LayoutManager : ILayoutService
|
||||
public class LayoutService : ILayoutService
|
||||
{
|
||||
private readonly ILogger? _logger;
|
||||
private LayoutNode? _root;
|
||||
@@ -22,7 +22,7 @@ public class LayoutManager : ILayoutService
|
||||
/// <inheritdoc/>
|
||||
public event EventHandler? LayoutUpdated;
|
||||
|
||||
public LayoutManager(ILogger<LayoutManager>? logger = null)
|
||||
public LayoutService(ILogger<LayoutService>? logger = null)
|
||||
{
|
||||
_logger = logger;
|
||||
}
|
||||
19
Lattice.Core/Services/NotificationService.cs
Normal file
19
Lattice.Core/Services/NotificationService.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using Lattice.Core.Abstractions;
|
||||
using Lattice.Core.Models;
|
||||
using Lattice.Core.Models.Enums;
|
||||
|
||||
namespace Lattice.Core.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Простая реализация сервиса уведомлений.
|
||||
/// Хранит только событие и вызывает его при Show().
|
||||
/// </summary>
|
||||
public sealed class NotificationService : INotificationService
|
||||
{
|
||||
public event EventHandler<NotificationEventArgs>? NotificationReceived;
|
||||
|
||||
public void Show(string message, NotificationSeverity severity = NotificationSeverity.Info, int durationSeconds = 5)
|
||||
{
|
||||
NotificationReceived?.Invoke(this, new NotificationEventArgs(message, severity, durationSeconds));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user