Skip to content

Commit

Permalink
Show currently installed version and author
Browse files Browse the repository at this point in the history
  • Loading branch information
qe201020335 committed Oct 13, 2024
1 parent fa63e48 commit 51a93d1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion QuestPatcher/ViewModels/ModBrowser/ExternalModViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class ExternalModViewModel : ViewModelBase
public string Id => Mod.Id;
public string Name => Mod.Name;
public string Description => Mod.Description;
public string Author => Mod.Author;
public string Author => $"(作者: {Mod.Author})";
public string Version => Mod.VersionString;

private bool _isChecked;
Expand Down Expand Up @@ -53,6 +53,8 @@ public string InstallButtonText
public bool IsLatestInstalled => _installedMod != null && Mod.Version <= _installedMod.Version;

public bool ShouldEnableButton => _locker.IsFree && !IsLatestInstalled;

public string InstalledVersionText => _installedMod == null ? "(未安装)" : $"(已安装 {_installedMod.Version})";

private readonly object _installedModLock = new();
private IMod? _installedMod;
Expand Down Expand Up @@ -103,6 +105,8 @@ public void UpdateInstallStatus(IMod? installedMod)

InstallButtonText = current == null ? "安装" : (Mod.Version > current.Version ? "更新" : "已安装");
this.RaisePropertyChanged(nameof(ShouldEnableButton));
this.RaisePropertyChanged(nameof(IsLatestInstalled));
this.RaisePropertyChanged(nameof(InstalledVersionText));
}
}

Expand Down
1 change: 1 addition & 0 deletions QuestPatcher/Views/ModBrowser/ExternalModView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<StackPanel DockPanel.Dock="Left" Orientation="Horizontal" Spacing="4">
<TextBlock Text="{Binding Name}" />
<TextBlock Text="{Binding Version}" FontSize="10" VerticalAlignment="Bottom" />
<TextBlock Text="{Binding InstalledVersionText}" FontSize="10" VerticalAlignment="Bottom" />
</StackPanel>
<TextBlock DockPanel.Dock="Right" Text="{Binding Author}" FontSize="10" HorizontalAlignment="Right"
VerticalAlignment="Center" />
Expand Down

0 comments on commit 51a93d1

Please sign in to comment.