Skip to content

Commit

Permalink
optimize welcome page
Browse files Browse the repository at this point in the history
  • Loading branch information
Scighost committed Dec 31, 2023
1 parent 65679e9 commit ae7e025
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 30 deletions.
9 changes: 9 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.

3 changes: 3 additions & 0 deletions src/Starward.Language/Lang.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1250,4 +1250,7 @@ Do you accept the risk and continue to use it?</value>
<data name="SelectLanguagePage_AreYouAbleToReceiveUpdatesForStarward" xml:space="preserve">
<value>Are you able to receive updates for Starward?</value>
</data>
<data name="SelectDirectoryPage_PleaseSelectAFolderToStoreYourPersonalData" xml:space="preserve">
<value>Please select a folder to store your personal data, it is very important!</value>
</data>
</root>
5 changes: 4 additions & 1 deletion src/Starward.Language/Lang.zh-CN.resx
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@
<value>好的</value>
</data>
<data name="SelectDirectoryPage_ChooseAnother" xml:space="preserve">
<value>自己选</value>
<value>选择其他</value>
</data>
<data name="SelectDirectoryPage_Cancel" xml:space="preserve">
<value>不想选</value>
Expand Down Expand Up @@ -1249,4 +1249,7 @@
<data name="SelectLanguagePage_NetworkTest" xml:space="preserve">
<value>网络测试</value>
</data>
<data name="SelectDirectoryPage_PleaseSelectAFolderToStoreYourPersonalData" xml:space="preserve">
<value>请选择一个文件夹存储您的个人数据,它很重要!</value>
</data>
</root>
2 changes: 1 addition & 1 deletion src/Starward.Language/Lang.zh-TW.resx
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@
<value>好的</value>
</data>
<data name="SelectDirectoryPage_ChooseAnother" xml:space="preserve">
<value>自己選</value>
<value>選擇其他</value>
</data>
<data name="SelectDirectoryPage_Cancel" xml:space="preserve">
<value>不想選</value>
Expand Down
18 changes: 7 additions & 11 deletions src/Starward/Pages/Welcome/SelectDirectoryPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition Width="3*" />
<ColumnDefinition Width="4*" />
</Grid.ColumnDefinitions>


Expand All @@ -45,19 +45,15 @@
<TextBlock FontSize="24"
Foreground="{ThemeResource AccentTextFillColorPrimaryBrush}"
Text="{x:Bind lang:Lang.SelectDirectoryPage_NiceToMeetYou}" />
<!-- 这似乎是你第一次使用 Starward,在开始之前,请选择一个文件夹保存应用数据。 -->
<TextBlock Name="TextBlock_FirstUse"
FontSize="20"
<!-- 请选择一个文件夹存储您的个人数据,它很重要! -->
<TextBlock FontSize="20"
Text="{x:Bind lang:Lang.SelectDirectoryPage_PleaseSelectAFolderToStoreYourPersonalData}"
TextWrapping="Wrap" />
<TextBlock Margin="0,-20,0,0"
FontSize="20"
Text="{x:Bind lang:Lang.SelectDirectoryPage_ToStart}"
TextWrapping="Wrap" />
<Button Height="36"
<Button Height="40"
Margin="0,20,0,0"
BorderThickness="0"
Command="{x:Bind SelectDirectoryCommand}"
CornerRadius="18"
CornerRadius="8,20,20,8"
Style="{ThemeResource AccentButtonStyle}">
<StackPanel Margin="8,0,8,0"
Orientation="Horizontal"
Expand Down
8 changes: 1 addition & 7 deletions src/Starward/Pages/Welcome/SelectDirectoryPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,10 @@ public sealed partial class SelectDirectoryPage : PageBase
public SelectDirectoryPage()
{
this.InitializeComponent();
InitializeFirstUse();
}



private void InitializeFirstUse()
{
TextBlockHelper.Inlines(TextBlock_FirstUse.Inlines, Lang.SelectDirectoryPage_FirstUse, ("{Starward}", null));
}



[ObservableProperty]
Expand Down Expand Up @@ -81,7 +75,7 @@ private async Task SelectDirectoryAsync()
DefaultButton = ContentDialogButton.Primary,
// 好的
PrimaryButtonText = Lang.SelectDirectoryPage_OK,
// 自己选
// 选择其他
SecondaryButtonText = Lang.SelectDirectoryPage_ChooseAnother,
// 取消
CloseButtonText = Lang.Common_Cancel,
Expand Down
3 changes: 1 addition & 2 deletions src/Starward/Pages/Welcome/SelectGamePage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
xmlns:sc="using:Starward.Controls"
xmlns:sp="using:Starward.Pages"
x:DefaultBindMode="OneWay"
Loading="Page_Loading"
mc:Ignorable="d">

<Page.Resources>
Expand Down Expand Up @@ -95,7 +94,7 @@

<!-- select game -->
<StackPanel Name="StackPanel_SelectGame"
Margin="48,48,48,96"
Margin="48,48,0,96"
VerticalAlignment="Center"
Spacing="20">
<StackPanel.OpacityTransition>
Expand Down
12 changes: 4 additions & 8 deletions src/Starward/Pages/Welcome/SelectGamePage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Microsoft.Extensions.Logging;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media.Animation;
using Starward.Core;
Expand Down Expand Up @@ -43,7 +42,6 @@ public SelectGamePage()




private void InitializeSomeGame()
{
TextBlockHelper.Inlines(TextBlock_SomeGame.Inlines, Lang.SelectGamePage_SomeGame, ("{Starward}", null), ("{miHoYo/HoYoverse}", null));
Expand All @@ -56,14 +54,12 @@ private void InitializeSomeGame()




private async void Page_Loading(FrameworkElement sender, object args)
protected override void OnLoaded()
{
try
{
await Task.Delay(16);
InitializeGameComboBox();
LoadGameInfo();
_ = LoadGameInfoAsync();
}
catch (HttpRequestException ex)
{
Expand All @@ -77,14 +73,14 @@ private async void Page_Loading(FrameworkElement sender, object args)



private void LoadGameInfo()
private async Task LoadGameInfoAsync()
{
try
{
var file = Path.Combine(AppContext.BaseDirectory, @"Assets\game_info.json");
if (File.Exists(file))
{
var str = File.ReadAllText(file);
var str = await File.ReadAllTextAsync(file);
games = JsonSerializer.Deserialize<List<GameInfo>>(str)!;
}
}
Expand Down

0 comments on commit ae7e025

Please sign in to comment.