merge branch RepositoryWindow

This commit is contained in:
2025-12-01 14:49:54 +03:00
4 changed files with 77 additions and 10 deletions

View File

@@ -25,4 +25,10 @@
</PackageReference> </PackageReference>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.1" /> <PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.1" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<Compile Update="RepositoryWindow.axaml.cs">
<DependentUpon>RepositoryWindow.axaml</DependentUpon>
</Compile>
</ItemGroup>
</Project> </Project>

View File

@@ -0,0 +1,49 @@
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="KeyKeeper.RepositoryWindow"
Title="KeyKeeper - Хранилище паролей"
Width="800"
Height="600"
Background="White">
<Grid>
<!-- Синий левый край -->
<Border Width="200"
Background="Blue"
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"
Foreground="Black"
HorizontalAlignment="Left"/>
</StackPanel>
</Border>
<!-- Save Passwords -->
<Button Content="Save Passwords"
Width="120"
Height="30"
Foreground="White"
HorizontalAlignment="Left"
Margin="0,20,0,0"/>
</StackPanel>
</Grid>
</Window>

View File

@@ -0,0 +1,13 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
namespace KeyKeeper;
public partial class RepositoryWindow: Window
{
public RepositoryWindow()
{
InitializeComponent();
}
}

View File

@@ -38,8 +38,8 @@ namespace KeyKeeper.Views
{ {
if (file.TryGetLocalPath() is string path) if (file.TryGetLocalPath() is string path)
{ {
ShowMessage($"Создание нового хранилища: {path}");
(DataContext as MainWindowViewModel)!.CreateVault(path); (DataContext as MainWindowViewModel)!.CreateVault(path);
OpenRepositoryWindow();
} }
} }
} }
@@ -69,23 +69,22 @@ namespace KeyKeeper.Views
var file = files[0]; var file = files[0];
if (file.TryGetLocalPath() is string path) if (file.TryGetLocalPath() is string path)
{ {
ShowMessage($"Открытие хранилища: {path}");
(DataContext as MainWindowViewModel)!.OpenVault(path); (DataContext as MainWindowViewModel)!.OpenVault(path);
OpenRepositoryWindow();
} }
} }
} }
private void ShowMessage(string message) private void OpenRepositoryWindow()
{ {
// Временное решение для показа сообщений var repositoryWindow = new RepositoryWindow()
var messageBox = new Window
{ {
Title = "KeyKeeper", DataContext = this.DataContext,
Content = new TextBlock { Text = message, Margin = new Thickness(20) }, WindowStartupLocation = WindowStartupLocation.CenterScreen
SizeToContent = SizeToContent.WidthAndHeight,
WindowStartupLocation = WindowStartupLocation.CenterOwner
}; };
messageBox.ShowDialog(this); repositoryWindow.Closed += (s, e) => this.Show();
repositoryWindow.Show();
this.Hide();
} }
} }
} }