@@ -27,33 +27,37 @@ public ContactsPage()
2727 CurrentInstance = this ;
2828 }
2929
30- protected async override void OnNavigatedTo ( NavigationEventArgs e )
30+ protected override void OnNavigatedTo ( NavigationEventArgs e )
3131 {
3232 base . OnNavigatedTo ( e ) ;
3333 SizeChanged += ContactsPage_SizeChanged ;
3434
35- await Dispatcher . RunAsync ( Windows . UI . Core . CoreDispatcherPriority . High , ( ) =>
36- {
37- LoadingGrid . Visibility = Windows . UI . Xaml . Visibility . Visible ;
38- } ) ;
35+ LoadingGrid . Visibility = Windows . UI . Xaml . Visibility . Visible ;
3936
40- Aaa ( ) ; //Todo: This needs to be run in background, currently it blocks the UI (??)
37+ Task . Run ( ( ) =>
38+ {
39+ Aaa ( ) ;
40+ } ) ; //TODO: This still hangs the UI in some cases 🥲
4141 }
4242
43- private Task Aaa ( )
43+ private void Aaa ( )
4444 {
4545 if ( ContactSystem . ContactControls == null )
4646 {
4747 ContactSystem . ContactsLoaded += ( object sender , EventArgs e ) => LoadDataCompleted ( ) ;
4848 }
4949 else LoadDataCompleted ( ) ;
50- return Task . CompletedTask ;
5150 }
5251
53- private void LoadDataCompleted ( )
52+ private async void LoadDataCompleted ( )
5453 {
55- _contactControls = ContactSystem . ContactControls ;
56- LoadingGrid . Visibility = Windows . UI . Xaml . Visibility . Collapsed ;
54+ await Dispatcher . RunAsync ( Windows . UI . Core . CoreDispatcherPriority . High , ( ) =>
55+ {
56+ ContactsItemsControl . ItemsSource = null ;
57+ _contactControls = ContactSystem . ContactControls ;
58+ ContactsItemsControl . ItemsSource = _contactControls ;
59+ LoadingGrid . Visibility = Windows . UI . Xaml . Visibility . Collapsed ;
60+ } ) ;
5761 }
5862
5963 private void ContactsPage_SizeChanged ( object sender , Windows . UI . Xaml . SizeChangedEventArgs e )
@@ -89,11 +93,12 @@ await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.High, () =>
8993
9094 IEnumerable < ContactControl > ContactsWithLetter = from contact in _contactControls where contact . ContactName . ToUpper ( ) . StartsWith ( letter ) select contact ;
9195
92- //TODO: Fix for missing letter -> move to previous/next letter
9396 try
9497 {
9598 ContactsWithLetter . First ( ) . StartBringIntoView ( ) ;
96- } catch { }
99+ } catch {
100+ //TODO: Fix for missing letter -> move to previous/next letter
101+ }
97102
98103 _hideHintTimer . Start ( ) ;
99104
0 commit comments