Skip to content

Commit

Permalink
添加依赖文件版本显示
Browse files Browse the repository at this point in the history
  • Loading branch information
mujianwu committed Jul 24, 2024
1 parent b253470 commit c9df861
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 0 additions & 2 deletions UotanToolbox/Features/Home/HomeViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ await Dispatcher.UIThread.InvokeAsync(async () =>
Process.GetCurrentProcess().Kill();
});
}
Global.BinVersion = await StringHelper.GetBinVersion();

}

public async Task<bool> GetDevicesList()
Expand Down
4 changes: 2 additions & 2 deletions UotanToolbox/Features/Settings/SettingsView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
xmlns:settings="clr-namespace:UotanToolbox.Features.Settings"
xmlns:suki="clr-namespace:SukiUI.Controls;assembly=SukiUI"
xmlns:assets="clr-namespace:UotanToolbox.Assets;assembly=UotanToolbox"
d:DesignHeight="1950"
d:DesignHeight="2950"
d:DesignWidth="1024"
x:DataType="settings:SettingsViewModel"
mc:Ignorable="d">
Expand Down Expand Up @@ -268,7 +268,7 @@
<TextBlock>QCNTool (from Github repo https://github.com/MindowsToolBox/QCNTool)</TextBlock>
<TextBlock>QMSL_MSVC10R.dll (from QPST)</TextBlock>
<TextBlock>Suki UI (modified from Github repo https://github.com/kikipoulet/SukiUI)</TextBlock>
<TextBlock>BinVersion:</TextBlock>
<TextBlock Text="{Binding BinVersion}" />
</StackPanel>
</DockPanel>
</controls:GlassCard>
Expand Down
8 changes: 8 additions & 0 deletions UotanToolbox/Features/Settings/SettingsViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Avalonia.Collections;
using Avalonia.Styling;
using Avalonia.Threading;
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Material.Icons;
Expand Down Expand Up @@ -35,12 +36,14 @@ public partial class SettingsViewModel : MainPageBase
[ObservableProperty] private bool _backgroundAnimations;
[ObservableProperty] private bool _backgroundTransitions;
[ObservableProperty] private string _currentVersion = Global.currentVersion;
[ObservableProperty] private string _binVersion = null;

private string _customShader = null;

private static string GetTranslation(string key) => FeaturesHelper.GetTranslation(key);
public SettingsViewModel() : base(GetTranslation("Sidebar_Settings"), MaterialIconKind.SettingsOutline, -200)
{
_ = CheckBinVersion();
AvailableBackgroundStyles = new AvaloniaList<SukiBackgroundStyle>(Enum.GetValues<SukiBackgroundStyle>());
AvailableColors = _theme.ColorThemes;
IsLightTheme = _theme.ActiveBaseTheme == ThemeVariant.Light;
Expand All @@ -52,6 +55,11 @@ public SettingsViewModel() : base(GetTranslation("Sidebar_Settings"), MaterialIc
};
}

public async Task CheckBinVersion()
{
BinVersion = await StringHelper.GetBinVersion();
}

partial void OnIsLightThemeChanged(bool value) =>
_theme.ChangeBaseTheme(value ? ThemeVariant.Light : ThemeVariant.Dark);

Expand Down

0 comments on commit c9df861

Please sign in to comment.