修复设置版本号问题 (#578)

This commit is contained in:
Poker 2024-12-28 03:59:58 +08:00 committed by GitHub
parent 8a6ab15bd2
commit e6c0d79975
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 19 additions and 16 deletions

View File

@ -40,9 +40,9 @@ public class Versioning
return (newLong - currentLong) switch
{
0 => UpdateState.UpToDate,
> 0x30 => UpdateState.MajorUpdate,
> 0x20 => UpdateState.MinorUpdate,
> 0x10 => UpdateState.BuildUpdate,
>= 1ul << 0x30 => UpdateState.MajorUpdate,
>= 1ul << 0x20 => UpdateState.MinorUpdate,
>= 1ul << 0x10 => UpdateState.BuildUpdate,
_ => UpdateState.RevisionUpdate
};
}

View File

@ -1,5 +1,4 @@
using System.Collections.Generic;
using CommunityToolkit.Mvvm.ComponentModel;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Documents;
using Pixeval.Utilities;
@ -16,12 +15,9 @@ namespace Pixeval.Controls;
[DependencyProperty<bool>("IsMultiPage", "false")]
[DependencyProperty<bool>("LoadSuccessfully", "true")]
[DependencyProperty<bool>("IsLoading", "false")]
[INotifyPropertyChanged]
[DependencyProperty<DocumentViewerViewModel>("ViewModel", IsNullable = true)]
public sealed partial class DocumentViewer
{
[ObservableProperty]
public partial DocumentViewerViewModel? ViewModel { get; set; }
public DocumentViewer() => InitializeComponent();
public static async void OnNovelItemChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)

View File

@ -122,8 +122,6 @@ public sealed partial class WorkView : IEntryView<ISortableEntryViewViewModel>
switch (ViewModel)
{
case NovelViewViewModel when type == typeof(Novel):
ViewModel.ResetEngine(newEngine, itemsPerPage, itemLimit);
break;
case IllustrationViewViewModel when type == typeof(Illustration):
ViewModel.ResetEngine(newEngine, itemsPerPage, itemLimit);
break;

View File

@ -19,9 +19,10 @@
#endregion
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Windows.System;
using CommunityToolkit.Labs.WinUI.MarkdownTextBlock;
using CommunityToolkit.Mvvm.ComponentModel;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
@ -37,10 +38,9 @@ using WinUI3Utilities;
namespace Pixeval.Pages.Misc;
/// <summary>
/// todo
/// todo INotifyPropertyChanged
/// </summary>
[INotifyPropertyChanged]
public sealed partial class SettingsPage : IScrollViewHost, IDisposable
public sealed partial class SettingsPage : IScrollViewHost, IDisposable, INotifyPropertyChanged
{
private string CurrentVersion =>
AppInfo.AppVersion.CurrentVersion.Let(t => $"{t.Major}.{t.Minor}.{t.Build}.{t.Revision}");
@ -188,4 +188,11 @@ public sealed partial class SettingsPage : IScrollViewHost, IDisposable
}
public ScrollView ScrollView => SettingsPageScrollView;
public event PropertyChangedEventHandler? PropertyChanged;
private void OnPropertyChanged([CallerMemberName] string? propertyName = null)
{
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
}

View File

@ -287,7 +287,9 @@ public partial class SettingsPageViewModel : UiObservableObject, IDisposable
_ => SettingsPageResources.UnknownUpdateState
};
public string? NewestVersion => AppInfo.AppVersion.UpdateAvailable ? AppInfo.AppVersion.NewestVersion?.ToString() : null;
public string? NewestVersion => AppInfo.AppVersion.UpdateAvailable
? AppInfo.AppVersion.NewestVersion?.Let(t => $"{t.Major}.{t.Minor}.{t.Build}.{t.Revision}")
: null;
public InfoBarSeverity UpdateInfoSeverity => AppInfo.AppVersion.UpdateState switch
{

View File

@ -168,7 +168,7 @@
<value>有可用的次要更新</value>
</data>
<data name="BuildUpdateAvailable" xml:space="preserve">
<value>有可用的生成更新</value>
<value>有可用的构建更新</value>
</data>
<data name="UnknownUpdateState" xml:space="preserve">
<value>未知更新状态</value>