diff --git a/src/Pixeval/AppManagement/Versioning.cs b/src/Pixeval/AppManagement/Versioning.cs index 476c033a..b189e7de 100644 --- a/src/Pixeval/AppManagement/Versioning.cs +++ b/src/Pixeval/AppManagement/Versioning.cs @@ -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 }; } diff --git a/src/Pixeval/Controls/DocumentViewer/DocumentViewer.xaml.cs b/src/Pixeval/Controls/DocumentViewer/DocumentViewer.xaml.cs index d4165713..9a496307 100644 --- a/src/Pixeval/Controls/DocumentViewer/DocumentViewer.xaml.cs +++ b/src/Pixeval/Controls/DocumentViewer/DocumentViewer.xaml.cs @@ -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("IsMultiPage", "false")] [DependencyProperty("LoadSuccessfully", "true")] [DependencyProperty("IsLoading", "false")] -[INotifyPropertyChanged] +[DependencyProperty("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) diff --git a/src/Pixeval/Controls/Work/WorkView.xaml.cs b/src/Pixeval/Controls/Work/WorkView.xaml.cs index 63571140..19daabaa 100644 --- a/src/Pixeval/Controls/Work/WorkView.xaml.cs +++ b/src/Pixeval/Controls/Work/WorkView.xaml.cs @@ -122,8 +122,6 @@ public sealed partial class WorkView : IEntryView 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; diff --git a/src/Pixeval/Pages/Misc/SettingsPage.xaml.cs b/src/Pixeval/Pages/Misc/SettingsPage.xaml.cs index 43b1d7d0..bc7fe1e7 100644 --- a/src/Pixeval/Pages/Misc/SettingsPage.xaml.cs +++ b/src/Pixeval/Pages/Misc/SettingsPage.xaml.cs @@ -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; /// -/// todo +/// todo INotifyPropertyChanged /// -[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)); + } } diff --git a/src/Pixeval/Pages/Misc/SettingsPageViewModel.cs b/src/Pixeval/Pages/Misc/SettingsPageViewModel.cs index 6951663b..afff97d3 100644 --- a/src/Pixeval/Pages/Misc/SettingsPageViewModel.cs +++ b/src/Pixeval/Pages/Misc/SettingsPageViewModel.cs @@ -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 { diff --git a/src/Pixeval/Strings/zh-CN/SettingsPage.resw b/src/Pixeval/Strings/zh-CN/SettingsPage.resw index 29e9a135..c8c99d71 100644 --- a/src/Pixeval/Strings/zh-CN/SettingsPage.resw +++ b/src/Pixeval/Strings/zh-CN/SettingsPage.resw @@ -168,7 +168,7 @@ 有可用的次要更新 - 有可用的生成更新 + 有可用的构建更新 未知更新状态