mirror of
https://github.com/KeyKeeperApp/KeyKeeper.git
synced 2026-04-19 02:56:28 +03:00
Fix/AccessException
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
x:Name="ThisWindow">
|
x:Name="ThisWindow">
|
||||||
|
|
||||||
<Grid ColumnDefinitions="1.5*, 2*">
|
<Grid ColumnDefinitions="1.5*, 2*">
|
||||||
<!-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (<28><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>) -->
|
<!-- Левая синяя панель (без логотипа и заголовка) -->
|
||||||
<Border Background="#2328C4" Grid.Column="0">
|
<Border Background="#2328C4" Grid.Column="0">
|
||||||
<StackPanel VerticalAlignment="Center" Margin="20">
|
<StackPanel VerticalAlignment="Center" Margin="20">
|
||||||
<TextBlock Text="Choose where to save your password database"
|
<TextBlock Text="Choose where to save your password database"
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
||||||
<!-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -->
|
<!-- Правая белая панель с формой -->
|
||||||
<StackPanel Grid.Column="1" Margin="30" VerticalAlignment="Center" Spacing="20">
|
<StackPanel Grid.Column="1" Margin="30" VerticalAlignment="Center" Spacing="20">
|
||||||
<TextBlock Text="File location"
|
<TextBlock Text="File location"
|
||||||
FontSize="22"
|
FontSize="22"
|
||||||
@@ -33,10 +33,9 @@
|
|||||||
|
|
||||||
<Grid ColumnDefinitions="*, Auto" RowDefinitions="Auto" ColumnSpacing="10">
|
<Grid ColumnDefinitions="*, Auto" RowDefinitions="Auto" ColumnSpacing="10">
|
||||||
<TextBox x:Name="FilePathTextBox"
|
<TextBox x:Name="FilePathTextBox"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Watermark="Select file path..."
|
Watermark="Select file path..."
|
||||||
Text="{Binding #ThisWindow.FilePath, Mode=TwoWay}"
|
Padding="10,8"/>
|
||||||
Padding="10,8"/>
|
|
||||||
<Button x:Name="BrowseButton"
|
<Button x:Name="BrowseButton"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Content="Browse..."
|
Content="Browse..."
|
||||||
@@ -45,13 +44,13 @@
|
|||||||
Click="BrowseButton_Click"/>
|
Click="BrowseButton_Click"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<!-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> -->
|
<!-- Предупреждение о существующем файле -->
|
||||||
<TextBlock x:Name="PathWarning"
|
<TextBlock x:Name="PathWarning"
|
||||||
FontSize="12"
|
FontSize="12"
|
||||||
Foreground="Orange"
|
Foreground="Orange"
|
||||||
Text=" " />
|
Text=" " />
|
||||||
|
|
||||||
<!-- <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> -->
|
<!-- Кнопки действий -->
|
||||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Spacing="10" Margin="0,20,0,0">
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Spacing="10" Margin="0,20,0,0">
|
||||||
<Button Content="Cancel"
|
<Button Content="Cancel"
|
||||||
Classes="secondaryButton"
|
Classes="secondaryButton"
|
||||||
|
|||||||
@@ -21,18 +21,25 @@ namespace KeyKeeper.Views
|
|||||||
FilePathTextBox.TextChanged += OnTextChanged;
|
FilePathTextBox.TextChanged += OnTextChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnTextChanged(object? sender, TextChangedEventArgs e)
|
private async void OnTextChanged(object? sender, TextChangedEventArgs e)
|
||||||
{
|
{
|
||||||
string path = FilePathTextBox.Text ?? "";
|
string path = FilePathTextBox.Text ?? "";
|
||||||
CreateButton.IsEnabled = !string.IsNullOrWhiteSpace(path);
|
CreateButton.IsEnabled = !string.IsNullOrWhiteSpace(path);
|
||||||
|
PathWarning.Text = "";
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(path) && File.Exists(path))
|
if (string.IsNullOrWhiteSpace(path))
|
||||||
|
return;
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
PathWarning.Text = "File already exists. It will be overwritten.";
|
var storageFile = await StorageProvider.TryGetFileFromPathAsync(path);
|
||||||
|
if (storageFile != null)
|
||||||
|
{
|
||||||
|
PathWarning.Text = "File already exists. It will be overwritten.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
catch
|
||||||
{
|
{
|
||||||
PathWarning.Text = "";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user