mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Use loaded event & Add style
This commit is contained in:
parent
c241d21a4a
commit
af0e1180a5
2 changed files with 16 additions and 4 deletions
|
|
@ -161,7 +161,8 @@
|
|||
Margin="15 0 20 0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Stretch"
|
||||
ClickAction="SafetyDisplayWithRelativePath" />
|
||||
ClickAction="SafetyDisplayWithRelativePath"
|
||||
Loaded="MarkdownViewer_Loaded" />
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ using System.Threading.Tasks;
|
|||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using Flow.Launcher.Infrastructure.Http;
|
||||
using MdXaml;
|
||||
|
||||
namespace Flow.Launcher
|
||||
{
|
||||
|
|
@ -21,11 +22,9 @@ namespace Flow.Launcher
|
|||
|
||||
#region Window Events
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD100:Avoid async void methods", Justification = "<Pending>")]
|
||||
private async void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
RefreshMaximizeRestoreButton();
|
||||
MarkdownViewer.Markdown = await GetReleaseNotesMarkdownAsync();
|
||||
}
|
||||
|
||||
private void OnCloseExecuted(object sender, ExecutedRoutedEventArgs e)
|
||||
|
|
@ -82,6 +81,11 @@ 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;
|
||||
}
|
||||
var releases = JsonSerializer.Deserialize<List<GitHubReleaseInfo>>(releaseNotesJSON);
|
||||
|
||||
// Get the latest releases
|
||||
|
|
@ -145,5 +149,12 @@ namespace Flow.Launcher
|
|||
private static partial Regex ImageUnitRegex();
|
||||
|
||||
#endregion
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "VSTHRD100:Avoid async void methods", Justification = "<Pending>")]
|
||||
private async void MarkdownViewer_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
MarkdownViewer.MarkdownStyle = MarkdownStyle.GithubLike;
|
||||
MarkdownViewer.Markdown = await GetReleaseNotesMarkdownAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue