Made a MainWindow by design, added an icon

This commit is contained in:
InspectorIT
2025-11-30 20:09:39 +03:00
parent 39bd449d6a
commit 63e5c30c88
2 changed files with 122 additions and 67 deletions

View File

@@ -24,5 +24,7 @@
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets> <PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
</PackageReference> </PackageReference>
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.1" /> <PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.1" />
<PackageReference Include="Svg.Controls.Skia.Avalonia" Version="11.3.6" />
<PackageReference Include="Svg.Skia" Version="3.2.1" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@@ -8,87 +8,140 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="KeyKeeper.Views.MainWindow" x:Class="KeyKeeper.Views.MainWindow"
x:DataType="vm:MainWindowViewModel" x:DataType="vm:MainWindowViewModel"
Icon="/Assets/avalonia-logo.ico" Icon="/Assets/icon.ico"
Title="KeyKeeper"> Title="KeyKeeper">
<Design.DataContext> <Design.DataContext>
<vm:MainWindowViewModel/> <vm:MainWindowViewModel/>
</Design.DataContext> </Design.DataContext>
<Grid> <Grid ColumnDefinitions="1.3*, 3*">
<TextBlock Text="{Binding Greeting}"
HorizontalAlignment="Center"
VerticalAlignment="Center"/>
<StackPanel HorizontalAlignment="Left" VerticalAlignment="Top" Margin="20">
<Button Content="Настройки"
Command="{Binding OpenSettingsCommand}"
Width="100"
Height="30"/>
</StackPanel>
<Grid Margin="20">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" <!-- LEFT BLUE PANEL -->
Text="KeyKeeper" <Border Background="#2328C4" Grid.Column="0">
FontSize="24" <Grid RowDefinitions="Auto,*,Auto" Margin="30">
FontWeight="Bold"
HorizontalAlignment="Center"
Margin="0,0,0,30"/>
<StackPanel Grid.Row="1" <!-- LOGO -->
VerticalAlignment="Center" <StackPanel Spacing="10" Margin="0,20,0,40">
HorizontalAlignment="Center" <StackPanel Orientation="Horizontal" Spacing="15">
Spacing="15" <!-- ICON (простая замена — можно вставить PNG/SVG) -->
Width="300"> <Path Fill="White"
Data="M12 2L4 6V14L12 18L20 14V6L12 2Z"
Width="40" Height="40"/>
<StackPanel>
<TextBlock Text="KeyKeeper"
FontSize="30"
FontWeight="Bold"
Foreground="White"/>
<TextBlock Text="password manager"
FontSize="16"
Foreground="White"/>
</StackPanel>
</StackPanel>
</StackPanel>
<Button Content="Создать новое хранилище" <!-- BUTTONS -->
Click="CreateNewVault_Click" <StackPanel Grid.Row="1" Spacing="25" VerticalAlignment="Top">
Height="40" <Button Content="New Database"
FontSize="14"/> HorizontalAlignment="Left"
Width="200"
Height="40"
Background="White"
Foreground="#2328C4"
Click="CreateNewVault_Click"/>
<Button Content="Открыть существующее хранилище" <Button Content="Open Database"
Click="OpenExistingVault_Click" HorizontalAlignment="Left"
Height="40" Width="200"
FontSize="14"/> Height="40"
Background="White"
Foreground="#2328C4"
Click="OpenExistingVault_Click"/>
</StackPanel>
<Border Height="1" Margin="0,10" Background="Transparent"> <!-- FOOTER ICONS -->
<Grid> <StackPanel Grid.Row="2" Orientation="Horizontal" Spacing="25">
<Rectangle Height="1" <!-- SETTINGS ICON -->
Fill="LightGray" <Path Data="M12 8A4 4 0 1 0 12 16A4 4 0 1 0 12 8Z"
HorizontalAlignment="Left" Fill="White" Width="28" Height="28"/>
Width="65"/> <!-- INFO ICON -->
<Rectangle Height="1" <Ellipse Width="28" Height="28" Stroke="White" StrokeThickness="2">
Fill="LightGray" <Ellipse.OpacityMask>
HorizontalAlignment="Right" <VisualBrush>
Width="65"/> <VisualBrush.Visual>
</Grid> <TextBlock Text="i"
</Border> HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="20" Foreground="White"/>
</VisualBrush.Visual>
</VisualBrush>
</Ellipse.OpacityMask>
</Ellipse>
</StackPanel>
<TextBlock Text="Недавно открытые:" </Grid>
FontWeight="SemiBold" </Border>
Margin="0,0,0,5"/>
<ListBox x:Name="RecentVaultsList"
Height="120"
Background="Transparent"
BorderThickness="1"
BorderBrush="LightGray"
ItemsSource="{Binding RecentFiles}">
<ListBox.ItemTemplate>
<DataTemplate x:DataType="m:RecentFile">
<TextBlock Text="{Binding DisplayPath}"
Margin="5"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel> <!-- RIGHT CONTENT -->
<Grid Grid.Column="1" VerticalAlignment="Center">
<Grid RowDefinitions="Auto,Auto">
<!-- Заголовок строго над таблицей -->
<TextBlock Text="Recent Database"
FontSize="38"
Foreground="#2328C4"
FontWeight="SemiBold"
HorizontalAlignment="Center"
Margin="0,40,0,30"/>
<!-- Таблица из 4 линий -->
<Border Grid.Row="1"
Width="700"
Height="260"
HorizontalAlignment="Center"
BorderBrush="#D0D0D0"
BorderThickness="1"
CornerRadius="4"
Padding="25">
<Grid RowDefinitions="Auto,*,*,*,*">
<!-- Текст сверху -->
<TextBlock Text="There is no data yet..."
FontSize="20"
Foreground="#777"
Margin="0,0,0,0"/>
<!-- Линия 1 -->
<Rectangle Grid.Row="1"
Height="1"
Fill="#D0D0D0"
VerticalAlignment="Center"/>
<!-- Линия 2 -->
<Rectangle Grid.Row="2"
Height="1"
Fill="#D0D0D0"
VerticalAlignment="Center"/>
<!-- Линия 3 -->
<Rectangle Grid.Row="3"
Height="1"
Fill="#D0D0D0"
VerticalAlignment="Center"/>
<!-- Линия 4 -->
<Rectangle Grid.Row="4"
Height="1"
Fill="#D0D0D0"
VerticalAlignment="Center"/>
</Grid>
</Border>
</Grid>
</Grid>
</Grid> </Grid>
</Grid>
</Window> </Window>