feature: refresh profile

This commit is contained in:
2020-05-18 13:49:45 +08:00
parent d743e5e393
commit 3f884e9b12
2 changed files with 26 additions and 4 deletions

View File

@ -30,6 +30,9 @@
Text="{Binding UserProfileName}" TextColor="{DynamicResource TextColor}"/> Text="{Binding UserProfileName}" TextColor="{DynamicResource TextColor}"/>
<Label Grid.Row="2" VerticalOptions="Center" FontSize="Small" <Label Grid.Row="2" VerticalOptions="Center" FontSize="Small"
Text="{Binding UserProfileId}" TextColor="{DynamicResource SubTextColor}"/> 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> </Grid>
</DataTemplate> </DataTemplate>
</Shell.FlyoutHeaderTemplate> </Shell.FlyoutHeaderTemplate>

View File

@ -23,6 +23,8 @@ namespace Pixiview
nameof(UserProfileName), typeof(string), typeof(AppShell), ResourceHelper.Guest); nameof(UserProfileName), typeof(string), typeof(AppShell), ResourceHelper.Guest);
public static readonly BindableProperty UserProfileIdProperty = BindableProperty.Create( public static readonly BindableProperty UserProfileIdProperty = BindableProperty.Create(
nameof(UserProfileId), typeof(string), typeof(AppShell)); nameof(UserProfileId), typeof(string), typeof(AppShell));
public static readonly BindableProperty IsLoadingProperty = BindableProperty.Create(
nameof(IsLoading), typeof(bool), typeof(AppShell));
public ImageSource UserProfileImage public ImageSource UserProfileImage
{ {
@ -39,6 +41,11 @@ namespace Pixiview
get => (string)GetValue(UserProfileIdProperty); get => (string)GetValue(UserProfileIdProperty);
set => SetValue(UserProfileIdProperty, value); set => SetValue(UserProfileIdProperty, value);
} }
public bool IsLoading
{
get => (bool)GetValue(IsLoadingProperty);
set => SetValue(IsLoadingProperty, value);
}
public event EventHandler<BarHeightEventArgs> NavigationBarHeightChanged; public event EventHandler<BarHeightEventArgs> NavigationBarHeightChanged;
public event EventHandler<BarHeightEventArgs> StatusBarHeightChanged; public event EventHandler<BarHeightEventArgs> StatusBarHeightChanged;
@ -76,12 +83,24 @@ namespace Pixiview
{ {
if (UserProfileId != null) 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; private bool isLoginOpened;