diff --git a/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj b/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
index ebbf5af5..65642570 100644
--- a/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
+++ b/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
@@ -101,6 +101,8 @@
+
+
@@ -219,6 +221,8 @@
+
+
PreserveNewest
diff --git a/BPASmartClient.CustomResource/Image/智慧城市科技风登录页面.png b/BPASmartClient.CustomResource/Image/智慧城市科技风登录页面.png
new file mode 100644
index 00000000..b731d72f
Binary files /dev/null and b/BPASmartClient.CustomResource/Image/智慧城市科技风登录页面.png differ
diff --git a/BPASmartClient.CustomResource/Image/智慧城市科技风登录页面边框.png b/BPASmartClient.CustomResource/Image/智慧城市科技风登录页面边框.png
new file mode 100644
index 00000000..7fc4d56f
Binary files /dev/null and b/BPASmartClient.CustomResource/Image/智慧城市科技风登录页面边框.png differ
diff --git a/BPASmartClient.CustomResource/Pages/View/LoginView.xaml b/BPASmartClient.CustomResource/Pages/View/LoginView.xaml
index 9d649bd0..d4cf34ce 100644
--- a/BPASmartClient.CustomResource/Pages/View/LoginView.xaml
+++ b/BPASmartClient.CustomResource/Pages/View/LoginView.xaml
@@ -12,7 +12,7 @@
Height="1080"
AllowsTransparency="True"
Background="{x:Null}"
- Topmost="True"
+ Topmost="False"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">
@@ -154,7 +154,7 @@
Margin="10,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
- FontSize="20"
+ FontSize="{TemplateBinding FontSize}"
Foreground="#88009dff"
Text="请输入账号名称"
Visibility="Collapsed" />
@@ -282,9 +282,11 @@
Grid.Row="1"
Margin="20,20"
BorderBrush="#009DFF"
+ Name="Username"
BorderThickness="3"
FontSize="30"
Foreground="#009DFF"
+ KeyDown="TextBox_KeyDown"
Style="{DynamicResource UserTextBoxStyle}"
TabIndex="1"
Text="{Binding UserName}" />
@@ -292,6 +294,7 @@
{ this.DialogResult = true; this.Close(); }), "LoginOk");
- ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = false; this.Close(); }), "ExitAction");
+ ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = true; this.Close(); }), "LoginOk", true);
+ ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = false; this.Close(); }), "ExitAction", true);
}
private void LoginView_Loaded(object sender, RoutedEventArgs e)
{
- string path = @"Videos\Login.mp4";
+ string path = $"{AppDomain.CurrentDomain.BaseDirectory}Videos\\Login.mp4";
if (File.Exists(path))
{
- // 绑定视频文件
- player.Source = new Uri(path);
-
- // 交互式控制
- player.LoadedBehavior = MediaState.Manual;
-
- // 添加元素加载完成事件 -- 自动开始播放
- player.Loaded += new RoutedEventHandler(media_Loaded);
-
- // 添加媒体播放结束事件 -- 重新播放
- player.MediaEnded += new RoutedEventHandler(media_MediaEnded);
-
- // 添加元素卸载完成事件 -- 停止播放
- player.Unloaded += new RoutedEventHandler(media_Unloaded);
-
- player.MediaOpened += Player_MediaOpened;
+ player.Source = new Uri(path); // 绑定视频文件
+ this.WindowState = WindowState.Maximized;
+ player.LoadedBehavior = MediaState.Manual; // 交互式控制
+ player.Loaded += new RoutedEventHandler(media_Loaded); // 添加元素加载完成事件 -- 自动开始播放
+ player.MediaEnded += new RoutedEventHandler(media_MediaEnded); // 添加媒体播放结束事件 -- 重新播放
+ player.Unloaded += new RoutedEventHandler(media_Unloaded);// 添加元素卸载完成事件 -- 停止播放
+ player.MediaOpened += Player_MediaOpened;//已播放事件
}
}
@@ -84,14 +74,17 @@ namespace BPASmartClient.CustomResource.Pages.View
private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e)
{
- if (this.pb.Password.Length > 0)
- {
- this.markText.Visibility = Visibility.Collapsed;
- }
- else
- {
- this.markText.Visibility = Visibility.Visible;
- }
+ this.markText.Visibility = this.pb.Password.Length > 0 ? Visibility.Collapsed : Visibility.Visible;
+ }
+
+ private void TextBox_KeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.Key == Key.Enter) pb.Focus();
+ }
+
+ private void pb_KeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.Key == Key.Enter) ActionManage.GetInstance.Send("EnterLogin");
}
}
}
diff --git a/BPASmartClient.CustomResource/Pages/View/SubPagLoginView.xaml b/BPASmartClient.CustomResource/Pages/View/SubPagLoginView.xaml
new file mode 100644
index 00000000..99537e94
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/View/SubPagLoginView.xaml
@@ -0,0 +1,327 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BPASmartClient.CustomResource/Pages/View/SubPagLoginView.xaml.cs b/BPASmartClient.CustomResource/Pages/View/SubPagLoginView.xaml.cs
new file mode 100644
index 00000000..835e2dc0
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/View/SubPagLoginView.xaml.cs
@@ -0,0 +1,47 @@
+using BPASmartClient.Helper;
+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.Shapes;
+
+namespace BPASmartClient.CustomResource.Pages.View
+{
+ ///
+ /// SubPagLoginView.xaml 的交互逻辑
+ ///
+ public partial class SubPagLoginView : Window
+ {
+ public SubPagLoginView()
+ {
+ InitializeComponent();
+ Username.Focus();
+ Username.SelectionStart = Username.Text.Trim().Length;
+ ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = true; this.Close(); }), "LoginOk", true);
+ ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = false; this.Close(); }), "ExitAction", true);
+ }
+
+ private void PasswordBox_PasswordChanged(object sender, RoutedEventArgs e)
+ {
+ this.markText.Visibility = this.pb.Password.Length > 0 ? Visibility.Collapsed : Visibility.Visible;
+ }
+
+ private void TextBox_KeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.Key == Key.Enter) pb.Focus();
+ }
+
+ private void pb_KeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.Key == Key.Enter) ActionManage.GetInstance.Send("EnterLogin");
+ }
+ }
+}
diff --git a/BPASmartClient.CustomResource/Pages/ViewModel/LoginViewModel.cs b/BPASmartClient.CustomResource/Pages/ViewModel/LoginViewModel.cs
index 9e19a23a..75945eeb 100644
--- a/BPASmartClient.CustomResource/Pages/ViewModel/LoginViewModel.cs
+++ b/BPASmartClient.CustomResource/Pages/ViewModel/LoginViewModel.cs
@@ -15,45 +15,48 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public LoginViewModel()
{
- LoginCommand = new RelayCommand(() =>
+ ActionManage.GetInstance.Register(new Action(() => { Login(); }), "EnterLogin", true);
+ LoginCommand = new RelayCommand(() => { Login(); });
+
+ ExitCommand = new RelayCommand(() =>
{
- var res = Global.userManager.userInfos.FirstOrDefault(p => p.UserName == UserName && p.Password == Password);
- if (res != null)
+ ActionManage.GetInstance.Send("ExitAction");
+ });
+ }
+
+ private void Login()
+ {
+ var res = Global.userManager.userInfos.FirstOrDefault(p => p.UserName == UserName && p.Password == Password);
+ if (res != null)
+ {
+ Global.userInfo.permission = res.permission;
+ Global.userInfo.UserName = res.UserName;
+ Global.userInfo.Password = res.Password;
+ for (int i = 0; i < MenuManage.GetInstance.menuModels.Count; i++)
{
- Global.userInfo.permission = res.permission;
- Global.userInfo.UserName = res.UserName;
- Global.userInfo.Password = res.Password;
- for (int i = 0; i < MenuManage.GetInstance.menuModels.Count; i++)
+ if (MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuPermission.Contains(res.permission))
+ MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Visible;
+ else
+ MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Collapsed;
+
+ if (MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.FirstOrDefault(p => p.SubMenuPermission.Contains(res.permission)) == null)
+ MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Collapsed;
+
+ for (int m = 0; m < MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.Count; m++)
{
- if (MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuPermission.Contains(res.permission))
- MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Visible;
+ if (MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuPermission.Contains(res.permission))
+ MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuVisibility = Visibility.Visible;
else
- MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Collapsed;
-
- if (MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.FirstOrDefault(p => p.SubMenuPermission.Contains(res.permission)) == null)
- MenuManage.GetInstance.menuModels.ElementAt(i).MainMenuVisibility = Visibility.Collapsed;
-
- for (int m = 0; m < MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.Count; m++)
- {
- if (MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuPermission.Contains(res.permission))
- MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuVisibility = Visibility.Visible;
- else
- MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuVisibility = Visibility.Collapsed;
- }
+ MenuManage.GetInstance.menuModels.ElementAt(i).subMenumodels.ElementAt(m).SubMenuVisibility = Visibility.Collapsed;
}
- ActionManage.GetInstance.Send("LoginOk");
- }
- else
- {
- ErrorInfo = "用户名或密码错误!";
}
-
- });
-
- ExitCommand = new RelayCommand(() =>
+ ActionManage.GetInstance.Send("PermissionChange");
+ ActionManage.GetInstance.Send("LoginOk");
+ }
+ else
{
- ActionManage.GetInstance.Send("ExitAction");
- });
+ ErrorInfo = "用户名或密码错误!";
+ }
}
public RelayCommand LoginCommand { get; set; }
@@ -67,7 +70,7 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
public string UserName { get { return _mUserName; } set { _mUserName = value; OnPropertyChanged(); } }
- private string _mUserName = "admin";
+ private string _mUserName = Global.userInfo.UserName;
public string Password { get { return _mPassword; } set { _mPassword = value; OnPropertyChanged(); } }
diff --git a/BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs b/BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs
index 2416c422..4f8d88ac 100644
--- a/BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs
+++ b/BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs
@@ -7,6 +7,7 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows;
using BPASmartClient.CustomResource.Pages.Model;
+using BPASmartClient.Helper;
using Microsoft.Toolkit.Mvvm.ComponentModel;
using Microsoft.Toolkit.Mvvm.Input;
@@ -18,7 +19,27 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
{
NavChangedCommand = new RelayCommand