mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Add progress ring
This commit is contained in:
parent
af0e1180a5
commit
02496214ea
2 changed files with 53 additions and 4 deletions
|
|
@ -163,6 +163,29 @@
|
|||
VerticalAlignment="Stretch"
|
||||
ClickAction="SafetyDisplayWithRelativePath"
|
||||
Loaded="MarkdownViewer_Loaded" />
|
||||
|
||||
<!-- Put this Grid in the same position as MarkdownViewer -->
|
||||
<Grid
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="5"
|
||||
Height="510"
|
||||
Margin="15 0 20 0">
|
||||
<ui:ProgressRing
|
||||
x:Name="RefreshProgressRing"
|
||||
Width="30"
|
||||
Height="30"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
IsActive="True" />
|
||||
<Button
|
||||
x:Name="RefreshButton"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Click="RefreshButton_Click"
|
||||
Content="{DynamicResource refresh}"
|
||||
Visibility="Collapsed" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ namespace Flow.Launcher
|
|||
private static async Task<string> GetReleaseNotesMarkdownAsync()
|
||||
{
|
||||
var releaseNotesJSON = await Http.GetStringAsync("https://api.github.com/repos/Flow-Launcher/Flow.Launcher/releases");
|
||||
|
||||
|
||||
if (string.IsNullOrEmpty(releaseNotesJSON))
|
||||
{
|
||||
return string.Empty;
|
||||
|
|
@ -150,11 +150,37 @@ namespace Flow.Launcher
|
|||
|
||||
#endregion
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD100:Avoid async void methods", Justification = "<Pending>")]
|
||||
private async void MarkdownViewer_Loaded(object sender, RoutedEventArgs e)
|
||||
private void MarkdownViewer_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MarkdownViewer.MarkdownStyle = MarkdownStyle.GithubLike;
|
||||
MarkdownViewer.Markdown = await GetReleaseNotesMarkdownAsync();
|
||||
RefreshMarkdownViewer();
|
||||
}
|
||||
|
||||
private void RefreshButton_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RefreshButton.Visibility = Visibility.Collapsed;
|
||||
RefreshProgressRing.Visibility = Visibility.Visible;
|
||||
RefreshMarkdownViewer();
|
||||
}
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD100:Avoid async void methods", Justification = "<Pending>")]
|
||||
private async void RefreshMarkdownViewer()
|
||||
{
|
||||
var output = await GetReleaseNotesMarkdownAsync().ConfigureAwait(false);
|
||||
|
||||
Application.Current.Dispatcher.Invoke(() =>
|
||||
{
|
||||
RefreshProgressRing.Visibility = Visibility.Collapsed;
|
||||
if (string.IsNullOrEmpty(output))
|
||||
{
|
||||
RefreshButton.Visibility = Visibility.Visible;
|
||||
}
|
||||
else
|
||||
{
|
||||
RefreshButton.Visibility = Visibility.Collapsed;
|
||||
MarkdownViewer.Markdown = output;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue