mirror of
https://github.com/KeyKeeperApp/KeyKeeper.git
synced 2026-04-26 01:46:40 +03:00
make OnTextChanged async
for some reason before this change the program would stop responding if a non-existing path was chosen in the file picker. Maybe the .GetAwaiter().GetResult() trick does not work correctly with exceptions...
This commit is contained in:
@@ -3,6 +3,7 @@ using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Platform.Storage;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace KeyKeeper.Views
|
||||
{
|
||||
@@ -23,7 +24,7 @@ namespace KeyKeeper.Views
|
||||
ConfirmPasswordBox.TextChanged += OnPasswordTextChanged;
|
||||
}
|
||||
|
||||
private void OnTextChanged(object? sender, TextChangedEventArgs e)
|
||||
private async void OnTextChanged(object? sender, TextChangedEventArgs e)
|
||||
{
|
||||
UpdateCreateButtonState();
|
||||
PathWarning.Text = "";
|
||||
@@ -34,7 +35,7 @@ namespace KeyKeeper.Views
|
||||
|
||||
try
|
||||
{
|
||||
var storageFile = StorageProvider.TryGetFileFromPathAsync(path).GetAwaiter().GetResult();
|
||||
var storageFile = await StorageProvider.TryGetFileFromPathAsync(path);
|
||||
if (storageFile != null)
|
||||
{
|
||||
PathWarning.Text = "File already exists. It will be overwritten.";
|
||||
|
||||
Reference in New Issue
Block a user