Skip to content

Commit

Permalink
app setting page
Browse files Browse the repository at this point in the history
  • Loading branch information
Scighost committed Dec 30, 2024
1 parent 9465fd0 commit b33a8c5
Show file tree
Hide file tree
Showing 14 changed files with 1,518 additions and 47 deletions.
27 changes: 27 additions & 0 deletions src/Starward.Language/Lang.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions src/Starward.Language/Lang.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1660,4 +1660,15 @@ Do you accept the risk and continue to use it?</value>
<data name="GameLauncherSettingDialog_DragAndDropImageOrVideoFiles" xml:space="preserve">
<value>Drag and drop image / video files.</value>
</data>
<data name="GameSelector_Calculating" xml:space="preserve">
<value>Calculating</value>
<comment>Calculating storage space usage.</comment>
</data>
<data name="SettingPage_General" xml:space="preserve">
<value>General</value>
<comment>General Setting</comment>
</data>
<data name="SettingPage_ForABetterExperiencePleaseEnableTheFollowingFeaturesInSystemSettings" xml:space="preserve">
<value>For a better experience, please enable the following features in system settings.</value>
</data>
</root>
9 changes: 9 additions & 0 deletions src/Starward.Language/Lang.zh-CN.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1660,4 +1660,13 @@
<data name="GameLauncherSettingDialog_DragAndDropImageOrVideoFiles" xml:space="preserve">
<value>拖放图片 / 视频文件</value>
</data>
<data name="GameSelector_Calculating" xml:space="preserve">
<value>计算中</value>
</data>
<data name="SettingPage_General" xml:space="preserve">
<value>常规</value>
</data>
<data name="SettingPage_ForABetterExperiencePleaseEnableTheFollowingFeaturesInSystemSettings" xml:space="preserve">
<value>为了更好的体验,请在系统设置中启用以下功能。</value>
</data>
</root>
1 change: 1 addition & 0 deletions src/Starward/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public App()
RequestedTheme = ApplicationTheme.Dark;
_uiDispatcherQueue = DispatcherQueue.GetForCurrentThread();
UnhandledException += App_UnhandledException;
_ = AppSetting.Language;
}


Expand Down
18 changes: 12 additions & 6 deletions src/Starward/Features/GameSelector/GameSelector.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,18 @@
<Run Text="{x:Bind lang:Lang.GameSelector_StorageSpaceSavedByHardLinks}" />
<Run Text="{x:Bind InstalledGamesSavedSize}" />
</TextBlock>
<ProgressRing Grid.Column="1"
Width="20"
Height="20"
HorizontalAlignment="Left"
IsIndeterminate="True"
Visibility="{x:Bind InitializeInstalledGamesCommand.IsRunning}" />
<StackPanel Grid.Column="1"
Orientation="Horizontal"
Spacing="12"
Visibility="{x:Bind InitializeInstalledGamesCommand.IsRunning}">
<TextBlock VerticalAlignment="Center"
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
Text="{x:Bind lang:Lang.GameSelector_Calculating}" />
<ProgressRing Width="20"
Height="20"
HorizontalAlignment="Left"
IsIndeterminate="True" />
</StackPanel>
<Button x:Name="Button_UpdateGamesAcutalSize"
Grid.Column="2"
Width="32"
Expand Down
16 changes: 7 additions & 9 deletions src/Starward/Features/GameSelector/GameSelector.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using CommunityToolkit.Mvvm.Messaging;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Starward.Core;
using Starward.Core.HoYoPlay;
using Starward.Features.GameLauncher;
using Starward.Features.HoYoPlay;
using Starward.Features.Setting;
using Starward.Frameworks;
using Starward.Helpers;
using Starward.Messages;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
Expand Down Expand Up @@ -48,6 +49,7 @@ public GameSelector()
this.InitializeComponent();
InitializeGameSelector();
this.Loaded += GameSelector_Loaded;
WeakReferenceMessenger.Default.Register<LanguageChangedMessage>(this, OnLanguageChanged);
}


Expand Down Expand Up @@ -80,22 +82,18 @@ public void InitializeGameSelector()

private async void GameSelector_Loaded(object sender, RoutedEventArgs e)
{
await Task.Delay(2000);
await Task.Delay(1000);
await UpdateGameInfoAsync();
}





public async void OnLanguageChanged(object? sender, LanguageChangedMessage message)
public async void OnLanguageChanged(object? _, LanguageChangedMessage __)
{
// todo 语言切换
if (message.Completed)
{
this.Bindings.Update();
await UpdateGameInfoAsync();
}
this.Bindings.Update();
await UpdateGameInfoAsync();
}


Expand Down
6 changes: 6 additions & 0 deletions src/Starward/Features/Setting/LanguageChangedMessage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace Starward.Features.Setting;

public class LanguageChangedMessage
{

}
Loading

0 comments on commit b33a8c5

Please sign in to comment.