mirror of
https://github.com/KeyKeeperApp/KeyKeeper.git
synced 2026-05-01 20:36:32 +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.Interactivity;
|
||||||
using Avalonia.Platform.Storage;
|
using Avalonia.Platform.Storage;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
namespace KeyKeeper.Views
|
namespace KeyKeeper.Views
|
||||||
{
|
{
|
||||||
@@ -23,7 +24,7 @@ namespace KeyKeeper.Views
|
|||||||
ConfirmPasswordBox.TextChanged += OnPasswordTextChanged;
|
ConfirmPasswordBox.TextChanged += OnPasswordTextChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnTextChanged(object? sender, TextChangedEventArgs e)
|
private async void OnTextChanged(object? sender, TextChangedEventArgs e)
|
||||||
{
|
{
|
||||||
UpdateCreateButtonState();
|
UpdateCreateButtonState();
|
||||||
PathWarning.Text = "";
|
PathWarning.Text = "";
|
||||||
@@ -34,7 +35,7 @@ namespace KeyKeeper.Views
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var storageFile = StorageProvider.TryGetFileFromPathAsync(path).GetAwaiter().GetResult();
|
var storageFile = await StorageProvider.TryGetFileFromPathAsync(path);
|
||||||
if (storageFile != null)
|
if (storageFile != null)
|
||||||
{
|
{
|
||||||
PathWarning.Text = "File already exists. It will be overwritten.";
|
PathWarning.Text = "File already exists. It will be overwritten.";
|
||||||
|
|||||||
Reference in New Issue
Block a user