mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
27 lines
865 B
C#
27 lines
865 B
C#
using MediatR;
|
|
using ModernKeePass.Application.Common.Interfaces;
|
|
using ModernKeePass.Domain.Exceptions;
|
|
|
|
namespace ModernKeePass.Application.Parameters.Commands.SetMaxHistoryCount
|
|
{
|
|
public class SetMaxHistoryCountCommand : IRequest
|
|
{
|
|
public int MaxHistoryCount { get; set; }
|
|
|
|
public class SetMaxHistoryCountCommandHandler : IRequestHandler<SetMaxHistoryCountCommand>
|
|
{
|
|
private readonly IDatabaseProxy _database;
|
|
|
|
public SetMaxHistoryCountCommandHandler(IDatabaseProxy database)
|
|
{
|
|
_database = database;
|
|
}
|
|
|
|
public void Handle(SetMaxHistoryCountCommand message)
|
|
{
|
|
if (_database.IsOpen) _database.MaxHistoryCount = message.MaxHistoryCount;
|
|
else throw new DatabaseClosedException();
|
|
}
|
|
}
|
|
}
|
|
} |