disable interaction when page is initializing

This commit is contained in:
DismissedLight
2024-07-06 19:12:50 +08:00
parent 5b98ba3fc4
commit bfefbc58fa
2 changed files with 7 additions and 3 deletions

View File

@@ -48,6 +48,7 @@
shuxc:NavigationViewHelper.PaneCornerRadius="0"
CompactPaneLength="48"
IsBackEnabled="{x:Bind ContentFrame.CanGoBack, Mode=OneWay}"
IsEnabled="{Binding ElementName=ContentFrame, Path=Content.DataContext.IsInitialized, Mode=OneWay}"
IsPaneOpen="True"
OpenPaneLength="192"
PaneDisplayMode="Left"

View File

@@ -74,9 +74,12 @@ internal sealed partial class CultivationViewModel : Abstraction.ViewModel
{
if (await metadataService.InitializeAsync().ConfigureAwait(false))
{
await taskContext.SwitchToMainThreadAsync();
Projects = cultivationService.Projects;
Projects.MoveCurrentTo(Projects.SourceCollection.SelectedOrDefault());
using (await EnterCriticalSectionAsync().ConfigureAwait(false))
{
await taskContext.SwitchToMainThreadAsync();
Projects = cultivationService.Projects;
Projects.MoveCurrentTo(Projects.SourceCollection.SelectedOrDefault());
}
// Force update when re-entering the page
if (Projects.CurrentItem is not null && CultivateEntries is null)