添加StyleLoginDesign

This commit is contained in:
YongAn 2021-07-26 02:50:35 +08:00
parent fc2fe0c7ec
commit 3b9e2039f6
43 changed files with 1520 additions and 44 deletions

View File

@ -8,6 +8,15 @@
<s:ApplicationLoader.Bootstrapper>
<local:Bootstrapper/>
</s:ApplicationLoader.Bootstrapper>
<s:ApplicationLoader.MergedDictionaries>
<ResourceDictionary>
<XmlDataProvider x:Key="Lang" Source="Languages/Languages.zh-CN.xml" XPath="language/resources" IsAsynchronous="False"/>
</ResourceDictionary>
<ResourceDictionary Source="./Styles/GlobalStyle.xaml"/>
<ResourceDictionary Source="./Styles/SplashStyle.xaml"/>
<ResourceDictionary Source="./Styles/LoginStyle.xaml"/>
</s:ApplicationLoader.MergedDictionaries>
</s:ApplicationLoader>
</Application.Resources>
</Application>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 777 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 882 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 704 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="2500" height="534" viewBox="0 0 1033.746 220.695"><path d="M1033.746 99.838v-18.18h-22.576V53.395l-.76.234-21.205 6.488-.418.127v21.415h-33.469v-11.93c0-5.555 1.242-9.806 3.69-12.641 2.431-2.801 5.908-4.225 10.343-4.225 3.188 0 6.489.751 9.811 2.232l.833.372V36.321l-.392-.144c-3.099-1.114-7.314-1.675-12.539-1.675-6.585 0-12.568 1.433-17.786 4.273-5.221 2.844-9.328 6.904-12.205 12.066-2.867 5.156-4.322 11.111-4.322 17.701v13.116h-15.72v18.18h15.72v76.589h22.567V99.838h33.469v48.671c0 20.045 9.455 30.203 28.102 30.203 3.064 0 6.289-.359 9.582-1.062 3.352-.722 5.635-1.443 6.979-2.213l.297-.176v-18.348l-.918.607c-1.225.816-2.75 1.483-4.538 1.979-1.796.505-3.296.758-4.458.758-4.368 0-7.6-1.177-9.605-3.5-2.028-2.344-3.057-6.443-3.057-12.177V99.838h22.575zM866.635 160.26c-8.191 0-14.649-2.716-19.2-8.066-4.579-5.377-6.899-13.043-6.899-22.783 0-10.049 2.32-17.914 6.901-23.386 4.554-5.436 10.95-8.195 19.014-8.195 7.825 0 14.054 2.635 18.516 7.836 4.484 5.228 6.76 13.03 6.76 23.196 0 10.291-2.14 18.196-6.36 23.484-4.191 5.248-10.493 7.914-18.732 7.914m1.003-80.885c-15.627 0-28.039 4.579-36.889 13.61-8.844 9.032-13.328 21.531-13.328 37.153 0 14.838 4.377 26.773 13.011 35.468 8.634 8.698 20.384 13.104 34.921 13.104 15.148 0 27.313-4.643 36.159-13.799 8.845-9.146 13.326-21.527 13.326-36.784 0-15.07-4.205-27.094-12.502-35.731-8.301-8.641-19.977-13.021-34.698-13.021m-86.602 0c-10.63 0-19.423 2.719-26.14 8.08-6.758 5.393-10.186 12.466-10.186 21.025 0 4.449.74 8.401 2.196 11.753 1.465 3.363 3.732 6.324 6.744 8.809 2.989 2.465 7.603 5.047 13.717 7.674 5.14 2.115 8.973 3.904 11.408 5.314 2.38 1.382 4.069 2.771 5.023 4.124.927 1.324 1.397 3.136 1.397 5.372 0 6.367-4.768 9.465-14.579 9.465-3.639 0-7.79-.76-12.337-2.258a46.347 46.347 0 0 1-12.634-6.406l-.937-.672v21.727l.344.16c3.193 1.474 7.219 2.717 11.964 3.695 4.736.979 9.039 1.477 12.777 1.477 11.535 0 20.824-2.732 27.602-8.125 6.821-5.43 10.278-12.67 10.278-21.525 0-6.388-1.861-11.866-5.529-16.284-3.643-4.382-9.966-8.405-18.785-11.961-7.026-2.82-11.527-5.161-13.384-6.958-1.79-1.736-2.699-4.191-2.699-7.3 0-2.756 1.122-4.964 3.425-6.752 2.321-1.797 5.552-2.711 9.604-2.711 3.76 0 7.607.594 11.433 1.758 3.823 1.164 7.181 2.723 9.984 4.63l.922.63v-20.61l-.354-.152c-2.586-1.109-5.996-2.058-10.138-2.828-4.123-.765-7.863-1.151-11.116-1.151m-95.157 80.885c-8.189 0-14.649-2.716-19.199-8.066-4.58-5.377-6.896-13.041-6.896-22.783 0-10.049 2.319-17.914 6.901-23.386 4.55-5.436 10.945-8.195 19.013-8.195 7.822 0 14.051 2.635 18.514 7.836 4.485 5.228 6.76 13.03 6.76 23.196 0 10.291-2.141 18.196-6.361 23.484-4.191 5.248-10.49 7.914-18.732 7.914m1.006-80.885c-15.631 0-28.044 4.579-36.889 13.61-8.844 9.032-13.331 21.531-13.331 37.153 0 14.844 4.38 26.773 13.014 35.468 8.634 8.698 20.383 13.104 34.92 13.104 15.146 0 27.314-4.643 36.16-13.799 8.843-9.146 13.326-21.527 13.326-36.784 0-15.07-4.206-27.094-12.505-35.731-8.303-8.641-19.977-13.021-34.695-13.021M602.409 98.07V81.658h-22.292v94.767h22.292v-48.477c0-8.243 1.869-15.015 5.557-20.13 3.641-5.054 8.493-7.615 14.417-7.615 2.008 0 4.262.331 6.703.986 2.416.651 4.166 1.358 5.198 2.102l.937.679V81.496l-.361-.155c-2.076-.882-5.013-1.327-8.729-1.327-5.602 0-10.615 1.8-14.909 5.344-3.769 3.115-6.493 7.386-8.576 12.712h-.237zm-62.213-18.695c-10.227 0-19.349 2.193-27.108 6.516-7.775 4.333-13.788 10.519-17.879 18.385-4.073 7.847-6.141 17.013-6.141 27.235 0 8.954 2.005 17.171 5.968 24.413 3.965 7.254 9.577 12.929 16.681 16.865 7.094 3.931 15.293 5.924 24.371 5.924 10.594 0 19.639-2.118 26.891-6.295l.293-.168v-20.423l-.937.684c-3.285 2.393-6.956 4.303-10.906 5.679-3.94 1.375-7.532 2.07-10.682 2.07-8.747 0-15.769-2.737-20.866-8.133-5.108-5.403-7.698-12.99-7.698-22.537 0-9.607 2.701-17.389 8.024-23.131 5.307-5.725 12.342-8.629 20.908-8.629 7.327 0 14.467 2.481 21.222 7.381l.935.679V84.371l-.302-.17c-2.542-1.423-6.009-2.598-10.313-3.489-4.286-.889-8.478-1.337-12.461-1.337m-66.481 2.284h-22.292v94.766h22.292V81.659zm-10.918-40.371c-3.669 0-6.869 1.249-9.498 3.724-2.64 2.482-3.979 5.607-3.979 9.295 0 3.63 1.323 6.698 3.938 9.114 2.598 2.409 5.808 3.63 9.54 3.63 3.731 0 6.953-1.221 9.582-3.626 2.646-2.42 3.988-5.487 3.988-9.118 0-3.559-1.306-6.652-3.879-9.195-2.571-2.538-5.833-3.824-9.692-3.824m-55.62 33.379v101.758h22.75V44.189H398.44l-40.022 98.221-38.839-98.221H286.81v132.235h21.379V74.657h.734l41.013 101.768h16.134l40.373-101.758h.734z" fill="#706d6e"/><path d="M104.868 104.868H0V0h104.868v104.868z" fill="#f1511b"/><path d="M220.654 104.868H115.788V0h104.866v104.868z" fill="#80cc28"/><path d="M104.865 220.695H0V115.828h104.865v104.867z" fill="#00adef"/><path d="M220.654 220.695H115.788V115.828h104.866v104.867z" fill="#fbbc09"/></svg>

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 506 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 236 KiB

View File

@ -1,19 +1,29 @@
using StyletLoginDesign.Pages;
using Stylet;
using StyletIoC;
using StyletLoginDesign.Services;
using Stylet.Logging;
namespace StyletLoginDesign
{
public class Bootstrapper : Bootstrapper<ShellViewModel>
public class Bootstrapper : Bootstrapper<SplashViewModel>
{
protected override void ConfigureIoC(IStyletIoCBuilder builder)
{
// Configure the IoC container in here
builder.Bind<ILogger>().To<LoggerService>();
builder.Bind<ILogService>().To<LogService>();
builder.Bind<ILangService>().To<LangService>();
}
protected override void Configure()
{
// Perform any other configuration before the application starts
}
protected override void OnStart()
{
Stylet.Logging.LogManager.Enabled = true;
}
}
}

View File

@ -0,0 +1,176 @@
<UserControl
x:Class="StyletLoginDesign.Controls.Login.LoginAccountControl"
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:helper="clr-namespace:StyletLoginDesign.Helper"
mc:Ignorable="d"
d:DesignHeight="450"
d:DesignWidth="800"
>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<!--品牌Logo-->
<Image
Grid.Row="0"
Style="{StaticResource LoginLogoRawImage}"
/>
<!--错误提示-->
<Border Grid.Row="1" MinHeight="44">
<TextBlock
Text="{Binding ErrorMessage}"
Style="{StaticResource LoginErrorMessageTextBlock}"
/>
</Border>
<!--商户号-->
<Border Grid.Row="2" Style="{StaticResource LoginInputControlBorder}" IsEnabled="{Binding TenantCodeIsEnabled}">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Image
Grid.Column="0"
Style="{StaticResource LoginIcoImageForTenant}"
/>
<TextBox
Grid.Column="1"
Style="{StaticResource LoginTenantInputTextBox}"
x:Name="TenantCode"
InputMethod.IsInputMethodEnabled="False"
Text="{Binding TenantCode,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
IsReadOnly="{Binding TenantCodeIsReadOnly}"
>
<TextBox.InputBindings>
<KeyBinding Key="Return" Command="{Binding LoginCommand, Mode=OneWay}"/>
</TextBox.InputBindings>
</TextBox>
</Grid>
</Border>
<!--账号-->
<Border Grid.Row="3" Style="{StaticResource LoginInputControlBorder}" IsEnabled="{Binding UserNameIsEnabled}">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Image
Grid.Column="0"
Style="{StaticResource LoginIcoImageForUser}"
/>
<TextBox
Grid.Column="1"
Style="{StaticResource LoginAccountInputTextBox}"
x:Name="Account"
InputMethod.IsInputMethodEnabled="False"
Text="{Binding UserName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
IsReadOnly="{Binding UserNameIsReadOnly}"
>
<TextBox.InputBindings>
<KeyBinding Key="Return" Command="{Binding LoginCommand, Mode=OneWay}"/>
</TextBox.InputBindings>
</TextBox>
</Grid>
</Border>
<!--密码-->
<Border Grid.Row="4" Style="{StaticResource LoginInputControlBorder}" IsEnabled="{Binding PasswordIsEnabled}">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Image
Grid.Column="0"
Style="{StaticResource LoginIcoImageForPassword}"
/>
<PasswordBox
Grid.Column="1"
Style="{StaticResource LoginPasswordInputTextBox}"
x:Name="Password"
helper:PasswordBoxHelper.Attach="True"
helper:PasswordBoxHelper.Password="{Binding Password,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
PasswordChar="*"
IsEnabled="{Binding PasswordIsEnabled}"
>
<PasswordBox.InputBindings>
<KeyBinding Key="Return" Command="{Binding LoginCommand, Mode=OneWay}"/>
</PasswordBox.InputBindings>
</PasswordBox>
</Grid>
</Border>
<!--键盘-->
<Button
Grid.Row="5"
IsEnabled="{Binding LoginKeyboardButtonEnabled}"
Style="{StaticResource LoginKeyboardButton}"
Command="{Binding OpenSystemKeyboardCommand}"
/>
<!--确认登录-->
<Button
Grid.Row="6"
IsEnabled="{Binding LoginConfirmButtonEnabled}"
Content="{Binding Source={StaticResource Lang},XPath=Login_Login}"
Style="{StaticResource LoginActionButton}"
Command="{Binding LoginCommand}"
>
<Button.InputBindings>
<KeyBinding Key="Return" Command="{Binding LoginCommand, Mode=OneWay}"/>
</Button.InputBindings>
</Button>
<!--注册账号-->
<Button
Grid.Row="7"
IsEnabled="{Binding LoginRegisterButtonEnabled}"
Style="{StaticResource LoginSwitchButton}"
Command="{Binding RegisterCommand}"
Content="{Binding Source={StaticResource Lang},XPath=Login_RegisterAccount}"
Visibility="{Binding IsOpenRegister,Converter={StaticResource BoolToVisConverter}}"
/>
<!--流程提示语-->
<TextBlock
Grid.Row="9"
Text="{Binding Message}"
Style="{StaticResource LoginStepTipTextBlock}"
/>
<!--重新绑定Mac地址提示-->
<Button
Grid.Row="9"
Visibility="{Binding MacBindingVisibility}"
Style="{StaticResource LoginWarningButton}"
Command="{Binding RebindingMacCommand}"
Content="{Binding Source={StaticResource Lang},XPath=Login_RebindMac}"
/>
</Grid>
</UserControl>

View File

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace StyletLoginDesign.Controls.Login
{
/// <summary>
/// LoginAccountControl.xaml 的交互逻辑
/// </summary>
public partial class LoginAccountControl : UserControl
{
public LoginAccountControl()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,21 @@
<UserControl
x:Class="StyletLoginDesign.Controls.Login.LoginLeftControl"
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:StyletLoginDesign.Controls.Login"
mc:Ignorable="d"
d:DesignHeight="480"
d:DesignWidth="400"
Width="400"
Background="Transparent"
>
<Border CornerRadius="8,0,0,8">
<Border.Background>
<ImageBrush ImageSource="../../Assets/Login/Login_SideShow_001.jpg"/>
</Border.Background>
</Border>
</UserControl>

View File

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace StyletLoginDesign.Controls.Login
{
/// <summary>
/// LoginLeftControl.xaml 的交互逻辑
/// </summary>
public partial class LoginLeftControl : UserControl
{
public LoginLeftControl()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,26 @@
<UserControl
x:Class="StyletLoginDesign.Controls.Login.LoginRightBarControl"
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:s="https://github.com/canton7/Stylet"
mc:Ignorable="d"
d:DesignHeight="50"
d:DesignWidth="400"
Height="50"
>
<Grid Margin="0,10,15,10">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Button
Grid.Column="1"
Style="{StaticResource LoginCloseButton}"
Command="{s:Action Close}"
/>
</Grid>
</UserControl>

View File

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace StyletLoginDesign.Controls.Login
{
/// <summary>
/// LoginRightBarControl.xaml 的交互逻辑
/// </summary>
public partial class LoginRightBarControl : UserControl
{
public LoginRightBarControl()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,29 @@
<UserControl
x:Class="StyletLoginDesign.Controls.Login.LoginRightControl"
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:StyletLoginDesign.Controls.Login"
mc:Ignorable="d"
d:DesignHeight="450"
d:DesignWidth="800"
>
<Border CornerRadius="0,8,8,0" Background="{StaticResource GlobalBackgroundColor}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
</Grid.RowDefinitions>
<local:LoginRightBarControl
Grid.Row="0"
/>
<local:LoginAccountControl
Grid.Row="1"
/>
</Grid>
</Border>
</UserControl>

View File

@ -0,0 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace StyletLoginDesign.Controls.Login
{
/// <summary>
/// LoginRightControl.xaml 的交互逻辑
/// </summary>
public partial class LoginRightControl : UserControl
{
public LoginRightControl()
{
InitializeComponent();
}
}
}

View File

@ -0,0 +1,75 @@
using System;
using System.Collections.Generic;
using System.Drawing.Printing;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Interop;
using System.Windows;
namespace StyletLoginDesign.Helper
{
public static class DwmDropShadow
{
[DllImport("dwmapi.dll", PreserveSig = true)]
private static extern int DwmSetWindowAttribute(IntPtr hwnd, int attr, ref int attrValue, int attrSize);
[DllImport("dwmapi.dll")]
private static extern int DwmExtendFrameIntoClientArea(IntPtr hWnd, ref Margins pMarInset);
/// <summary>
/// Drops a standard shadow to a WPF Window, even if the window is borderless. Only works with DWM (Windows Vista or newer).
/// This method is much more efficient than setting AllowsTransparency to true and using the DropShadow effect,
/// as AllowsTransparency involves a huge performance issue (hardware acceleration is turned off for all the window).
/// </summary>
/// <param name="window">Window to which the shadow will be applied</param>
public static void DropShadowToWindow(Window window)
{
if (!DropShadow(window))
{
window.SourceInitialized += new EventHandler(window_SourceInitialized);
}
}
private static void window_SourceInitialized(object sender, EventArgs e)
{
Window window = (Window)sender;
DropShadow(window);
window.SourceInitialized -= new EventHandler(window_SourceInitialized);
}
/// <summary>
/// The actual method that makes API calls to drop the shadow to the window
/// </summary>
/// <param name="window">Window to which the shadow will be applied</param>
/// <returns>True if the method succeeded, false if not</returns>
private static bool DropShadow(Window window)
{
try
{
WindowInteropHelper helper = new WindowInteropHelper(window);
int val = 2;
int ret1 = DwmSetWindowAttribute(helper.Handle, 2, ref val, 4);
if (ret1 == 0)
{
Margins m = new Margins { Bottom = 0, Left = 0, Right = 0, Top = 0 };
int ret2 = DwmExtendFrameIntoClientArea(helper.Handle, ref m);
return ret2 == 0;
}
else
{
return false;
}
}
catch (Exception ex)
{
// Probably dwmapi.dll not found (incompatible OS)
return false;
}
}
}
}

View File

@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
namespace StyletLoginDesign.Helper
{
/// <summary>
/// LanguageContextService
/// </summary>
public class LanguageContextService : Singleton<LanguageContextService>
{
/// <summary>
/// 多语言对象
/// </summary>
public XmlDataProvider Provider { get; set; }
}
}

View File

@ -0,0 +1,85 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows;
namespace StyletLoginDesign.Helper
{
/// <summary>
/// Password 绑定功能
/// </summary>
public static class PasswordBoxHelper
{
public static readonly DependencyProperty PasswordProperty =
DependencyProperty.RegisterAttached("Password",
typeof(string), typeof(PasswordBoxHelper),
new FrameworkPropertyMetadata(string.Empty, OnPasswordPropertyChanged));
public static readonly DependencyProperty AttachProperty =
DependencyProperty.RegisterAttached("Attach",
typeof(bool), typeof(PasswordBoxHelper), new PropertyMetadata(false, Attach));
private static readonly DependencyProperty IsUpdatingProperty =
DependencyProperty.RegisterAttached("IsUpdating", typeof(bool),
typeof(PasswordBoxHelper));
public static void SetAttach(DependencyObject dp, bool value)
{
dp.SetValue(AttachProperty, value);
}
public static bool GetAttach(DependencyObject dp)
{
return (bool)dp.GetValue(AttachProperty);
}
public static string GetPassword(DependencyObject dp)
{
return (string)dp.GetValue(PasswordProperty);
}
public static void SetPassword(DependencyObject dp, string value)
{
dp.SetValue(PasswordProperty, value);
}
private static bool GetIsUpdating(DependencyObject dp)
{
return (bool)dp.GetValue(IsUpdatingProperty);
}
private static void SetIsUpdating(DependencyObject dp, bool value)
{
dp.SetValue(IsUpdatingProperty, value);
}
private static void OnPasswordPropertyChanged(DependencyObject sender,
DependencyPropertyChangedEventArgs e)
{
PasswordBox passwordBox = sender as PasswordBox;
passwordBox.PasswordChanged -= PasswordChanged;
if (!(bool)GetIsUpdating(passwordBox))
{
passwordBox.Password = (string)e.NewValue;
}
passwordBox.PasswordChanged += PasswordChanged;
}
private static void Attach(DependencyObject sender,
DependencyPropertyChangedEventArgs e)
{
PasswordBox passwordBox = sender as PasswordBox;
if (passwordBox == null)
return;
if ((bool)e.OldValue)
{
passwordBox.PasswordChanged -= PasswordChanged;
}
if ((bool)e.NewValue)
{
passwordBox.PasswordChanged += PasswordChanged;
}
}
private static void PasswordChanged(object sender, RoutedEventArgs e)
{
PasswordBox passwordBox = sender as PasswordBox;
SetIsUpdating(passwordBox, true);
SetPassword(passwordBox, passwordBox.Password);
SetIsUpdating(passwordBox, false);
}
}
}

View File

@ -0,0 +1,29 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StyletLoginDesign.Helper
{
public class Singleton<T> where T : class, new()
{
private static T _instance;
private static readonly object SysLock = new object();
public static T Instance()
{
if (_instance == null)
{
lock (SysLock)
{
if (_instance == null)
{
_instance = new T();
}
}
}
return _instance;
}
}
}

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<language>
<resources>
<!-- Splash -->
<Splash_Title>Splash</Splash_Title>
<Splash_StatusDescription>Loading</Splash_StatusDescription>
<!-- Login -->
<Login_UserName>Please input account number</Login_UserName>
<Login_TenantName>Please input merchant code</Login_TenantName>
<Login_Password>Please input account password</Login_Password>>
<Login_Login>Login</Login_Login>
<Login_RebindMac>Rebind the Mac address</Login_RebindMac>
<Login_RegisterAccount>Register</Login_RegisterAccount>
<Login_MissMac>Login failed, MacAddress for current device does not found</Login_MissMac>
<Login_MissAccountName>Login failed, Account name does not found</Login_MissAccountName>
<Login_MissAccountPassword>Login failed, Account password does not found</Login_MissAccountPassword>
</resources>
</language>

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<language>
<resources>
<!-- Splash -->
<Splash_Title>启动</Splash_Title>
<Splash_StatusDescription>启动中</Splash_StatusDescription>
<!-- Login -->
<Login_UserName>请输入账号</Login_UserName>
<Login_TenantName>请输入商户号</Login_TenantName>
<Login_Password>请输入密码</Login_Password>
<Login_Login>登录</Login_Login>
<Login_RebindMac>重新绑定Mac地址</Login_RebindMac>
<Login_RegisterAccount>注册账号</Login_RegisterAccount>
<Login_MissMac>登录失败,无法获取您的真实Mac地址</Login_MissMac>
<Login_MissAccountName>登录失败,登陆账号不能为空</Login_MissAccountName>
<Login_MissAccountPassword>登录失败,登陆密码不能为空</Login_MissAccountPassword>
</resources>
</language>

View File

@ -0,0 +1,14 @@
namespace StyletLoginDesign.Models.Message
{
/// <summary>
/// 更新启动状态描述
/// </summary>
public class UpdateSplashStatusDescriptionEvent
{
/// <summary>
/// 状态描述
/// </summary>
/// <value></value>
public string StatusDescription { get; set; }
}
}

View File

@ -1,16 +1,32 @@
<Window x:Class="StyletLoginDesign.Pages.LoginView"
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:s="https://github.com/canton7/Stylet"
xmlns:local="clr-namespace:StyletLoginDesign.Pages"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance local:LoginViewModel}"
Title="Stylet Project" Height="450" Width="800">
<Grid>
<TextBlock FontSize="30" HorizontalAlignment="Center" VerticalAlignment="Center">
Login Design
</TextBlock>
</Grid>
<Window
x:Class="StyletLoginDesign.Pages.LoginView"
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:s="https://github.com/canton7/Stylet"
xmlns:local="clr-namespace:StyletLoginDesign.Pages" xmlns:login="clr-namespace:StyletLoginDesign.Controls.Login"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance local:LoginViewModel}"
Title="{Binding Title}"
MouseLeftButtonDown="{s:Action Window_MouseLeftButtonDown}"
WindowStartupLocation="CenterScreen"
Style="{StaticResource LoginWindowStyle}"
>
<Border Style="{StaticResource LoginBorderStyle}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<login:LoginLeftControl
Grid.Column="0"
/>
<login:LoginRightControl
Grid.Column="1"
/>
</Grid>
</Border>
</Window>

View File

@ -4,5 +4,24 @@ namespace StyletLoginDesign.Pages
{
public class LoginViewModel : Screen
{
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void Window_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
((System.Windows.Window)sender).DragMove();
}
/// <summary>
/// ´íÎóÌáʾ
/// </summary>
public string ErrorMessage { get; set; }
public void Close()
{
RequestClose();
}
}
}

View File

@ -1,16 +0,0 @@
<Window x:Class="StyletLoginDesign.Pages.ShellView"
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:s="https://github.com/canton7/Stylet"
xmlns:local="clr-namespace:StyletLoginDesign.Pages"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance local:ShellViewModel}"
Title="Stylet Project" Height="450" Width="800">
<Grid>
<TextBlock FontSize="30" HorizontalAlignment="Center" VerticalAlignment="Center">
Hello Stylet!
</TextBlock>
</Grid>
</Window>

View File

@ -1,8 +0,0 @@
using Stylet;
namespace StyletLoginDesign.Pages
{
public class ShellViewModel : Screen
{
}
}

View File

@ -0,0 +1,24 @@
<Window
x:Class="StyletLoginDesign.Pages.SplashView"
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:s="https://github.com/canton7/Stylet"
xmlns:local="clr-namespace:StyletLoginDesign.Pages"
mc:Ignorable="d"
d:DataContext="{d:DesignInstance local:SplashViewModel}"
Title="{Binding Title}"
MouseLeftButtonDown="{s:Action Window_MouseLeftButtonDown}"
WindowStartupLocation="CenterScreen"
Style="{StaticResource SplashWindowStyle}"
>
<Border Style="{StaticResource SplashBorderStyle}">
<TextBlock
Text="{Binding StatusDescription}"
Style="{StaticResource SplashStatusDescriptionStyle}"
/>
</Border>
</Window>

View File

@ -3,11 +3,11 @@
namespace StyletLoginDesign.Pages
{
/// <summary>
/// Interaction logic for ShellView.xaml
/// Interaction logic for SplashView.xaml
/// </summary>
public partial class ShellView : Window
public partial class SplashView : Window
{
public ShellView()
public SplashView()
{
InitializeComponent();
}

View File

@ -0,0 +1,138 @@
using System;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
using Stylet;
using StyletIoC;
using StyletLoginDesign.Helper;
using StyletLoginDesign.Models.Message;
using StyletLoginDesign.Services;
namespace StyletLoginDesign.Pages
{
/// <summary>
/// 启动界面
/// </summary>
public class SplashViewModel : Screen, IHandle<UpdateSplashStatusDescriptionEvent>
{
/// <summary>
/// 窗口管理
/// </summary>
private IWindowManager _windowManager;
/// <summary>
/// Ioc容器
/// </summary>
private readonly IContainer _container;
/// <summary>
/// 事件集线器
/// </summary>
private readonly IEventAggregator _eventAggregator;
/// <summary>
/// 语言服务
/// </summary>
private readonly ILangService _langService;
/// <summary>
/// 日志服务
/// </summary>
private readonly ILogService _logService;
/// <summary>
/// 构造函数
/// </summary>
/// <param name="windowManager"></param>
/// <param name="container"></param>
public SplashViewModel(IWindowManager windowManager, IContainer container, IEventAggregator eventAggregator, ILangService langService, ILogService logService)
{
_windowManager = windowManager;
_container = container;
_eventAggregator = eventAggregator;
_langService = langService;
_logService = logService;
}
/// <summary>
/// 页面标题
/// </summary>
public string Title { get; set; } = "启动页面";
/// <summary>
/// 状态描述
/// </summary>
public string StatusDescription { get; set; } = "Loading...";
/// <summary>
/// 响应鼠标左键按下的事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void Window_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
// 让窗体随着拖拽移动
((System.Windows.Window)sender).DragMove();
}
/// <summary>
/// 窗体加载完毕
/// </summary>
protected override void OnViewLoaded()
{
LanguageContextService.Instance().Provider = System.Windows.Application.Current.TryFindResource("Lang") as XmlDataProvider;
var lanSourcePath = $"Languages/Languages.{"en-US"}.xml";
var lanUri = new Uri(lanSourcePath, UriKind.Relative);
LanguageContextService.Instance().Provider.Source = lanUri;
LanguageContextService.Instance().Provider.Refresh();
// 开始状态更新
StartStatusUpdate();
}
/// <summary>
/// 开始状态更新
/// </summary>
private void StartStatusUpdate()
{
// 订阅消息
_eventAggregator.Subscribe(this);
var Splash_StatusDescription = _langService.GetXmlLocalizedString("Splash_StatusDescription");
// 异步线程通知更新
Task.Factory.StartNew(async () => {
for (var i = 0; i <= 99; i++)
{
await Task.Delay(TimeSpan.FromMilliseconds(12.5));
// 发送消息
_eventAggregator.Publish(new UpdateSplashStatusDescriptionEvent
{
StatusDescription = $"{Splash_StatusDescription}({i + 1}%)..."
}); ;
}
Execute.OnUIThread(()=> {
var loginViewModel = _container.Get<LoginViewModel>();
_windowManager.ShowWindow(loginViewModel);
RequestClose();
});
});
}
/// <summary>
/// 接收来自更新启动状态描述的消息
/// </summary>
/// <param name="message"></param>
public void Handle(UpdateSplashStatusDescriptionEvent message)
{
StatusDescription = message.StatusDescription;
_logService.LogDo("rizhi", "", GetType(), null);
}
}
}

View File

@ -0,0 +1,80 @@
using StyletLoginDesign.Helper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StyletLoginDesign.Services
{
public class LangService : ILangService
{
private ILogService _logService;
public LangService(ILogService logService)
{
_logService = logService;
}
/// <summary>
/// 丢失多语言上下文文档
/// </summary>
private readonly string MissLanguageContextDocument = "丢失多语言上下文文档";
/// <summary>
/// 未找到多语言文档Key
/// </summary>
private readonly string MissLanguageContextKey = "未找到多语言文档Key";
/// <summary>
/// GetXmlLocalizedString
/// </summary>
/// <param name="key"></param>
/// <param name="defaultMessage"></param>
/// <returns></returns>
public string GetXmlLocalizedString(string key, string defaultMessage = "")
{
if (string.IsNullOrEmpty(key))
return defaultMessage;
var langContent = defaultMessage;
try
{
var langDocument = LanguageContextService.Instance().Provider?.Document;
if (langDocument != null)
{
var langKeyPath = $"/language/resources/{key}";
var langKeyNode = langDocument?.SelectSingleNode(langKeyPath);
if (langKeyNode != null)
{
langContent = langKeyNode?.InnerText;
}
else
{
_logService.LogError(null, GetType(), MissLanguageContextKey, Guid.NewGuid().ToString());
}
}
else
{
_logService.LogError(null, GetType(), MissLanguageContextDocument, Guid.NewGuid().ToString());
}
}
catch (Exception ex)
{
_logService.LogError(ex, GetType(), MissLanguageContextKey, Guid.NewGuid().ToString());
}
return langContent;
}
}
public interface ILangService
{
/// <summary>
/// GetXmlLocalizedString
/// </summary>
/// <param name="key"></param>
/// <param name="defaultMessage"></param>
/// <returns></returns>
string GetXmlLocalizedString(string key, string defaultMessage = "");
}
}

View File

@ -0,0 +1,114 @@
using Stylet.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
namespace StyletLoginDesign.Services
{
public class LogService : ILogService
{
private ILogger _logger;
public LogService(ILogger logger)
{
_logger = logger;
}
/// <summary>
/// 记录入参日志
/// </summary>
/// <param name="description"></param>
/// <param name="typePoint"></param>
/// <param name="vo"></param>
/// <param name="requestId"></param>
public void LogVo(string description, Type typePoint, Object vo, string requestId)
{
var contentStr = vo != null ? JsonSerializer.Serialize(vo) : string.Empty;
_logger.Info($"{description}, 入参requestId {requestId} functionName:{ typePoint } content: {contentStr}");
}
/// <summary>
/// 记录入参日志
/// </summary>
/// <param name="description"></param>
/// <param name="typePoint"></param>
/// <param name="vo"></param>
/// <param name="requestId"></param>
/// <param name="requestIdVo"></param>
public void LogVo(string description, Type typePoint, Object vo, out string requestId, string requestIdVo = "")
{
requestId = !string.IsNullOrEmpty(requestIdVo) ? requestIdVo : Guid.NewGuid().ToString();
var contentStr = vo != null ? JsonSerializer.Serialize(vo) : string.Empty;
_logger.Info($"{description}, 入参requestId {requestId} functionName:{ typePoint } content: {contentStr}");
}
/// <summary>
/// 记录出参日志
/// </summary>
/// <param name="description"></param>
/// <param name="requestId"></param>
/// <param name="typePoint"></param>
/// <param name="dto"></param>
public void LogDo(string description, string requestId, Type typePoint, Object dto)
{
var contentStr = dto != null ? JsonSerializer.Serialize(dto) : string.Empty;
_logger.Info($"{description}, 出参requestId {requestId} functionName:{ typePoint } content: {contentStr}");
}
/// <summary>
/// 记录出参日志
/// </summary>
/// <param name="description"></param>
/// <param name="typePoint"></param>
/// <param name="dto"></param>
/// <param name="requestId"></param>
public void LogDo(string description, Type typePoint, object dto, string requestId)
{
var contentStr = dto != null ? JsonSerializer.Serialize(dto) : string.Empty;
_logger.Info($"{description}, 出参requestId {requestId} functionName:{ typePoint } content: {contentStr}");
}
/// <summary>
/// 记录出错日志
/// </summary>
/// <param name="ex"></param>
/// <param name="typePoint"></param>
/// <param name="description"></param>
/// <param name="requestId"></param>
public void LogError(Exception ex, Type typePoint, string description, string requestId)
{
_logger.Error(ex, $"{description}, 来源:requestId {requestId} functionName:{ typePoint }");
}
}
public interface ILogService
{
/// <summary>
/// 记录入参日志
/// </summary>
void LogVo(string description, Type typePoint, Object vo, string requestId);
/// <summary>
/// 记录入参日志
/// </summary>
void LogVo(string description, Type typePoint, Object vo, out string requestId, string requestIdVo = "");
/// <summary>
/// 记录出参日志
/// </summary>
void LogDo(string description, string requestId, Type typePoint, Object dto);
/// <summary>
/// 记录出参日志
/// </summary>
void LogDo(string description, Type typePoint, Object dto, string requestId);
/// <summary>
/// 记录出错日志
/// </summary>
void LogError(Exception ex, Type typePoint, string description, string requestId);
}
}

View File

@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StyletLoginDesign.Services
{
public class LoggerService : Stylet.Logging.ILogger
{
public LoggerService()
{
// TODO
}
public void Info(string format, params object[] args)
{
// TODO
}
public void Warn(string format, params object[] args)
{
// TODO
}
public void Error(Exception exception, string message = null)
{
// TODO
}
}
}

View File

@ -0,0 +1,27 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:system="clr-namespace:System;assembly=System.Runtime"
xmlns:s="https://github.com/canton7/Stylet"
>
<!-- 全局圆角 窗体 -->
<CornerRadius x:Key="GlobalRoundedCornerForWindow">8</CornerRadius>
<!-- 全局圆角 控件 -->
<CornerRadius x:Key="GlobalRoundedCornerForControl">4</CornerRadius>
<SolidColorBrush x:Key="GlobalBackgroundColor" Color="#FDFFFD"></SolidColorBrush>
<SolidColorBrush x:Key="GlobalForegroundColor" Color="#122246"></SolidColorBrush>
<SolidColorBrush x:Key="GlobalNormalColor" Color="#A4A4A4"></SolidColorBrush>
<SolidColorBrush x:Key="GlobalWarningColor" Color="#E41400"></SolidColorBrush>
<SolidColorBrush x:Key="GlobalDisableColor" Color="#CFD6DE"></SolidColorBrush>
<!-- 全局转换器 布尔值转可视化状态 -->
<s:BoolToVisibilityConverter
x:Key="BoolToVisConverter"
TrueVisibility="Visible"
FalseVisibility="Hidden"
/>
</ResourceDictionary>

View File

@ -0,0 +1,295 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<!-- 登录界面 窗体 -->
<Style x:Key="LoginWindowStyle" TargetType="{x:Type Window}">
<Setter Property="Width" Value="800" />
<Setter Property="Height" Value="480" />
<Setter Property="ResizeMode" Value="NoResize" />
<Setter Property="WindowStyle" Value="None" />
<Setter Property="AllowsTransparency" Value="True" />
<Setter Property="Background" Value="Transparent" />
</Style>
<!-- 登录界面 容器 -->
<Style x:Key="LoginBorderStyle" TargetType="{x:Type Border}">
<Setter Property="Background" Value="Transparent" />
<Setter Property="CornerRadius" Value="{StaticResource GlobalRoundedCornerForWindow}" />
<Setter Property="Margin" Value="8" />
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect ShadowDepth="0" BlurRadius="8"/>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="LoginCloseButton" TargetType="{x:Type Button}">
<Setter Property="Width" Value="30"/>
<Setter Property="Height" Value="30"/>
<Setter Property="HorizontalAlignment" Value="Right"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border>
<Border.Background>
<ImageBrush ImageSource="../Assets/Login/Login_Button_Close.png" Stretch="Uniform"/>
</Border.Background>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="LoginLogoRawImage" TargetType="{x:Type Image}">
<Setter Property="Source" Value="../Assets/Login/Login_logo.png"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Bottom"/>
<Setter Property="Height" Value="50"/>
<Setter Property="Margin" Value="0,0,0,0"/>
</Style>
<Style x:Key="LoginErrorMessageTextBlock" TargetType="{x:Type TextBlock}">
<Setter Property="Margin" Value="10,0"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="Foreground" Value="{StaticResource GlobalWarningColor}"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="TextAlignment" Value="Center"/>
<Setter Property="TextWrapping" Value="Wrap"></Setter>
</Style>
<Style x:Key="LoginInputControlBorder" TargetType="{x:Type Border}">
<Setter Property="Width" Value="271"/>
<Setter Property="Height" Value="43"/>
<Setter Property="Margin" Value="0,0,0,14"/>
<Setter Property="Background" Value="{StaticResource GlobalBackgroundColor}"/>
<Setter Property="CornerRadius" Value="{StaticResource GlobalRoundedCornerForControl}"/>
<Setter Property="BorderBrush" Value="#7B7CA4"/>
<Setter Property="BorderThickness" Value="1.5"/>
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="{StaticResource GlobalDisableColor}" />
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="LoginIcoImageForBase" TargetType="{x:Type Image}">
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Margin" Value="5,0"/>
<Setter Property="Width" Value="24"/>
<Setter Property="Height" Value="24"/>
</Style>
<Style x:Key="LoginIcoImageForTenant" BasedOn="{StaticResource LoginIcoImageForBase}" TargetType="{x:Type Image}">
<Setter Property="Source" Value="../Assets/Login/Login_Ico_Tenant.png"/>
</Style>
<Style x:Key="LoginIcoImageForPassword" BasedOn="{StaticResource LoginIcoImageForBase}" TargetType="{x:Type Image}">
<Setter Property="Source" Value="../Assets/Login/Login_Ico_Password.png"/>
</Style>
<Style x:Key="LoginIcoImageForUser" BasedOn="{StaticResource LoginIcoImageForBase}" TargetType="{x:Type Image}">
<Setter Property="Source" Value="../Assets/Login/Login_Ico_User.png"/>
</Style>
<Style x:Key="LoginIcoImageForShop" BasedOn="{StaticResource LoginIcoImageForBase}" TargetType="{x:Type Image}">
<Setter Property="Source" Value="../Assets/Login/Login_Ico_Shop.png"/>
</Style>
<Style x:Key="LoginIcoImageForDealCarrier" BasedOn="{StaticResource LoginIcoImageForBase}" TargetType="{x:Type Image}">
<Setter Property="Source" Value="../Assets/Login/Login_Ico_DealCarrier.png"/>
</Style>
<Style x:Key="LoginKeyboardButton" TargetType="{x:Type Button}">
<Setter Property="Width" Value="22"/>
<Setter Property="Height" Value="22"/>
<Setter Property="Margin" Value="58,-8,0,0"/>
<Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="VerticalAlignment" Value="Bottom"/>
<Setter Property="Opacity" Value="1"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="KeyboardBottonBorder">
<Border.Background>
<ImageBrush ImageSource="../Assets/Login/Login_Button_Keyboard.png" Stretch="Uniform"/>
</Border.Background>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" TargetName="KeyboardBottonBorder" Value="#fafafa" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.6"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="LoginNormalInputTextBox" TargetType="{x:Type TextBox}">
<Setter Property="Height" Value="43"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="FontSize" Value="17"/>
<Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
<Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{StaticResource GlobalForegroundColor}"/>
</Style>
<Style x:Key="LoginTenantInputTextBox" BasedOn="{StaticResource LoginNormalInputTextBox}" TargetType="{x:Type TextBox}">
<Style.Resources>
<VisualBrush x:Key="LoginTenantInputVisualBrush" TileMode="None" Opacity="0.5" Stretch="None" AlignmentX="Left">
<VisualBrush.Visual>
<TextBlock Text="{Binding Source={StaticResource Lang},XPath=Login_TenantName}" Foreground="{StaticResource GlobalForegroundColor}" />
</VisualBrush.Visual>
</VisualBrush>
</Style.Resources>
<Style.Triggers>
<Trigger Property="Text" Value="{x:Null}">
<Setter Property="Background" Value="{StaticResource LoginTenantInputVisualBrush}"/>
</Trigger>
<Trigger Property="Text" Value="">
<Setter Property="Background" Value="{StaticResource LoginTenantInputVisualBrush}"/>
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="LoginAccountInputTextBox" BasedOn="{StaticResource LoginNormalInputTextBox}" TargetType="{x:Type TextBox}">
<Style.Resources>
<VisualBrush x:Key="LoginAccountInputVisualBrush" TileMode="None" Opacity="0.5" Stretch="None" AlignmentX="Left">
<VisualBrush.Visual>
<TextBlock Text="{Binding Source={StaticResource Lang},XPath=Login_UserName}" Foreground="{StaticResource GlobalForegroundColor}" />
</VisualBrush.Visual>
</VisualBrush>
</Style.Resources>
<Style.Triggers>
<Trigger Property="Text" Value="{x:Null}">
<Setter Property="Background" Value="{StaticResource LoginAccountInputVisualBrush}"/>
</Trigger>
<Trigger Property="Text" Value="">
<Setter Property="Background" Value="{StaticResource LoginAccountInputVisualBrush}"/>
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="LoginPasswordInputTextBox" TargetType="{x:Type PasswordBox}">
<Setter Property="Height" Value="43"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="FontSize" Value="17"/>
<Setter Property="TextOptions.TextFormattingMode" Value="Display"/>
<Setter Property="TextOptions.TextRenderingMode" Value="ClearType"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="{StaticResource GlobalForegroundColor}"/>
<Style.Resources>
<VisualBrush x:Key="LoginPasswordInputVisualBrush" TileMode="None" Opacity="0.5" Stretch="None" AlignmentX="Left">
<VisualBrush.Visual>
<TextBlock Text="{Binding Source={StaticResource Lang},XPath=Login_Password}" Foreground="{StaticResource GlobalForegroundColor}"/>
</VisualBrush.Visual>
</VisualBrush>
</Style.Resources>
</Style>
<Style x:Key="LoginActionButton" TargetType="{x:Type Button}">
<Setter Property="Width" Value="271"/>
<Setter Property="Height" Value="43"/>
<Setter Property="Margin" Value="0,12,0,0"/>
<Setter Property="VerticalAlignment" Value="Bottom"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="FontSize" Value="16"/>
<Setter Property="Foreground" Value="#FFFFFFFF"/>
<Setter Property="Background" Value="#3889FF"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border Background="{TemplateBinding Background}" CornerRadius="{StaticResource GlobalRoundedCornerForControl}">
<Border.Effect>
<DropShadowEffect ShadowDepth="0" BlurRadius="3"/>
</Border.Effect>
<ContentPresenter Content="{TemplateBinding Content}" HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Background" Value="#3889FF" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Background" Value="{StaticResource GlobalDisableColor}" />
<Setter Property="Foreground" Value="{StaticResource GlobalNormalColor}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="LoginSwitchButton" TargetType="{x:Type Button}">
<Setter Property="Margin" Value="0,10,0,0"/>
<Setter Property="VerticalAlignment" Value="Bottom"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="Foreground" Value="#3889FF"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="SwitchBorder" Background="Transparent">
<ContentPresenter Content="{TemplateBinding Content}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Foreground" Value="#ffffff" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{StaticResource GlobalNormalColor}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="LoginWarningButton" TargetType="{x:Type Button}">
<Setter Property="Margin" Value="0,0,0,10"/>
<Setter Property="VerticalAlignment" Value="Bottom"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="FontSize" Value="14"/>
<Setter Property="Foreground" Value="{StaticResource GlobalWarningColor}"/>
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Border x:Name="LoginWarningBorder" Background="Transparent">
<ContentPresenter Content="{TemplateBinding Content}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsPressed" Value="true">
<Setter Property="Foreground" Value="#ffffff" />
</Trigger>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="{StaticResource GlobalNormalColor}"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="LoginStepTipTextBlock" TargetType="{x:Type TextBlock}">
<Setter Property="Margin" Value="0,0,0,10"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="Foreground" Value="{StaticResource GlobalNormalColor}"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="VerticalAlignment" Value="Bottom"/>
<Setter Property="TextWrapping" Value="Wrap"></Setter>
</Style>
</ResourceDictionary>

View File

@ -0,0 +1,41 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
>
<!-- 启动界面 窗体 -->
<Style x:Key="SplashWindowStyle" TargetType="{x:Type Window}">
<Setter Property="Width" Value="700" />
<Setter Property="Height" Value="400" />
<Setter Property="ResizeMode" Value="NoResize" />
<Setter Property="WindowStyle" Value="None" />
<Setter Property="AllowsTransparency" Value="True" />
<Setter Property="Background" Value="Transparent" />
</Style>
<!-- 启动界面 容器 -->
<Style x:Key="SplashBorderStyle" TargetType="{x:Type Border}">
<Setter Property="CornerRadius" Value="{StaticResource GlobalRoundedCornerForWindow}" />
<Setter Property="Margin" Value="8" />
<Setter Property="Background">
<Setter.Value>
<ImageBrush ImageSource="../Assets/Splash/Splash_Backgroud.jpg"/>
</Setter.Value>
</Setter>
<Setter Property="Effect">
<Setter.Value>
<DropShadowEffect ShadowDepth="0" BlurRadius="12"/>
</Setter.Value>
</Setter>
</Style>
<!-- 启动界面 状态描述 -->
<Style x:Key="SplashStatusDescriptionStyle" TargetType="{x:Type TextBlock}">
<Setter Property="Foreground" Value="#FFFFFFFF" />
<Setter Property="FontSize" Value="16" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Bottom" />
<Setter Property="Margin" Value="0,0,0,24" />
</Style>
</ResourceDictionary>

View File

@ -8,6 +8,72 @@
<RootNamespace>StyletLoginDesign</RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Helper\DwmDropShadow.cs" />
</ItemGroup>
<ItemGroup>
<None Remove="Assets\Login\login_backgroud.jpg" />
<None Remove="Assets\Login\Login_Button_Close.png" />
<None Remove="Assets\Login\Login_Button_Keyboard.png" />
<None Remove="Assets\Login\Login_Ico_DealCarrier.png" />
<None Remove="Assets\Login\Login_Ico_Password.png" />
<None Remove="Assets\Login\Login_Ico_Shop.png" />
<None Remove="Assets\Login\Login_Ico_Tenant.png" />
<None Remove="Assets\Login\Login_Ico_User.png" />
<None Remove="Assets\Login\Login_Logo.png" />
<None Remove="Assets\Login\Login_Logo.svg" />
<None Remove="Assets\Login\Login_SideShow_001.jpg" />
<None Remove="Assets\Splash\Splash_Backgroud.jpg" />
<None Remove="Languages\Languages.en-US.xml" />
<None Remove="Languages\Languages.zh-CN.xml" />
</ItemGroup>
<ItemGroup>
<Content Include="Assets\Login\Login_Button_Close.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Assets\Login\Login_Button_Keyboard.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Assets\Login\Login_Ico_DealCarrier.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Assets\Login\Login_Ico_Password.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Assets\Login\Login_Ico_Shop.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Assets\Login\Login_Ico_Tenant.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Assets\Login\Login_Ico_User.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Assets\Login\Login_Logo.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Assets\Login\Login_Logo.svg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Assets\Login\Login_SideShow_001.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Assets\Login\Login_Backgroud.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Assets\Splash\Splash_Backgroud.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Languages\Languages.en-US.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Languages\Languages.zh-CN.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="PropertyChanged.Fody" Version="3.4.0" />
<PackageReference Include="Stylet" Version="1.3.6.0" />