mirror of
https://github.com/wismna/ModernKeePass.git
synced 2025-10-03 15:40:18 -04:00
New Breadcrumb user control
New Breadcrumb service WIP icons and back button behavior
This commit is contained in:
@@ -86,6 +86,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Common\Behaviors\DirtyStatusBehavior.cs" />
|
||||
<Compile Include="Common\Interfaces\IBreadcrumbService.cs" />
|
||||
<Compile Include="Common\Interfaces\ICryptographyClient.cs" />
|
||||
<Compile Include="Common\Interfaces\IDatabaseSettingsProxy.cs" />
|
||||
<Compile Include="Common\Interfaces\IDatabaseProxy.cs" />
|
||||
@@ -99,6 +100,8 @@
|
||||
<Compile Include="Common\Interfaces\ISettingsProxy.cs" />
|
||||
<Compile Include="Common\Mappings\IMapFrom.cs" />
|
||||
<Compile Include="Common\Mappings\MappingProfile.cs" />
|
||||
<Compile Include="Common\Models\BreadcrumbItem.cs" />
|
||||
<Compile Include="Common\Services\BreadcrumbService.cs" />
|
||||
<Compile Include="Entry\Commands\AddAttachment\AddAttachmentCommand.cs" />
|
||||
<Compile Include="Entry\Commands\AddHistory\AddHistoryCommand.cs" />
|
||||
<Compile Include="Entry\Commands\DeleteAttachment\DeleteAttachmentCommand.cs" />
|
||||
|
@@ -0,0 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using ModernKeePass.Application.Common.Models;
|
||||
|
||||
namespace ModernKeePass.Application.Common.Interfaces
|
||||
{
|
||||
public interface IBreadcrumbService
|
||||
{
|
||||
void Push(BreadcrumbItem item);
|
||||
BreadcrumbItem Pop(int count = 1);
|
||||
IEnumerable<BreadcrumbItem> GetItems();
|
||||
}
|
||||
}
|
12
ModernKeePass.Application/Common/Models/BreadcrumbItem.cs
Normal file
12
ModernKeePass.Application/Common/Models/BreadcrumbItem.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using ModernKeePass.Domain.Enums;
|
||||
|
||||
namespace ModernKeePass.Application.Common.Models
|
||||
{
|
||||
public class BreadcrumbItem
|
||||
{
|
||||
public string Path { get; set; }
|
||||
public string Name { get; set; }
|
||||
public Icon Icon { get; set; }
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
using System.Collections.Generic;
|
||||
using ModernKeePass.Application.Common.Interfaces;
|
||||
using ModernKeePass.Application.Common.Models;
|
||||
|
||||
namespace ModernKeePass.Application.Common.Services
|
||||
{
|
||||
public class BreadcrumbService: IBreadcrumbService
|
||||
{
|
||||
private readonly Stack<BreadcrumbItem> _breadcrumb;
|
||||
|
||||
public BreadcrumbService()
|
||||
{
|
||||
_breadcrumb = new Stack<BreadcrumbItem>();
|
||||
}
|
||||
|
||||
public void Push(BreadcrumbItem item)
|
||||
{
|
||||
_breadcrumb.Push(item);
|
||||
}
|
||||
|
||||
public BreadcrumbItem Pop(int count = 1)
|
||||
{
|
||||
if (_breadcrumb.Count == 0) return null;
|
||||
for (var i = 1; i < count; i++)
|
||||
{
|
||||
_breadcrumb.Pop();
|
||||
}
|
||||
|
||||
return _breadcrumb.Pop();
|
||||
}
|
||||
|
||||
public IEnumerable<BreadcrumbItem> GetItems()
|
||||
{
|
||||
return _breadcrumb;
|
||||
}
|
||||
}
|
||||
}
|
@@ -2,6 +2,8 @@
|
||||
using MediatR;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using ModernKeePass.Application.Common.Behaviors;
|
||||
using ModernKeePass.Application.Common.Interfaces;
|
||||
using ModernKeePass.Application.Common.Services;
|
||||
|
||||
namespace ModernKeePass.Application
|
||||
{
|
||||
@@ -13,6 +15,7 @@ namespace ModernKeePass.Application
|
||||
services.AddMediatR(assembly);
|
||||
services.AddTransient(typeof(IPipelineBehavior<,>), typeof(DirtyStatusBehavior<,>));
|
||||
|
||||
services.AddSingleton(typeof(IBreadcrumbService), typeof(BreadcrumbService));
|
||||
return services;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user