schangxiang@126.com
2025-11-04 f5ed29dc26c7cd952d56ec5721a2efc43cd25992
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<UserControl x:Class="XHandler.View.User.ResetPassword"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:XHandler.View.User"
             xmlns:str="clr-namespace:XHandler.Properties"
             xmlns:ctrl="clr-namespace:XHandler.Controls"
             mc:Ignorable="d" 
             d:DesignHeight="450" d:DesignWidth="800" Loaded="UserControl_Loaded">
    <UserControl.Resources>
        <Style x:Key="ToggleButtonStyle" TargetType="ToggleButton">
            <Setter Property="Margin" Value="5,0"></Setter>
            <Setter Property="Background" Value="Transparent"></Setter>
            <Setter Property="BorderThickness" Value="0"></Setter>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="ToggleButton">
                        <Grid Background="{TemplateBinding Background}">
                            <Image x:Name="IconImage" Source="pack://application:,,,/HxUserManagement;component/Assets/eyeoff.png"></Image>
                            <Image x:Name="IconImageOn" Source="pack://application:,,,/HxUserManagement;component/Assets/eyeon.png" Visibility="Hidden"></Image>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsChecked" Value="True">
                                <Setter TargetName="IconImageOn" Property="Visibility" Value="Visible"></Setter>
                                <Setter TargetName="IconImage" Property="Visibility" Value="Hidden"></Setter>
                            </Trigger>
                            <Trigger Property="IsChecked" Value="False">
                                <Setter TargetName="IconImage" Property="Visibility" Value="Visible"></Setter>
                                <Setter TargetName="IconImageOn" Property="Visibility" Value="Hidden"></Setter>
                            </Trigger>
                            <!--<Trigger Property="IsMouseOver" Value="True">
                                <Setter TargetName="IconImage" Property="Source" Value="pack://application:,,,/HxUserManagement;component/Assets/eyeon.png"></Setter>
                            </Trigger>-->
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style TargetType="PasswordBox">
            <Setter Property="VerticalContentAlignment" Value="Center"></Setter>
            <Setter Property="Padding" Value="5,0"></Setter>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="PasswordBox">
                        <Border Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="{TemplateBinding BorderThickness}"
                                CornerRadius="4">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*"></ColumnDefinition>
                                    <ColumnDefinition Width="32"></ColumnDefinition>
                                </Grid.ColumnDefinitions>
                                <ScrollViewer Grid.Column="0" x:Name="PART_ContentHost"></ScrollViewer>
                                <TextBlock  Grid.Column="0" x:Name="MessageTextBlock"
                                           Text="{TemplateBinding Tag}"
                                           FontSize="{TemplateBinding FontSize}"
                                           Foreground="{TemplateBinding Foreground}"
                                           Padding="{TemplateBinding Padding}"
                                           VerticalAlignment="Center"
                                           Visibility="Hidden"></TextBlock>
                                <TextBox Grid.Column="0" VerticalContentAlignment="Center"
                                         BorderThickness="0" Visibility="Hidden"
                                         FontSize="{TemplateBinding FontSize}"
                                         Foreground="{TemplateBinding Foreground}"
                                         Margin="{TemplateBinding Padding}"
                                         Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=PasswordBox}, Path=(ctrl:PasswordBoxAttached.Password)}"
                                         x:Name="PasswordTextBox"></TextBox>
                                <ToggleButton Grid.Column="1" x:Name="CheckedToggleButton" Focusable="False" 
                                              Style="{StaticResource ToggleButtonStyle}"></ToggleButton>
                            </Grid>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsFocused" Value="True">
                                <Setter Property="BorderBrush" Value="{DynamicResource BrushPrimary}"></Setter>
                            </Trigger>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="BorderBrush" Value="{DynamicResource BrushPrimary}"></Setter>
                            </Trigger>
                            <!--<MultiTrigger>
                                <MultiTrigger.Conditions>
                                    <Condition Property="IsKeyboardFocused" Value="False"></Condition>
                                    <Condition Property="ctrl:PasswordBoxAttached.Password" Value=""></Condition>
                                </MultiTrigger.Conditions>
                                <Setter TargetName="MessageTextBlock" Property="Visibility" Value="Visible"></Setter>
                                <Setter TargetName="MessageTextBlock" Property="Opacity" Value="0.5"></Setter>
                            </MultiTrigger>-->
                            <DataTrigger Binding="{Binding ElementName=CheckedToggleButton, Path=IsChecked}" Value="True">
                                <Setter TargetName="PasswordTextBox" Property="Visibility" Value="Visible"></Setter>
                                <Setter TargetName="PART_ContentHost" Property="Visibility" Value="Hidden"></Setter>
                            </DataTrigger>
                            <DataTrigger Binding="{Binding ElementName=CheckedToggleButton, Path=IsChecked}" Value="Flase">
                                <Setter TargetName="PasswordTextBox" Property="Visibility" Value="Hidden"></Setter>
                                <Setter TargetName="PART_ContentHost" Property="Visibility" Value="Visible"></Setter>
                            </DataTrigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
 
    <Grid x:Name="root" Background="#01FFFFFF" PreviewMouseDown="root_PreviewMouseDown">
        <Border x:Name="border" Width="0" Visibility="Collapsed" HorizontalAlignment="Right" Background="White" BorderBrush="LightGray"
            BorderThickness="1">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="100"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="50"/>
                    <RowDefinition Height="20"/>
                    <RowDefinition Height="40"/>
                    <RowDefinition Height="30"/>
                    <RowDefinition Height="30"/>
                    <RowDefinition Height="40"/>
                    <RowDefinition Height="30"/>
                    <RowDefinition Height="30"/>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="200"/>
                </Grid.RowDefinitions>
                <Grid Grid.Row="0" Grid.ColumnSpan="2">
                    <TextBlock x:Name="title" Text="{x:Static str:UserResource.strPSWDReset}" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="20 0" FontSize="20"
                               Foreground="Black" FontWeight="Bold"/>
                    <Button Content="×" HorizontalAlignment="Right" VerticalAlignment="Center" VerticalContentAlignment="Center" Margin="10 0" FontSize="28" Width="40" Height="40"
                            FontWeight="Bold" Foreground="Black" Style="{DynamicResource BlueButtonStyle}" Background="White" Click="Button_Click" BorderThickness="0"/>
                    <Rectangle Height="1" Fill="Gray" VerticalAlignment="Bottom" Margin="15 0"/>
                </Grid>
 
                <TextBlock Grid.Row="2" Grid.Column="0" Text="{x:Static str:UserResource.strNewPassword}" FontSize="16" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                <!--<TextBox x:Name="textboxNewPswd" Grid.Row="2" Grid.Column="1" Height="35" VerticalContentAlignment="Center" HorizontalAlignment="Stretch" 
                         VerticalAlignment="Center" FontSize="16" Margin="10 0 100 0" TextChanged="textboxNewPswd_TextChanged" BorderBrush="DarkGray"
                         Text="" LostFocus="textboxNewPswd_LostFocus"/>-->
                <PasswordBox x:Name="textboxNewPswd" Grid.Row="2" Grid.Column="1" Height="35" VerticalContentAlignment="Center" HorizontalAlignment="Stretch" 
                         VerticalAlignment="Center" FontSize="16" Margin="10 0 100 0" BorderBrush="DarkGray"
                         PasswordChanged="textboxNewPswd_PasswordChanged" Visibility="Visible"/>
                <StackPanel Name="stkPwdkeyStrongth" Grid.Row="3" Orientation="Horizontal" Visibility="Collapsed">
                    <Button x:Name="lessPwd"  Width="100" BorderThickness="0" Background="Red"></Button>
                    <TextBlock Text="|" Margin="10,0,10,0"></TextBlock>
                    <Border x:Name="midPwd"  Width="100" BorderThickness="0" Background="Orange"></Border>
                    <TextBlock Text="|" Margin="10,0,10,0"></TextBlock>
                    <Border x:Name="strongPwd"  Width="100" BorderThickness="0" Background="Green"></Border>
                </StackPanel>
                <TextBlock x:Name="pswdTips" Grid.Row="4" Grid.Column="1" Text="" FontSize="14" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10 0"
                           Foreground="Red" Visibility="Collapsed"/>
 
                <TextBlock Grid.Row="5" Grid.Column="0" Text="{x:Static str:UserResource.strConfirmPassword}" FontSize="16" VerticalAlignment="Center" HorizontalAlignment="Right"/>
                <!--<TextBox x:Name="textboxConfirmPswd" Grid.Row="4" Grid.Column="1" Height="35" VerticalContentAlignment="Center" HorizontalAlignment="Stretch" 
                         VerticalAlignment="Center" FontSize="16" Margin="10 0 100 0" MaxLength="11" TextChanged="textboxConfirmPswd_TextChanged" BorderBrush="DarkGray"
                         Text="" LostFocus="textboxConfirmPswd_LostFocus"/>-->
                <PasswordBox x:Name="textboxConfirmPswd" Grid.Row="5" Grid.Column="1" Height="35" VerticalContentAlignment="Center" HorizontalAlignment="Stretch" 
                         VerticalAlignment="Center" FontSize="16" Margin="10 0 100 0" BorderBrush="DarkGray"
                         PasswordChanged="textboxConfirmPswd_PasswordChanged" Visibility="Visible"/>
                <StackPanel Name="stkPwdkey" Grid.Row="6">
                    <!--<ProgressBar x:Name="lessPwd" Value="0" Maximum="1" Minimum="0" Width="100" Background="LightGreen"></ProgressBar>
                    <TextBlock Text="|" Margin="10,0,10,0"></TextBlock>
                    <ProgressBar x:Name="midPwd" Value="0" Maximum="1" Minimum="0" Width="100" Background="LightYellow"></ProgressBar>
                    <TextBlock Text="|" Margin="10,0,10,0"></TextBlock>
                    <ProgressBar x:Name="strongPwd" Value="0" Maximum="1" Minimum="0" Width="100" Background="Red"></ProgressBar>-->
                </StackPanel>
                <TextBlock x:Name="pswdConfirmTips" Grid.Row="7" Grid.Column="1" Text="" FontSize="14" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10 0"
                           Foreground="Red" Visibility="Collapsed"/>
 
 
                <Button Content="{x:Static str:UserResource.strCancel}" x:Name="btnCancel" Grid.Row="9" Grid.Column="1" HorizontalAlignment="Right" 
                        Foreground="Black" Style="{DynamicResource BlueButtonStyle}" Background="White" BorderThickness="1" BorderBrush="Black"
                        Height="40" Width="100" Click="btnCancel_Click" FontSize="16" Margin="0 0 150 0" />
 
                <Button Content="{x:Static str:UserResource.strSave}" x:Name="btnSave" Grid.Row="8" Grid.Column="1" HorizontalAlignment="Right" 
                        Foreground="White" Style="{DynamicResource BlueButtonStyle}" Background="{DynamicResource blueBrush}" BorderThickness="0"
                        Height="40" Width="100" Click="btnSave_Click" FontSize="16" Margin="0 0 20 0"/>
 
 
            </Grid>
        </Border>
    </Grid>
</UserControl>