From 626767469a550bfed046775e444eeefa3c833696 Mon Sep 17 00:00:00 2001 From: Alex Bezdieniezhnykh Date: Thu, 5 Dec 2024 00:34:00 +0200 Subject: [PATCH] fix keyboard event retrieving for dataset explorer --- Azaion.Dataset/DatasetExplorer.xaml.cs | 4 +--- Azaion.Suite/App.xaml.cs | 4 +--- Azaion.Suite/Login.xaml.cs | 2 ++ 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Azaion.Dataset/DatasetExplorer.xaml.cs b/Azaion.Dataset/DatasetExplorer.xaml.cs index ea24eb8..031f141 100644 --- a/Azaion.Dataset/DatasetExplorer.xaml.cs +++ b/Azaion.Dataset/DatasetExplorer.xaml.cs @@ -24,7 +24,6 @@ public partial class DatasetExplorer private int _tempSelectedClassIdx = 0; private readonly IGalleryManager _galleryManager; - private readonly FormState _formState; public bool ThumbnailLoading { get; set; } @@ -41,10 +40,10 @@ public partial class DatasetExplorer _annotationConfig = annotationConfig.Value; _logger = logger; _galleryManager = galleryManager; - _formState = formState; InitializeComponent(); Loaded += OnLoaded; + Activated += (_, _) => formState.ActiveWindow = WindowEnum.DatasetExplorer; ThumbnailsView.KeyDown += async (sender, args) => { @@ -109,7 +108,6 @@ public partial class DatasetExplorer foreach (var ann in ExplorerEditor.CurrentAnns.Where(x => x.IsSelected)) ann.AnnotationClass = selectedClass; }; - Activated += (_, _) => _formState.ActiveWindow = WindowEnum.Annotator; LvClasses.SelectedIndex = _annotationConfig.LastSelectedExplorerClass ?? 0; ExplorerEditor.CurrentAnnClass = (AnnotationClass)LvClasses.SelectedItem; diff --git a/Azaion.Suite/App.xaml.cs b/Azaion.Suite/App.xaml.cs index f3b6fd4..2f9aa5f 100644 --- a/Azaion.Suite/App.xaml.cs +++ b/Azaion.Suite/App.xaml.cs @@ -88,9 +88,8 @@ public partial class App AppDomain.CurrentDomain.AssemblyResolve += (_, a) => _resourceLoader.LoadAssembly(a.Name); StartMain(); - - EventManager.RegisterClassHandler(typeof(UIElement), UIElement.KeyDownEvent, new RoutedEventHandler(GlobalClick)); await _host.StartAsync(); + EventManager.RegisterClassHandler(typeof(UIElement), UIElement.KeyDownEvent, new RoutedEventHandler(GlobalClick)); _host.Services.GetRequiredService().Show(); }; @@ -169,7 +168,6 @@ public partial class App private void GlobalClick(object sender, RoutedEventArgs e) { var args = (KeyEventArgs)e; - var keyEvent = new KeyEvent(sender, args, _formState.ActiveWindow); _ = ThrottleExt.Throttle(() => _mediator.Publish(keyEvent), TimeSpan.FromMilliseconds(50)); } diff --git a/Azaion.Suite/Login.xaml.cs b/Azaion.Suite/Login.xaml.cs index 5d7a1fc..931ded5 100644 --- a/Azaion.Suite/Login.xaml.cs +++ b/Azaion.Suite/Login.xaml.cs @@ -16,6 +16,8 @@ public partial class Login private void LoginClick(object sender, RoutedEventArgs e) { + LoginBtn.Cursor = Cursors.Wait; + Cursor = Cursors.Wait; CredentialsEntered?.Invoke(this, new ApiCredentials(TbEmail.Text, TbPassword.Password)); Close(); }