diff --git a/Pixiview/AppShell.xaml b/Pixiview/AppShell.xaml index 5d7d4df..7bfb7da 100644 --- a/Pixiview/AppShell.xaml +++ b/Pixiview/AppShell.xaml @@ -30,6 +30,9 @@ Text="{Binding UserProfileName}" TextColor="{DynamicResource TextColor}"/> <Label Grid.Row="2" VerticalOptions="Center" FontSize="Small" Text="{Binding UserProfileId}" TextColor="{DynamicResource SubTextColor}"/> + <ActivityIndicator Grid.RowSpan="3" BackgroundColor="#50000000" Color="White" + Margin="0, 20, 20, 0" + IsVisible="{Binding IsLoading}" IsRunning="{Binding IsLoading}"/> </Grid> </DataTemplate> </Shell.FlyoutHeaderTemplate> diff --git a/Pixiview/AppShell.xaml.cs b/Pixiview/AppShell.xaml.cs index 90c7db8..781e84a 100644 --- a/Pixiview/AppShell.xaml.cs +++ b/Pixiview/AppShell.xaml.cs @@ -23,6 +23,8 @@ namespace Pixiview nameof(UserProfileName), typeof(string), typeof(AppShell), ResourceHelper.Guest); public static readonly BindableProperty UserProfileIdProperty = BindableProperty.Create( nameof(UserProfileId), typeof(string), typeof(AppShell)); + public static readonly BindableProperty IsLoadingProperty = BindableProperty.Create( + nameof(IsLoading), typeof(bool), typeof(AppShell)); public ImageSource UserProfileImage { @@ -39,6 +41,11 @@ namespace Pixiview get => (string)GetValue(UserProfileIdProperty); set => SetValue(UserProfileIdProperty, value); } + public bool IsLoading + { + get => (bool)GetValue(IsLoadingProperty); + set => SetValue(IsLoadingProperty, value); + } public event EventHandler<BarHeightEventArgs> NavigationBarHeightChanged; public event EventHandler<BarHeightEventArgs> StatusBarHeightChanged; @@ -76,12 +83,24 @@ namespace Pixiview { if (UserProfileId != null) { - return; + if (IsLoading) + { + return; + } + IsLoading = true; + Task.Run(() => + { + DoLoginInformation(true); + IsLoading = false; + }); } - PushToLogin(()=> + else { - Task.Run(() => DoLoginInformation(true)); - }); + PushToLogin(() => + { + Task.Run(() => DoLoginInformation(true)); + }); + } } private bool isLoginOpened;