This commit is contained in:
DismissedLight
2023-09-24 17:54:08 +08:00
parent ffcfb8cd65
commit 43aebf7d0c
6 changed files with 10 additions and 17 deletions

View File

@@ -17,6 +17,6 @@
Margin="0,0,0,8"
VerticalAlignment="Top"
PlaceholderText="{shcm:ResourceString Name=ViewDialogAchievementArchiveCreateInputPlaceholder}"
Text="{x:Bind Text, Mode=TwoWay}"/>
Text="{x:Bind Text, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
</Grid>
</ContentDialog>

View File

@@ -16,7 +16,7 @@
<TextBox
VerticalAlignment="Top"
PlaceholderText="{shcm:ResourceString Name=ViewDialogCultivateProjectInputPlaceholder}"
Text="{x:Bind Text, Mode=TwoWay}"/>
Text="{x:Bind Text, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<CheckBox
Margin="0,8,0,0"
Content="{shcm:ResourceString Name=ViewDialogCultivateProjectAttachUid}"

View File

@@ -14,9 +14,9 @@
<Grid>
<TextBox
x:Name="InputText"
Margin="0,0,0,0"
VerticalAlignment="Top"
PlaceholderText="{shcm:ResourceString Name=ViewDialogLaunchGameAccountInputPlaceholder}"/>
PlaceholderText="{shcm:ResourceString Name=ViewDialogLaunchGameAccountInputPlaceholder}"
Text="{x:Bind Text, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
</Grid>
</ContentDialog>

View File

@@ -9,6 +9,7 @@ namespace Snap.Hutao.View.Dialog;
/// 游戏账号命名对话框
/// </summary>
[HighQuality]
[DependencyProperty("Text", typeof(string))]
internal sealed partial class LaunchGameAccountNameDialog : ContentDialog
{
private readonly ITaskContext taskContext;
@@ -33,7 +34,6 @@ internal sealed partial class LaunchGameAccountNameDialog : ContentDialog
{
await taskContext.SwitchToMainThreadAsync();
ContentDialogResult result = await ShowAsync();
string text = InputText.Text;
return new(result == ContentDialogResult.Primary && (!string.IsNullOrEmpty(text)), text);
return new(result == ContentDialogResult.Primary && (!string.IsNullOrEmpty(Text)), Text);
}
}

View File

@@ -9,18 +9,16 @@
Title="{shcm:ResourceString Name=ViewDialogUserTitle}"
CloseButtonText="{shcm:ResourceString Name=ContentDialogCancelCloseButtonText}"
DefaultButton="Primary"
IsPrimaryButtonEnabled="False"
PrimaryButtonText="{shcm:ResourceString Name=ContentDialogConfirmPrimaryButtonText}"
Style="{StaticResource DefaultContentDialogStyle}"
mc:Ignorable="d">
<StackPanel>
<TextBox
x:Name="InputText"
Margin="0,0,0,8"
VerticalAlignment="Top"
PlaceholderText="{shcm:ResourceString Name=ViewDialogUserInputPlaceholder}"
TextChanged="InputTextChanged"/>
Text="{x:Bind Text, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<StackPanel Margin="0,0,0,0">
<StackPanel.Resources>
<x:Double x:Key="SettingsCardWrapThreshold">0</x:Double>

View File

@@ -1,6 +1,7 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
namespace Snap.Hutao.View.Dialog;
@@ -9,6 +10,7 @@ namespace Snap.Hutao.View.Dialog;
/// 添加用户对话框
/// </summary>
[HighQuality]
[DependencyProperty("Text", typeof(string))]
internal sealed partial class UserDialog : ContentDialog
{
private readonly ITaskContext taskContext;
@@ -33,13 +35,6 @@ internal sealed partial class UserDialog : ContentDialog
{
await taskContext.SwitchToMainThreadAsync();
ContentDialogResult result = await ShowAsync();
string cookie = InputText.Text;
return new(result == ContentDialogResult.Primary, cookie);
}
private void InputTextChanged(object sender, TextChangedEventArgs e)
{
IsPrimaryButtonEnabled = !string.IsNullOrEmpty(InputText.Text);
return new(result == ContentDialogResult.Primary && !string.IsNullOrEmpty(Text), Text);
}
}