Files
KeyKeeper/src/KeyKeeper/Views/RepositoryWindow.axaml
2026-03-01 19:49:07 +03:00

124 lines
6.2 KiB
XML

<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="using:KeyKeeper.ViewModels"
xmlns:i="using:Avalonia.Interactivity"
xmlns:kkp="using:KeyKeeper.Views"
x:Class="KeyKeeper.Views.RepositoryWindow"
Title="KeyKeeper - Password store"
CanResize="False"
Width="800"
Height="600"
Background="White"
x:DataType="vm:RepositoryWindowViewModel">
<Window.DataTemplates>
<DataTemplate DataType="{x:Type vm:UnlockedRepositoryViewModel}">
<Grid>
<!-- Синий левый край -->
<Border Width="200"
Background="#2328C4"
HorizontalAlignment="Left"
VerticalAlignment="Stretch"/>
<StackPanel Margin="20" HorizontalAlignment="Left">
<!-- Надпись KeyKeeper -->
<TextBlock Text="KeyKeeper"
FontSize="32"
FontWeight="Bold"
HorizontalAlignment="Left"
Margin="0,0,0,20"/>
<!-- Рамочка -->
<!-- <Border BorderBrush="Gray"
BorderThickness="1"
CornerRadius="5"
Padding="20"
Background="#F5F5F5"
HorizontalAlignment="Left">
<StackPanel HorizontalAlignment="Left">
<Button Content="All Passwords"
Width="120"
Height="30"
HorizontalAlignment="Left"/>
</StackPanel>
</Border> -->
<!-- Save Passwords -->
<Button Content="Save Passwords"
Classes="accentSidebarButton"
Click="SaveButton_Click"
Height="30"
HorizontalAlignment="Left"
Margin="0,20,0,0"/>
<Button Content="New Entry"
Classes="accentSidebarButton"
Click="AddEntryButton_Click"
Height="30"
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>
<Border Background="Transparent" DoubleTapped="Entry_DoubleTapped">
<StackPanel Width="100"
Margin="10"
HorizontalAlignment="Center">
<Svg Path="{Binding IconPath}" Width="48" Height="48"
/>
<TextBlock Text="{Binding Name}"
HorizontalAlignment="Center"
Foreground="Black" />
<TextBlock Text="{Binding Username.Value}"
Foreground="#666"
HorizontalAlignment="Center" />
</StackPanel>
<Border.ContextMenu>
<ContextMenu>
<MenuItem Name="entryCtxMenuCopyUsername" Header="Copy username" Click="EntryContextMenuItem_Click"/>
<MenuItem Name="entryCtxMenuCopyPassword" Header="Copy password" Click="EntryContextMenuItem_Click"/>
<MenuItem Name="entryCtxMenuDelete" Header="Delete" Click="EntryContextMenuItem_Click"/>
</ContextMenu>
</Border.ContextMenu>
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<kkp:ToastNotificationHost x:Name="NotificationHost" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="20" Duration="0:0:2" />
</Grid>
</DataTemplate>
<DataTemplate DataType="{x:Type vm:LockedRepositoryViewModel}">
<StackPanel Margin="20"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Spacing="10">
<TextBlock Text="Enter credentials to unlock"
Foreground="#2328C4"
FontSize="32" />
<TextBox x:Name="UnlockPasswordEdit"
Text="{Binding UnlockPassword, Mode=TwoWay}"
PasswordChar="*"
Width="450" />
<Button x:Name="UnlockButton"
Command="{Binding TryUnlock}"
HorizontalAlignment="Center"
Content="Unlock!" />
</StackPanel>
</DataTemplate>
</Window.DataTemplates>
<ContentControl Content="{Binding CurrentPage}"/>
</Window>