|
@@ -99,38 +99,11 @@ public class MainWindowViewModel : ViewModelBase
|
|
|
{
|
|
|
OpenErrorWindow(ex);
|
|
|
}
|
|
|
+
|
|
|
try
|
|
|
{
|
|
|
- var changelog = await Downloader.DownloadAndDeserializeJsonData<List<Changelog>>("https://files.veloe.link/launcher/changelog.json");
|
|
|
-
|
|
|
- if (changelog is not null && Avalonia.Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop && desktop.MainWindow is not null)
|
|
|
- {
|
|
|
-#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
|
|
- Dispatcher.UIThread.InvokeAsync(() =>
|
|
|
- {
|
|
|
- var stackpanel = desktop.MainWindow.GetControl<StackPanel>("ChangeLogStackPanel");
|
|
|
- foreach (var version in changelog)
|
|
|
- {
|
|
|
- if (version.Title is not null)
|
|
|
- {
|
|
|
- stackpanel.Children.Add(new TextBlock()
|
|
|
- {
|
|
|
- Text = version.Title,
|
|
|
- VerticalAlignment = Avalonia.Layout.VerticalAlignment.Stretch,
|
|
|
- TextWrapping = TextWrapping.Wrap,
|
|
|
- FontSize = 16
|
|
|
- });
|
|
|
- }
|
|
|
- stackpanel.Children.Add(new TextBlock()
|
|
|
- {
|
|
|
- Text = version.Text,
|
|
|
- VerticalAlignment = Avalonia.Layout.VerticalAlignment.Stretch,
|
|
|
- TextWrapping = TextWrapping.Wrap
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
-#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
|
|
- }
|
|
|
+ Changelogs = new ObservableCollection<Changelog>(await Downloader.DownloadAndDeserializeJsonData<List<Changelog>>("https://files.veloe.link/launcher/changelog.json"));
|
|
|
+ this.RaisePropertyChanged(nameof(Changelogs));
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
@@ -279,6 +252,8 @@ public class MainWindowViewModel : ViewModelBase
|
|
|
set => this.RaiseAndSetIfChanged(ref _serverPanels, value);
|
|
|
}
|
|
|
|
|
|
+ public ObservableCollection<Changelog>? Changelogs { get; private set; }
|
|
|
+
|
|
|
public DownloadedVersion DownloadedVersion
|
|
|
{
|
|
|
get => _downloadedVersion;
|