diff --git a/Countdown/GlobalUsings.cs b/Countdown/GlobalUsings.cs index 95f8bb3..196a3c3 100644 --- a/Countdown/GlobalUsings.cs +++ b/Countdown/GlobalUsings.cs @@ -32,10 +32,8 @@ global using Windows.ApplicationModel.DataTransfer; global using Windows.Foundation; -global using Windows.Foundation.Collections; global using Windows.Graphics; global using Windows.Media.Playback; -global using Windows.Storage; global using Windows.System; global using Windows.UI; global using Windows.Win32; diff --git a/Countdown/Views/LettersView.xaml.cs b/Countdown/Views/LettersView.xaml.cs index 4e57b33..b3395f6 100644 --- a/Countdown/Views/LettersView.xaml.cs +++ b/Countdown/Views/LettersView.xaml.cs @@ -7,7 +7,6 @@ internal sealed partial class LettersView : Page private bool firstLoad = true; private TreeViewList? treeViewList; - private TextBox? textBox; private LettersViewModel? viewModel; public LettersView() @@ -16,23 +15,24 @@ public LettersView() Loaded += (s, e) => { - textBox ??= FindChild(SuggestionBox); - - if (textBox is not null) + if (firstLoad) { - textBox.CharacterCasing = CharacterCasing.Lower; - textBox.MaxLength = Models.WordModel.cMaxLetters; + firstLoad = false; - textBox.BeforeTextChanging += (s, a) => + TextBox? textBox = FindChild(SuggestionBox); + + if (textBox is not null) { - if (a.NewText.Length > 0) - a.Cancel = a.NewText.Any(c => c is < 'a' or > 'z'); - }; - } + textBox.CharacterCasing = CharacterCasing.Lower; + textBox.MaxLength = Models.WordModel.cMaxLetters; + + textBox.BeforeTextChanging += (s, a) => + { + if (a.NewText.Length > 0) + a.Cancel = a.NewText.Any(c => c is < 'a' or > 'z'); + }; + } - if (firstLoad) - { - firstLoad = false; App.MainWindow?.AddDragRegionEventHandlers(this); }