Skip to content

Commit

Permalink
hide next step when no verify code provided
Browse files Browse the repository at this point in the history
  • Loading branch information
Lightczx committed Jan 9, 2025
1 parent 1d018d7 commit e8f9004
Show file tree
Hide file tree
Showing 11 changed files with 125 additions and 97 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@
<shuxdc:Int32ToVisibilityRevertConverter x:Key="Int32ToVisibilityRevertConverter"/>
<shuxdc:Int32ToBoolConverter x:Key="Int32ToBoolConverter"/>
<shuxdc:Int32ToBoolRevertConverter x:Key="Int32ToBoolRevertConverter"/>
<shuxdc:StringBoolConverter x:Key="StringBoolConverter"/>
<shuxdc:EmptyStringToBoolConverter x:Key="EmptyStringToBoolConverter"/>
<shuxdc:EmptyStringToVisibilityConverter x:Key="EmptyStringToVisibilityConverter"/>
</ResourceDictionary>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.

using CommunityToolkit.WinUI.Converters;

namespace Snap.Hutao.UI.Xaml.Data.Converter;

internal sealed partial class EmptyStringToBoolConverter : EmptyStringToObjectConverter
{
public EmptyStringToBoolConverter()
{
EmptyValue = false;
NotEmptyValue = true;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// Copyright (c) DGP Studio. All rights reserved.
// Licensed under the MIT license.

using CommunityToolkit.WinUI.Converters;
using Microsoft.UI.Xaml;

namespace Snap.Hutao.UI.Xaml.Data.Converter;

internal sealed partial class EmptyStringToVisibilityConverter : EmptyStringToObjectConverter
{
public EmptyStringToVisibilityConverter()
{
EmptyValue = Visibility.Collapsed;
NotEmptyValue = Visibility.Visible;
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
Style="{StaticResource DefaultContentDialogStyle}"
mc:Ignorable="d">

<StackPanel Margin="0,8,0,0">
<StackPanel Margin="0,8,0,0" Spacing="16">
<TextBox
InputScope="EmailSmtpAddress"
IsSpellCheckEnabled="False"
Expand All @@ -21,7 +21,6 @@
<PasswordBox
Width="360"
MaxWidth="360"
Margin="0,16,0,0"
Password="{x:Bind Password, Mode=TwoWay}"
PasswordChar="*"
PlaceholderText="{shuxm:ResourceString Name=ViewPageHutaoPassportPasswordHint}"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,36 +12,39 @@
Style="{StaticResource DefaultContentDialogStyle}"
mc:Ignorable="d">

<StackPanel Margin="0,8,0,0">
<StackPanel Margin="0,8,0,0" Spacing="16">
<TextBox
InputScope="EmailSmtpAddress"
IsSpellCheckEnabled="False"
PlaceholderText="{shuxm:ResourceString Name=ViewPageHutaoPassportUserNameHint}"
Text="{x:Bind UserName, Mode=TwoWay}"/>
<Grid Margin="0,16,0,0" ColumnSpacing="16">
<Grid ColumnSpacing="16">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<TextBox PlaceholderText="{shuxm:ResourceString Name=ViewPageHutaoPassportVerifyCodeHint}" Text="{x:Bind VerifyCode, Mode=TwoWay}"/>
<TextBox
Grid.Column="0"
PlaceholderText="{shuxm:ResourceString Name=ViewPageHutaoPassportVerifyCodeHint}"
Text="{x:Bind VerifyCode, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<Button
Grid.Column="1"
VerticalAlignment="Stretch"
Command="{x:Bind VerifyCommand}"
Content="{shuxm:ResourceString Name=ViewPageHutaoPassportVerifyCodeAction}"/>
</Grid>
<PasswordBox
Width="360"
MaxWidth="360"
Margin="0,16,0,0"
IsEnabled="{x:Bind VerifyCode, Converter={StaticResource StringBoolConverter}, Mode=OneWay}"
Password="{x:Bind Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
PasswordChar="*"
PlaceholderText="{shuxm:ResourceString Name=ViewPageHutaoPassportPasswordHint}"/>
<TextBlock
Margin="0,4,0,0"
Opacity="0.7"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{shuxm:ResourceString Name=ViewPageHutaoPassportPasswordRequirementHint}"/>
<StackPanel Spacing="4" Visibility="{x:Bind VerifyCode, Converter={StaticResource EmptyStringToVisibilityConverter}}">
<PasswordBox
Width="360"
MaxWidth="360"
IsEnabled="{x:Bind VerifyCode, Converter={StaticResource EmptyStringToBoolConverter}, Mode=OneWay}"
Password="{x:Bind Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
PasswordChar="*"
PlaceholderText="{shuxm:ResourceString Name=ViewPageHutaoPassportPasswordHint}"/>
<TextBlock
Opacity="0.7"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{shuxm:ResourceString Name=ViewPageHutaoPassportPasswordRequirementHint}"/>
</StackPanel>
</StackPanel>
</ContentDialog>
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,41 @@
Style="{StaticResource DefaultContentDialogStyle}"
mc:Ignorable="d">

<StackPanel>
<StackPanel Margin="0,8,0,0" Spacing="16">
<TextBox
x:Name="UserNameTextBox"
InputScope="EmailSmtpAddress"
IsSpellCheckEnabled="False"
PlaceholderText="{shuxm:ResourceString Name=ViewPageHutaoPassportUserNameHint}"
Text="{x:Bind UserName, Mode=TwoWay}"/>
<Grid Margin="0,16,0,0" ColumnSpacing="16">
<Grid ColumnSpacing="16">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<TextBox PlaceholderText="{shuxm:ResourceString Name=ViewPageHutaoPassportVerifyCodeHint}" Text="{x:Bind VerifyCode, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<TextBox
Grid.Column="0"
PlaceholderText="{shuxm:ResourceString Name=ViewPageHutaoPassportVerifyCodeHint}"
Text="{x:Bind VerifyCode, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<Button
Grid.Column="1"
VerticalAlignment="Stretch"
Command="{x:Bind VerifyCommand}"
Content="{shuxm:ResourceString Name=ViewPageHutaoPassportVerifyCodeAction}"/>
</Grid>
<PasswordBox
Width="360"
MaxWidth="360"
Margin="0,16,0,0"
IsEnabled="{x:Bind VerifyCode, Converter={StaticResource StringBoolConverter}, Mode=OneWay}"
Password="{x:Bind Password, Mode=TwoWay}"
PasswordChar="*"
PlaceholderText="{shuxm:ResourceString Name=ViewPageHutaoPassportPasswordHint}"/>
<TextBlock
Margin="0,4,0,0"
Opacity="0.7"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{shuxm:ResourceString Name=ViewPageHutaoPassportPasswordRequirementHint}"/>
<StackPanel Spacing="4" Visibility="{x:Bind VerifyCode, Converter={StaticResource EmptyStringToVisibilityConverter}}">
<PasswordBox
Width="360"
MaxWidth="360"
IsEnabled="{x:Bind VerifyCode, Converter={StaticResource EmptyStringToBoolConverter}, Mode=OneWay}"
Password="{x:Bind Password, Mode=TwoWay}"
PasswordChar="*"
PlaceholderText="{shuxm:ResourceString Name=ViewPageHutaoPassportPasswordHint}"/>
<TextBlock
Margin="0,4,0,0"
Opacity="0.7"
Style="{StaticResource CaptionTextBlockStyle}"
Text="{shuxm:ResourceString Name=ViewPageHutaoPassportPasswordRequirementHint}"/>
</StackPanel>
</StackPanel>
</ContentDialog>
Original file line number Diff line number Diff line change
Expand Up @@ -12,47 +12,52 @@
Style="{StaticResource DefaultContentDialogStyle}"
mc:Ignorable="d">

<StackPanel>
<StackPanel Margin="0,8,0,0" Spacing="16">
<TextBox
x:Name="UserNameTextBox"
InputScope="EmailSmtpAddress"
IsSpellCheckEnabled="False"
PlaceholderText="{shuxm:ResourceString Name=ViewPageHutaoPassportUserNameHint}"
Text="{x:Bind UserName, Mode=TwoWay}"/>
<Grid Margin="0,16,0,0" ColumnSpacing="16">
<Grid ColumnSpacing="16">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<TextBox PlaceholderText="{shuxm:ResourceString Name=ViewPageHutaoPassportVerifyCodeHint}" Text="{x:Bind VerifyCode, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<TextBox
Grid.Column="0"
PlaceholderText="{shuxm:ResourceString Name=ViewPageHutaoPassportVerifyCodeHint}"
Text="{x:Bind VerifyCode, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<Button
Grid.Column="1"
VerticalAlignment="Stretch"
Command="{x:Bind VerifyOldCommand}"
Content="{shuxm:ResourceString Name=ViewPageHutaoPassportVerifyCodeAction}"/>
</Grid>
<TextBox
Margin="0,16,0,0"
InputScope="EmailSmtpAddress"
IsEnabled="{x:Bind VerifyCode, Converter={StaticResource StringBoolConverter}, Mode=OneWay}"
IsSpellCheckEnabled="False"
PlaceholderText="{shuxm:ResourceString Name=ViewPageHutaoPassportNewUserNameHint}"
Text="{x:Bind NewUserName, Mode=TwoWay}"/>
<Grid Margin="0,16,0,0" ColumnSpacing="16">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<StackPanel Spacing="16" Visibility="{x:Bind VerifyCode, Converter={StaticResource EmptyStringToVisibilityConverter}}">
<TextBox
IsEnabled="{x:Bind VerifyCode, Converter={StaticResource StringBoolConverter}, Mode=OneWay}"
PlaceholderText="{shuxm:ResourceString Name=ViewPageHutaoPassportVerifyCodeHint}"
Text="{x:Bind NewVerifyCode, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<Button
Grid.Column="1"
VerticalAlignment="Stretch"
Command="{x:Bind VerifyNewCommand}"
Content="{shuxm:ResourceString Name=ViewPageHutaoPassportVerifyCodeAction}"
IsEnabled="{x:Bind VerifyCode, Converter={StaticResource StringBoolConverter}, Mode=OneWay}"/>
</Grid>
InputScope="EmailSmtpAddress"
IsEnabled="{x:Bind VerifyCode, Converter={StaticResource EmptyStringToBoolConverter}, Mode=OneWay}"
IsSpellCheckEnabled="False"
PlaceholderText="{shuxm:ResourceString Name=ViewPageHutaoPassportNewUserNameHint}"
Text="{x:Bind NewUserName, Mode=TwoWay}"/>
<Grid ColumnSpacing="16">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<TextBox
Grid.Column="0"
IsEnabled="{x:Bind VerifyCode, Converter={StaticResource EmptyStringToBoolConverter}, Mode=OneWay}"
PlaceholderText="{shuxm:ResourceString Name=ViewPageHutaoPassportVerifyCodeHint}"
Text="{x:Bind NewVerifyCode, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<Button
Grid.Column="1"
VerticalAlignment="Stretch"
Command="{x:Bind VerifyNewCommand}"
Content="{shuxm:ResourceString Name=ViewPageHutaoPassportVerifyCodeAction}"
IsEnabled="{x:Bind VerifyCode, Converter={StaticResource EmptyStringToBoolConverter}, Mode=OneWay}"/>
</Grid>
</StackPanel>
</StackPanel>
</ContentDialog>
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
Style="{StaticResource DefaultContentDialogStyle}"
mc:Ignorable="d">

<StackPanel Margin="0,8,0,0">
<StackPanel Margin="0,8,0,0" Spacing="16">
<InfoBar
Title="{shuxm:ResourceString Name=ViewPageHutaoPassportUnregisterHint}"
IsClosable="False"
Expand All @@ -25,25 +25,29 @@
IsSpellCheckEnabled="False"
PlaceholderText="{shuxm:ResourceString Name=ViewPageHutaoPassportUserNameHint}"
Text="{x:Bind UserName, Mode=TwoWay}"/>
<Grid Margin="0,16,0,0" ColumnSpacing="16">
<Grid ColumnSpacing="16">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<TextBox PlaceholderText="{shuxm:ResourceString Name=ViewPageHutaoPassportVerifyCodeHint}" Text="{x:Bind VerifyCode, Mode=TwoWay}"/>
<TextBox
Grid.Column="0"
PlaceholderText="{shuxm:ResourceString Name=ViewPageHutaoPassportVerifyCodeHint}"
Text="{x:Bind VerifyCode, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
<Button
Grid.Column="1"
VerticalAlignment="Stretch"
Command="{x:Bind VerifyCommand}"
Content="{shuxm:ResourceString Name=ViewPageHutaoPassportVerifyCodeAction}"/>
</Grid>
<PasswordBox
Width="360"
MaxWidth="360"
Margin="0,16,0,0"
IsEnabled="{x:Bind VerifyCode, Converter={StaticResource StringBoolConverter}, Mode=OneWay}"
Password="{x:Bind Password, Mode=TwoWay}"
PasswordChar="*"
PlaceholderText="{shuxm:ResourceString Name=ViewPageHutaoPassportPasswordHint}"/>
<StackPanel Spacing="16" Visibility="{x:Bind VerifyCode, Converter={StaticResource EmptyStringToVisibilityConverter}}">
<PasswordBox
Width="360"
MaxWidth="360"
IsEnabled="{x:Bind VerifyCode, Converter={StaticResource EmptyStringToBoolConverter}, Mode=OneWay}"
Password="{x:Bind Password, Mode=TwoWay}"
PasswordChar="*"
PlaceholderText="{shuxm:ResourceString Name=ViewPageHutaoPassportPasswordHint}"/>
</StackPanel>
</StackPanel>
</ContentDialog>
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
Style="{StaticResource DefaultContentDialogStyle}"
mc:Ignorable="d">

<TextBox
IsSpellCheckEnabled="False"
PlaceholderText="{shuxm:ResourceString Name=ViewPageHutaoPassportRedeemCodeHint}"
Text="{x:Bind RedeemCode, Mode=TwoWay}"/>
<StackPanel Margin="0,8,0,0" Spacing="16">
<TextBox
IsSpellCheckEnabled="False"
PlaceholderText="{shuxm:ResourceString Name=ViewPageHutaoPassportRedeemCodeHint}"
Text="{x:Bind RedeemCode, Mode=TwoWay}"/>
</StackPanel>
</ContentDialog>
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
<HyperlinkButton
Content="{shuxm:ResourceString Name=ViewPageAnnouncementViewDetails}"
NavigateUri="{Binding Link}"
Visibility="{Binding Link, Converter={StaticResource StringBoolConverter}}"/>
Visibility="{Binding Link, Converter={StaticResource EmptyStringToBoolConverter}}"/>
<TextBlock
Margin="8,0,0,2"
VerticalAlignment="Center"
Expand Down

0 comments on commit e8f9004

Please sign in to comment.