From fb7df9404d031d5d477d8456427ef232b7ce6f11 Mon Sep 17 00:00:00 2001
From: Pear-231 <61670316+Pear-231@users.noreply.github.com>
Date: Fri, 13 Mar 2026 20:30:52 +0000
Subject: [PATCH 1/2] Fixed window buttons misalignment and modernised
CustomWindowStyle
---
AssetEditor/Themes/Controls.xaml | 174 ++++++++++++------
AssetEditor/Views/MainWindow.xaml | 43 +++--
.../WindowStateToPathConverter.cs | 4 +-
3 files changed, 142 insertions(+), 79 deletions(-)
diff --git a/AssetEditor/Themes/Controls.xaml b/AssetEditor/Themes/Controls.xaml
index fc35e6cda..9ed80e97e 100644
--- a/AssetEditor/Themes/Controls.xaml
+++ b/AssetEditor/Themes/Controls.xaml
@@ -5446,7 +5446,9 @@
+
-
+
-
+
-
-
+
+
diff --git a/AssetEditor/ViewModels/UpdaterViewModel.cs b/AssetEditor/ViewModels/UpdaterViewModel.cs
index 6d5a0aad9..f4595d4c0 100644
--- a/AssetEditor/ViewModels/UpdaterViewModel.cs
+++ b/AssetEditor/ViewModels/UpdaterViewModel.cs
@@ -3,7 +3,6 @@
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.IO;
-using System.Text;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Octokit;
@@ -17,39 +16,33 @@ namespace AssetEditor.ViewModels
{
public class ReleaseNoteItem(Release release)
{
- public string ReleaseName { get; } = release.Name;
- public string PublishedAt { get; } = $"Published {release.PublishedAt.Value:dd MMM yyyy}";
+ public string ReleaseName { get; } = $"## [{release.Name}]({release.HtmlUrl})";
+ public string PublishedAt { get; } = $"{release.PublishedAt!.Value:dd MMM yyyy}";
public string ReleaseNotes { get; } = release.Body;
}
- partial class UpdaterViewModel : ObservableObject
+ public partial class UpdaterViewModel(LocalizationManager localisationManager) : ObservableObject
{
+ private readonly LocalizationManager _localisationManager = localisationManager;
+
private readonly ILogger _logger = Logging.Create();
- private Action _closeAction;
+ private Action? _closeAction;
private const string AssetEditorUpdaterExe = "AssetEditorUpdater.exe";
private List _newerReleases = [];
[ObservableProperty] private ObservableCollection _releaseNotesItems = [];
-
- [ObservableProperty] private string _latestVersionInfo;
+ [ObservableProperty] private string _updateInfo = string.Empty;
public void SetReleaseInfo(List newerReleases)
{
_newerReleases = newerReleases;
- var currentVersion = VersionChecker.GetCurrentVersion();
var latestRelease = _newerReleases[0];
var latestVersion = VersionChecker.ParseReleaseVersion(latestRelease.TagName);
-
- var stringBuilder = new StringBuilder();
- stringBuilder.AppendLine($"A new version of AssetEditor is available! The AssetEditor donkeys have been busy...");
- stringBuilder.AppendLine();
- stringBuilder.AppendLine($"Your current version is {currentVersion}. The latest verison is {latestVersion}.");
- stringBuilder.AppendLine();
- stringBuilder.AppendLine("Update to get the changes detailed in the release notes below.");
- LatestVersionInfo = stringBuilder.ToString();
+ var currentVersion = VersionChecker.GetCurrentVersion();
+ UpdateInfo = string.Format(_localisationManager.Get("UpdaterWindow.UpdateInfo"), currentVersion, latestVersion);
ReleaseNotesItems.Clear();
foreach (var release in _newerReleases)
diff --git a/AssetEditor/Views/Updater/UpdaterWindow.xaml b/AssetEditor/Views/Updater/UpdaterWindow.xaml
index e1781fb56..3081e655f 100644
--- a/AssetEditor/Views/Updater/UpdaterWindow.xaml
+++ b/AssetEditor/Views/Updater/UpdaterWindow.xaml
@@ -4,6 +4,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:Localisation="clr-namespace:Shared.Ui.Common;assembly=Shared.Ui"
xmlns:Updater="clr-namespace:AssetEditor.Views.Updater"
xmlns:MdXaml="clr-namespace:MdXaml;assembly=MdXaml"
xmlns:ViewModels="clr-namespace:AssetEditor.ViewModels"
@@ -13,9 +14,9 @@
Closed="OnClosed"
ResizeMode="NoResize"
WindowStartupLocation="CenterScreen"
- Height="545"
- Width="800"
- Title="Asset Editor Updater">
+ SizeToContent="Height"
+ Width="1000"
+ Title="{Localisation:Loc UpdaterWindow.Title}">
@@ -29,90 +30,82 @@
Height="Auto"/>
-
-
-
-
-
-
-
-
-
-
+ VerticalScrollBarVisibility="Auto"
+ MaxHeight="400"
+ Padding="0">
-
+
+
+
+
-
+
+
+
-
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+ Margin="10, 10, 0, 0">
diff --git a/AssetEditor/Views/Updater/UpdaterWindow.xaml.cs b/AssetEditor/Views/Updater/UpdaterWindow.xaml.cs
index 70a04626a..76c3fe0e0 100644
--- a/AssetEditor/Views/Updater/UpdaterWindow.xaml.cs
+++ b/AssetEditor/Views/Updater/UpdaterWindow.xaml.cs
@@ -1,9 +1,11 @@
using System;
using System.Windows;
using System.Windows.Controls;
+using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using AssetEditor.ViewModels;
+using MdXaml;
namespace AssetEditor.Views.Updater
{
@@ -51,6 +53,46 @@ private void OnWindowLoaded(object sender, RoutedEventArgs e)
viewModel.SetCloseAction(this.Close);
}
+ private void OnMarkdownScrollViewerLoaded(object sender, RoutedEventArgs e)
+ {
+ if (sender is not MarkdownScrollViewer markdownScrollViewer)
+ return;
+
+ var flowDocument = markdownScrollViewer.Document;
+ if (flowDocument == null)
+ return;
+
+ // We format the list manually as the Controls.xaml doesn't let you set MarkerStyle
+ // and the spacing before the list is too big but changing the margin of paragraph
+ // in Controls.xaml changes all blocks rather than just the block for lists.
+ FormatList(flowDocument);
+ }
+
+ private static void FormatList(FlowDocument flowDocument)
+ {
+ var currentBlock = flowDocument.Blocks.FirstBlock;
+
+ while (currentBlock != null)
+ {
+ var nextBlock = currentBlock.NextBlock;
+
+ if (currentBlock is List list)
+ {
+ list.MarkerStyle = TextMarkerStyle.Disc;
+ list.Margin = new Thickness(0);
+ list.Padding = new Thickness(list.Padding.Left, 0, list.Padding.Right, 0);
+
+ if (list.ListItems.FirstListItem?.Blocks.FirstBlock is Paragraph firstParagraph)
+ firstParagraph.Margin = new Thickness(firstParagraph.Margin.Left, 10, firstParagraph.Margin.Right, firstParagraph.Margin.Bottom);
+ }
+
+ if (currentBlock is Paragraph paragraph && nextBlock is List)
+ paragraph.Margin = new Thickness(paragraph.Margin.Left, paragraph.Margin.Top, paragraph.Margin.Right, 0);
+
+ currentBlock = nextBlock;
+ }
+ }
+
private void OnClosed(object sender, EventArgs e)
{
if (DataContext is UpdaterViewModel viewModel)