add password listing view

This commit is contained in:
2025-12-05 18:32:54 +03:00
parent c7f9fc0099
commit 200b155dbf
2 changed files with 34 additions and 0 deletions

View File

@@ -1,3 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using KeyKeeper.PasswordStore;
namespace KeyKeeper.ViewModels;
@@ -6,6 +9,16 @@ public class UnlockedRepositoryViewModel : ViewModelBase
{
private IPassStore passStore;
public IEnumerable<PassStoreEntryPassword> Passwords
{
get
{
return passStore.GetRootDirectory()
.Where(entry => entry is PassStoreEntryPassword)
.Select(entry => (entry as PassStoreEntryPassword)!);
}
}
public UnlockedRepositoryViewModel(IPassStore store)
{
passStore = store;

View File

@@ -49,6 +49,27 @@
HorizontalAlignment="Left"
Margin="0,20,0,0"/>
</StackPanel>
<ListBox Width="580"
Margin="210 10 10 10"
ItemsSource="{Binding Passwords}"
Background="Transparent">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Width="100" Margin="10" HorizontalAlignment="Center">
<Svg Path="/Assets/logo_en.svg" Width="48" Height="48"/>
<TextBlock Text="{Binding Name}"
HorizontalAlignment="Center"
Foreground="Black" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</DataTemplate>
<DataTemplate DataType="{x:Type vm:LockedRepositoryViewModel}">