alielie
2025-03-11 2e54b439c64e0adbb7e010243c1f33aa5fc5f503
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
<pu:WindowX x:Class="WPFProject.Login"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
            xmlns:local="clr-namespace:WPFProject"
            xmlns:pu="https://opensource.panuon.com/wpf-ui"
            xmlns:purs="clr-namespace:Panuon.WPF.UI.Resources;assembly=Panuon.WPF.UI"
            xmlns:dp="clr-namespace:HMI.UI.DpUtil;assembly=HMI.UI"
            mc:Ignorable="d"
            Title="{Binding Converter={StaticResource lc},ConverterParameter='App.Login'}"
            pu:WindowXCaption.Foreground="#FFF"
            Height="420"
            Width="380"
            pu:WindowXCaption.Background="Transparent"
            Background="{StaticResource VerBar}"
            pu:WindowXCaption.Buttons="Close">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <pu:StyleDictionary Includes="PasswordBox"/>
                <ResourceDictionary Source="/HMI.UI;component/Resources/Font/Font.xaml"/>
                <ResourceDictionary Source="/HMI.UI;component/Style/Colors.xaml"/>
            </ResourceDictionary.MergedDictionaries>
 
            <Style x:Key="SignInPasswordBoxStyle" TargetType="PasswordBox" BasedOn="{StaticResource {x:Type PasswordBox}}">
                <Setter Property="pu:PasswordBoxHelper.FocusedBorderBrush" Value="#6CBCEA" />
                <Setter Property="pu:PasswordBoxHelper.FocusedShadowColor" Value="#6CBCEA" />
                <Setter Property="pu:PasswordBoxHelper.CornerRadius" Value="2" />
                <Setter Property="pu:PasswordBoxHelper.WatermarkForeground" Value="#4A4A4A" />
                <Setter Property="pu:PasswordBoxHelper.FocusedWatermarkForeground" Value="#AAAAAA" />
                <Setter Property="pu:PasswordBoxHelper.ClearButtonVisibility" Value="VisibleOnHoverAndNonnull" />
                <Setter Property="Height" Value="35" />
                <Setter Property="Padding" Value="10,0" />
            </Style>
 
            <Style x:Key="SignInButtonStyle" TargetType="Button" BasedOn="{StaticResource PrimaryButton}">
                <Setter Property="pu:ButtonHelper.PendingSpinStyle">
                    <Setter.Value>
                        <Style TargetType="pu:Spin" BasedOn="{StaticResource {x:Static pu:ButtonHelper.PendingSpinStyleKey}}">
                            <Setter Property="SpinStyle" Value="Ring2" />
                        </Style>
                    </Setter.Value>
                </Setter>
                <Style.Triggers>
                    <Trigger Property="pu:ButtonHelper.IsPending" Value="True">
                        <Setter Property="IsEnabled" Value="False"/>
                        <Setter Property="pu:ButtonHelper.ClickEffect" Value="Shake" />
                        <Setter Property="ContentTemplate">
                            <Setter.Value>
                                <DataTemplate>
                                    <TextBlock Text="{Binding Converter={StaticResource lc},
                                        ConverterParameter='App.PleaseWait'}" />
                                </DataTemplate>
                            </Setter.Value>
                        </Setter>
                    </Trigger>
                </Style.Triggers>
            </Style>
 
            <Style x:Key="RememberMeSwitchStyle"
       TargetType="pu:Switch">
                <Setter Property="ContentPlacement"
            Value="Left" />
                <Setter Property="BoxHeight"
            Value="16" />
                <Setter Property="BoxWidth"
            Value="32" />
                <Setter Property="CheckedBackground"
            Value="#6CBCEA" />
                <Setter Property="Background"
            Value="#DEDEDE" />
                <Setter Property="BorderBrush"
            Value="#DEDEDE" />
                <Setter Property="Foreground"
            Value="DimGray" />
                <Setter Property="ToggleSize"
            Value="10" />
                <Setter Property="ToggleShadowColor"
            Value="{x:Null}" />
                <Setter Property="CheckedBorderBrush"
            Value="#6CBCEA" />
            </Style>
 
            <Style TargetType="pu:FormGroup" BasedOn="{StaticResource InputFormGroupStyle}">
                <Setter Property="Width" Value="250" />
                <Setter Property="HeaderForeground" Value="White" />
            </Style>
 
        </ResourceDictionary>
    </Window.Resources>
 
    <Grid HorizontalAlignment="Center"
      VerticalAlignment="Center"
      Margin="0,-30,0,0">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Image Height="25"
               Stretch="Uniform"
           HorizontalAlignment="Left"
           Source="/Resources/JingCeLogo.png"
           RenderOptions.BitmapScalingMode="HighQuality" />
        <StackPanel Margin="0,50,0,0" Grid.Row="1" x:Name="formPanel" dp:StackPanelHelper.ChildSpace="20" >
            <pu:FormGroup x:Name="FrmAccount"
                          dp:FormGroupHelper.IsRequired="True">
                <TextBox x:Name="TbAccount" Style="{StaticResource EditorTextBoxStyle}"
         Background="White"
         pu:TextBoxHelper.InputLimit="UpperCaseLetters,LowerCaseLetters,Digit"
         pu:TextBoxHelper.Watermark="{Binding Converter={StaticResource lc},ConverterParameter='App.Username'}"/>
            </pu:FormGroup>
            <pu:FormGroup x:Name="FrmPassword" HeaderPadding="0,0,0,10"
          dp:FormGroupHelper.IsRequired="True"
          MinMessageHeight="22">
                <PasswordBox x:Name="PwdPassword" VerticalContentAlignment="Center" 
                             Style="{StaticResource SignInPasswordBoxStyle}" 
                             pu:PasswordBoxHelper.Watermark="{Binding Converter={StaticResource lc},ConverterParameter='App.Password'}"/>
            </pu:FormGroup>
        </StackPanel>
        
        <pu:Switch Grid.Row="3"
               HorizontalAlignment="Right"
               Margin="0,25,0,0"
                   Cursor="Hand"
               Foreground="{StaticResource PrimaryColorContract}"
               Style="{StaticResource RememberMeSwitchStyle}"
               Content="{Binding Converter={StaticResource lc},ConverterParameter='App.RememberMe'}" />
        <Button Grid.Row="4"
            Margin="0,20,0,0"
            Height="40"
            Content="{Binding Converter={StaticResource lc},ConverterParameter='App.Login'}"
            Style="{StaticResource SignInButtonStyle}" x:Name="BtnLogin" Click="Button_Click">
        </Button>
    </Grid>
</pu:WindowX>