diff --git a/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj b/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
index fbb4b445..c1e5a623 100644
--- a/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
+++ b/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj
@@ -109,6 +109,8 @@
+
+
@@ -146,6 +148,7 @@
+
@@ -188,6 +191,7 @@
+
@@ -212,7 +216,10 @@
PreserveNewest
+
+
+
@@ -245,7 +252,6 @@
-
diff --git a/BPASmartClient.CustomResource/Fonts/iconfont.ttf b/BPASmartClient.CustomResource/Fonts/iconfont.ttf
index a7a3e323..0730867b 100644
Binary files a/BPASmartClient.CustomResource/Fonts/iconfont.ttf and b/BPASmartClient.CustomResource/Fonts/iconfont.ttf differ
diff --git a/BPASmartClient.CustomResource/Image/登录界面背景.jpg b/BPASmartClient.CustomResource/Image/登录界面背景.jpg
new file mode 100644
index 00000000..ca2431ce
Binary files /dev/null and b/BPASmartClient.CustomResource/Image/登录界面背景.jpg differ
diff --git a/BPASmartClient.CustomResource/Image/登录界面背景1.jpg b/BPASmartClient.CustomResource/Image/登录界面背景1.jpg
new file mode 100644
index 00000000..1eab1f9f
Binary files /dev/null and b/BPASmartClient.CustomResource/Image/登录界面背景1.jpg differ
diff --git a/BPASmartClient.CustomResource/Image/背景3.jpg b/BPASmartClient.CustomResource/Image/背景3.jpg
new file mode 100644
index 00000000..c94e3e9c
Binary files /dev/null and b/BPASmartClient.CustomResource/Image/背景3.jpg differ
diff --git a/BPASmartClient.CustomResource/Pages/Enums/Permission.cs b/BPASmartClient.CustomResource/Pages/Enums/Permission.cs
new file mode 100644
index 00000000..04c560f9
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/Enums/Permission.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.CustomResource.Pages.Enums
+{
+ public enum Permission : int
+ {
+ 管理员 = 1,
+ 操作员 = 2,
+ 观察员 = 3,
+ 技术员 = 4
+ }
+}
diff --git a/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs b/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs
index 96bdab04..f24df307 100644
--- a/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs
+++ b/BPASmartClient.CustomResource/Pages/Model/AlarmHelper.cs
@@ -1,5 +1,5 @@
using BPASmartClient.Helper;
-using BPASmartClient.Message;
+//using BPASmartClient.Message;
using BPASmartClient.Model;
using System;
using System.Collections.Concurrent;
@@ -98,7 +98,6 @@ namespace BPASmartClient.CustomResource.Pages.Model
AddAction?.Invoke(AlarmInfo);//添加报警通知
ChangeAction?.Invoke();//更改报警通知
- MessageLog.GetInstance.AddDeviceAlarmLogShow(tempAlarm.Info, Guid.NewGuid().ToString());
}
}
diff --git a/DosingSystem/Model/Config.cs b/BPASmartClient.CustomResource/Pages/Model/Config.cs
similarity index 90%
rename from DosingSystem/Model/Config.cs
rename to BPASmartClient.CustomResource/Pages/Model/Config.cs
index 6c4dda70..16abf147 100644
--- a/DosingSystem/Model/Config.cs
+++ b/BPASmartClient.CustomResource/Pages/Model/Config.cs
@@ -1,4 +1,5 @@
using BPA.Message;
+using BPASmartClient.CustomResource.Pages.Enums;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
@@ -7,16 +8,14 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace BPASmartClient.DosingSystem.Model
+namespace BPASmartClient.CustomResource.Pages.Model
{
public class Config
{
-
private volatile static Config _Instance;
public static Config GetInstance => _Instance ?? (_Instance = new Config());
private Config() { }
-
public void Init()
{
if (File.Exists("up.hbl"))
@@ -43,6 +42,11 @@ namespace BPASmartClient.DosingSystem.Model
Global.userManager.userInfos.Add(new UserInfo() { permission = Permission.操作员, UserName = "czy", Password = "123456" });
Global.userManager.userInfos.Add(new UserInfo() { permission = Permission.观察员, UserName = "gcy", Password = "654321" });
Global.userManager.userInfos.Add(new UserInfo() { permission = Permission.技术员, UserName = "jsy", Password = "88888888" });
+ SaveUser();
+ }
+
+ public void SaveUser()
+ {
File.WriteAllText("up.hbl", JsonConvert.SerializeObject(Global.userManager).AESEncrypt());
}
}
diff --git a/DosingSystem/Model/Global.cs b/BPASmartClient.CustomResource/Pages/Model/Global.cs
similarity index 53%
rename from DosingSystem/Model/Global.cs
rename to BPASmartClient.CustomResource/Pages/Model/Global.cs
index fc697e0c..cd0a6548 100644
--- a/DosingSystem/Model/Global.cs
+++ b/BPASmartClient.CustomResource/Pages/Model/Global.cs
@@ -1,13 +1,17 @@
-using System;
+using BPASmartClient.CustomResource.Pages.Enums;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
-namespace BPASmartClient.DosingSystem.Model
+namespace BPASmartClient.CustomResource.Pages.Model
{
public class Global
{
public static UserManager userManager { get; set; } = new UserManager();
+
+ public static UserInfo userInfo { get; set; } = new UserInfo();
+
}
}
diff --git a/BPASmartClient.CustomResource/Pages/Model/MenuManage.cs b/BPASmartClient.CustomResource/Pages/Model/MenuManage.cs
new file mode 100644
index 00000000..143f5b24
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/Model/MenuManage.cs
@@ -0,0 +1,98 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Collections.ObjectModel;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using BPASmartClient.CustomResource.Pages.Enums;
+using System.Windows;
+
+namespace BPASmartClient.CustomResource.Pages.Model
+{
+ ///
+ /// 在启动界面之前设置菜单项
+ ///
+ public class MenuManage : ObservableObject
+ {
+ private volatile static MenuManage _Instance;
+ public static MenuManage GetInstance => _Instance ?? (_Instance = new MenuManage());
+ private MenuManage() { }
+
+ public ObservableCollection menuModels { get; set; } = new ObservableCollection();
+ }
+
+ public class MenuModel : ObservableObject
+ {
+ ///
+ /// 主菜单权限
+ ///
+ public Permission[] MainMenuPermission { get { return _mMainMenuPermission; } set { _mMainMenuPermission = value; OnPropertyChanged(); } }
+ private Permission[] _mMainMenuPermission;
+
+ ///
+ /// 主菜单图标
+ ///
+ public string MainMenuIcon { get { return _mMainMenuIcon; } set { _mMainMenuIcon = value; OnPropertyChanged(); } }
+ private string _mMainMenuIcon = string.Empty;
+
+ ///
+ /// 主菜单名称
+ ///
+ public string MainMenuName { get { return _mMainMenuName; } set { _mMainMenuName = value; OnPropertyChanged(); } }
+ private string _mMainMenuName = string.Empty;
+
+ ///
+ /// 别名(英文名)
+ ///
+ public string Alias { get { return _mAlias; } set { _mAlias = value; OnPropertyChanged(); } }
+ private string _mAlias = string.Empty;
+
+ ///
+ /// 主菜单的显示隐藏设置
+ ///
+ public Visibility MainMenuVisibility { get { return _mMainMenuVisibility; } set { _mMainMenuVisibility = value; OnPropertyChanged(); } }
+ private Visibility _mMainMenuVisibility;
+
+ ///
+ /// 子菜单集合
+ ///
+ public ObservableCollection subMenumodels { get; set; } = new ObservableCollection();
+
+ }
+
+ public class SubMenumodel : ObservableObject
+ {
+ ///
+ /// 子菜单名称
+ ///
+ public string SubMenuName { get { return _mSubMenuName; } set { _mSubMenuName = value; OnPropertyChanged(); } }
+ private string _mSubMenuName = string.Empty;
+
+ ///
+ /// 子菜单权限管理
+ ///
+ public Permission[] SubMenuPermission { get { return _mSubMenuPermission; } set { _mSubMenuPermission = value; OnPropertyChanged(); } }
+ private Permission[] _mSubMenuPermission;
+
+ ///
+ /// 切换界面路径
+ ///
+ public string ToggleWindowPath { get { return _mToggleWindowPath; } set { _mToggleWindowPath = value; OnPropertyChanged(); } }
+ private string _mToggleWindowPath = string.Empty;
+
+ ///
+ /// 程序集名称
+ ///
+ public string AssemblyName { get { return _mAssemblyName; } set { _mAssemblyName = value; OnPropertyChanged(); } }
+ private string _mAssemblyName = string.Empty;
+
+ ///
+ /// 子菜单的显示隐藏设置
+ ///
+ public Visibility SubMenuVisibility { get { return _mSubMenuVisibility; } set { _mSubMenuVisibility = value; OnPropertyChanged(); } }
+ private Visibility _mSubMenuVisibility;
+
+ }
+
+}
diff --git a/BPASmartClient.CustomResource/Pages/Model/MessageLog.cs b/BPASmartClient.CustomResource/Pages/Model/MessageLog.cs
new file mode 100644
index 00000000..6205c71f
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/Model/MessageLog.cs
@@ -0,0 +1,67 @@
+using BPASmartClient.Helper;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Collections.ObjectModel;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace BPASmartClient.CustomResource.Pages.Model
+{
+ public class MessageLog
+ {
+ private volatile static MessageLog _Instance;
+ public static MessageLog GetInstance => _Instance ?? (_Instance = new MessageLog());
+ private MessageLog() { }
+
+ public Action UserLog { get; set; }
+
+ public Action RunLog { get; set; }
+
+ public ObservableCollection runLogs { get; set; } = new ObservableCollection();
+
+ public ObservableCollection userLogs { get; set; } = new ObservableCollection();
+
+ public void LogSave()
+ {
+ Sqlite.GetInstance.Save();
+ Sqlite.GetInstance.Save();
+ }
+
+ //public void GetLog()
+ //{
+ // Sqlite.GetInstance.GetData();
+ // Sqlite.GetInstance.GetData();
+ //}
+
+ public void ShowUserLog(string info)
+ {
+ UserLog userLog = new UserLog()
+ {
+ Date = DateTime.Now.ToString("yyyy-MM-dd"),
+ Time = DateTime.Now.ToString("HH:mm:ss"),
+ Permission = Global.userInfo.permission.ToString(),
+ LogInfo = info
+ };
+ Sqlite.GetInstance.Base.Add(userLog);
+ Application.Current.Dispatcher.Invoke(new Action(() => { userLogs.Insert(0, userLog); }));
+ UserLog?.Invoke(info);
+ }
+
+ public void ShowRunLog(string info)
+ {
+ RunLog runLog = new RunLog()
+ {
+ Date = DateTime.Now.ToString("yyyy-MM-dd"),
+ Time = DateTime.Now.ToString("HH:mm:ss"),
+ RunLogInfo = info
+ };
+ Sqlite.GetInstance.Base.Add(runLog);
+ Application.Current.Dispatcher.Invoke(new Action(() => { runLogs.Insert(0, runLog); }));
+ RunLog?.Invoke(info);
+ }
+
+
+ }
+}
diff --git a/BPASmartClient.CustomResource/Pages/Model/PasswordHelper.cs b/BPASmartClient.CustomResource/Pages/Model/PasswordHelper.cs
new file mode 100644
index 00000000..5cf350d7
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/Model/PasswordHelper.cs
@@ -0,0 +1,73 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+
+namespace BPASmartClient.CustomResource.Pages.Model
+{
+ ///
+ /// 给PasswordBox添加一个可以绑定的附加类
+ ///
+ public class PasswordHelper
+ {
+
+ static bool IsUpdete = false;
+
+ #region PasswordProperty
+ public static readonly DependencyProperty PasswordProperty = DependencyProperty.RegisterAttached("Password", typeof(string),
+ typeof(PasswordHelper), new FrameworkPropertyMetadata("", new PropertyChangedCallback(OnPropertyChanged)));
+
+
+ public static string GetPassword(DependencyObject d)
+ {
+ return d.GetValue(PasswordProperty).ToString();
+ }
+
+ public static void SetPassword(DependencyObject d, string value)
+ {
+ d.SetValue(PasswordProperty, value);
+ }
+
+ private static void OnPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ PasswordBox password = d as PasswordBox;
+ password.PasswordChanged -= password_PasswordChanged;
+ if (!IsUpdete) password.Password = e.NewValue?.ToString();
+ password.PasswordChanged += password_PasswordChanged;
+ }
+ #endregion
+
+ #region AttachProperty
+ public static readonly DependencyProperty AttachProperty = DependencyProperty.RegisterAttached("Attach", typeof(bool),
+ typeof(PasswordHelper), new FrameworkPropertyMetadata(default(bool), new PropertyChangedCallback(OnAttachChanged)));
+
+ public static bool GetAttach(DependencyObject d)
+ {
+ return (bool)d.GetValue(AttachProperty);
+ }
+
+ public static void SetAttach(DependencyObject d, bool value)
+ {
+ d.SetValue(AttachProperty, value);
+ }
+
+ private static void OnAttachChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ PasswordBox password = d as PasswordBox;
+ password.PasswordChanged += password_PasswordChanged;
+ }
+
+ private static void password_PasswordChanged(object sender, RoutedEventArgs e)
+ {
+ PasswordBox passwordBox = sender as PasswordBox;
+ IsUpdete = true;
+ SetPassword(passwordBox, passwordBox.Password);
+ IsUpdete = false;
+ }
+
+ #endregion
+ }
+}
diff --git a/BPASmartClient.CustomResource/Pages/Model/RunLog.cs b/BPASmartClient.CustomResource/Pages/Model/RunLog.cs
new file mode 100644
index 00000000..f3be25c3
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/Model/RunLog.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+
+namespace BPASmartClient.CustomResource.Pages.Model
+{
+ public class RunLog : ObservableObject
+ {
+ [Key]
+ public int Id { get; set; }
+
+ //public string Date { get { return _mDate; } set { _mDate = value; OnPropertyChanged(); } }
+ //private string _mDate;
+
+ //public string Time { get { return _mTime; } set { _mTime = value; OnPropertyChanged(); } }
+ //private string _mTime;
+
+ //public string RunLogInfo { get { return _mRunLogInfo; } set { _mRunLogInfo = value; OnPropertyChanged(); } }
+ //private string _mRunLogInfo;
+
+ public string Date { get; set; }
+
+ public string Time { get; set; }
+
+ public string RunLogInfo { get; set; }
+
+ }
+}
diff --git a/BPASmartClient.CustomResource/Pages/Model/UserInfo.cs b/BPASmartClient.CustomResource/Pages/Model/UserInfo.cs
new file mode 100644
index 00000000..1164d95f
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/Model/UserInfo.cs
@@ -0,0 +1,17 @@
+using BPASmartClient.CustomResource.Pages.Enums;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.CustomResource.Pages.Model
+{
+ public class UserInfo
+ {
+ public Permission permission { get; set; }
+ public string UserName { get; set; }
+ public string Password { get; set; }
+
+ }
+}
diff --git a/BPASmartClient.CustomResource/Pages/Model/UserLog.cs b/BPASmartClient.CustomResource/Pages/Model/UserLog.cs
new file mode 100644
index 00000000..2082d188
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/Model/UserLog.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+
+namespace BPASmartClient.CustomResource.Pages.Model
+{
+ public class UserLog : ObservableObject
+ {
+ [Key]
+ public int Id { get; set; }
+
+ //public string Permission { get { return _mPermission; } set { _mPermission = value; OnPropertyChanged(); } }
+ //private string _mPermission;
+
+ //public string Date { get { return _mDate; } set { _mDate = value; OnPropertyChanged(); } }
+ //private string _mDate;
+
+ //public string Time { get { return _mTime; } set { _mTime = value; OnPropertyChanged(); } }
+ //private string _mTime;
+
+ //public string LogInfo { get { return _mLogInfo; } set { _mLogInfo = value; OnPropertyChanged(); } }
+ //private string _mLogInfo;
+
+ public string Permission { get; set; }
+
+ public string Date { get; set; }
+
+ public string Time { get; set; }
+
+ public string LogInfo { get; set; }
+
+ }
+}
diff --git a/BPASmartClient.CustomResource/Pages/Model/UserManager.cs b/BPASmartClient.CustomResource/Pages/Model/UserManager.cs
new file mode 100644
index 00000000..258199e9
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/Model/UserManager.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.CustomResource.Pages.Model
+{
+ public class UserManager
+ {
+ public List userInfos { get; set; } = new List();
+ }
+}
diff --git a/BPASmartClient.CustomResource/Pages/View/LoginView.xaml b/BPASmartClient.CustomResource/Pages/View/LoginView.xaml
index 0dd17295..e6a01f0f 100644
--- a/BPASmartClient.CustomResource/Pages/View/LoginView.xaml
+++ b/BPASmartClient.CustomResource/Pages/View/LoginView.xaml
@@ -2,15 +2,17 @@
x:Class="BPASmartClient.CustomResource.Pages.View.LoginView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:common="clr-namespace:BPASmartClient.CustomResource.Pages.Model"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.CustomResource.Pages.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel"
Title="LoginView"
- Width="800"
- Height="450"
+ Width="500"
+ Height="300"
AllowsTransparency="True"
Background="{x:Null}"
+ Topmost="True"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
mc:Ignorable="d">
@@ -26,9 +28,400 @@
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BPASmartClient.CustomResource/Pages/View/LoginView.xaml.cs b/BPASmartClient.CustomResource/Pages/View/LoginView.xaml.cs
index 259f7886..4d31d645 100644
--- a/BPASmartClient.CustomResource/Pages/View/LoginView.xaml.cs
+++ b/BPASmartClient.CustomResource/Pages/View/LoginView.xaml.cs
@@ -1,4 +1,5 @@
-using System;
+using BPASmartClient.Helper;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -22,6 +23,27 @@ namespace BPASmartClient.CustomResource.Pages.View
public LoginView()
{
InitializeComponent();
+ this.br.MouseLeftButtonDown += (o, e) =>
+ {
+ if (e.LeftButton == MouseButtonState.Pressed) this.DragMove();
+ };
+ ActionManage.GetInstance.CancelRegister("LoginOk");
+ ActionManage.GetInstance.CancelRegister("ExitAction");
+ ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = true; this.Close(); }), "LoginOk");
+ ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = false; this.Close(); }), "ExitAction");
+
+ }
+
+ 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;
+ }
}
}
}
diff --git a/BPASmartClient.CustomResource/Pages/View/MainView.xaml b/BPASmartClient.CustomResource/Pages/View/MainView.xaml
new file mode 100644
index 00000000..9c13a9b2
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/View/MainView.xaml
@@ -0,0 +1,465 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BPASmartClient.CustomResource/Pages/View/MainView.xaml.cs b/BPASmartClient.CustomResource/Pages/View/MainView.xaml.cs
new file mode 100644
index 00000000..e2963af6
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/View/MainView.xaml.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+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
+{
+ ///
+ /// MainView.xaml 的交互逻辑
+ ///
+ public partial class MainView : Window
+ {
+ public MainView()
+ {
+ InitializeComponent();
+ this.ButMin.Click += (o, e) => { this.WindowState = WindowState.Minimized; };
+ this.ButMax.Click += (o, e) => { this.WindowState = this.WindowState == WindowState.Maximized ? WindowState.Normal : WindowState.Maximized; };
+ this.ButClose.Click += (o, e) => { this.Close(); };
+ this.MoveBorder.MouseLeftButtonDown += (o, e) =>
+ {
+ if (e.ClickCount > 1)
+ {
+ if (this.WindowState == WindowState.Maximized)
+ this.WindowState = WindowState.Normal;
+ else if (this.WindowState == WindowState.Normal)
+ this.WindowState = WindowState.Maximized;
+ }
+ if (e.LeftButton == MouseButtonState.Pressed) this.DragMove();
+ };
+ }
+ }
+}
diff --git a/BPASmartClient.CustomResource/Pages/View/PasswordChangeView.xaml b/BPASmartClient.CustomResource/Pages/View/PasswordChangeView.xaml
new file mode 100644
index 00000000..85932a81
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/View/PasswordChangeView.xaml
@@ -0,0 +1,348 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BPASmartClient.CustomResource/Pages/View/PasswordChangeView.xaml.cs b/BPASmartClient.CustomResource/Pages/View/PasswordChangeView.xaml.cs
new file mode 100644
index 00000000..9e8ca1d0
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/View/PasswordChangeView.xaml.cs
@@ -0,0 +1,72 @@
+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
+{
+ ///
+ /// PasswordChangeView.xaml 的交互逻辑
+ ///
+ public partial class PasswordChangeView : Window
+ {
+ public PasswordChangeView()
+ {
+ InitializeComponent();
+ this.br.MouseLeftButtonDown += (o, e) =>
+ {
+ if (e.LeftButton == MouseButtonState.Pressed) this.DragMove();
+ };
+ ActionManage.GetInstance.CancelRegister("PasswordChangeViewconfirm");
+ ActionManage.GetInstance.CancelRegister("PasswordChangeViewCancel");
+ ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = true; this.Close(); }), "PasswordChangeViewconfirm");
+ ActionManage.GetInstance.Register(new Action(() => { this.DialogResult = false; this.Close(); }), "PasswordChangeViewCancel");
+ }
+
+ private void newpb2_PasswordChanged(object sender, RoutedEventArgs e)
+ {
+ if (this.newpb2.Password.Length > 0)
+ {
+ this.newmarkText2.Visibility = Visibility.Collapsed;
+ }
+ else
+ {
+ this.newmarkText2.Visibility = Visibility.Visible;
+ }
+ }
+
+ private void newpb1_PasswordChanged(object sender, RoutedEventArgs e)
+ {
+ if (this.newpb1.Password.Length > 0)
+ {
+ this.newmarkText1.Visibility = Visibility.Collapsed;
+ }
+ else
+ {
+ this.newmarkText1.Visibility = Visibility.Visible;
+ }
+ }
+
+ private void oldpb_PasswordChanged(object sender, RoutedEventArgs e)
+ {
+ if (this.oldpb.Password.Length > 0)
+ {
+ this.oldmarkText.Visibility = Visibility.Collapsed;
+ }
+ else
+ {
+ this.oldmarkText.Visibility = Visibility.Visible;
+ }
+ }
+ }
+}
diff --git a/BPASmartClient.CustomResource/Pages/View/RunLogView.xaml b/BPASmartClient.CustomResource/Pages/View/RunLogView.xaml
new file mode 100644
index 00000000..8a0f69a5
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/View/RunLogView.xaml
@@ -0,0 +1,372 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BPASmartClient.CustomResource/Pages/View/RunLogView.xaml.cs b/BPASmartClient.CustomResource/Pages/View/RunLogView.xaml.cs
new file mode 100644
index 00000000..810e1626
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/View/RunLogView.xaml.cs
@@ -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 BPASmartClient.CustomResource.Pages.View
+{
+ ///
+ /// RunLogView.xaml 的交互逻辑
+ ///
+ public partial class RunLogView : UserControl
+ {
+ public RunLogView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/BPASmartClient.CustomResource/Pages/View/UserLogView.xaml b/BPASmartClient.CustomResource/Pages/View/UserLogView.xaml
new file mode 100644
index 00000000..75e020c7
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/View/UserLogView.xaml
@@ -0,0 +1,335 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BPASmartClient.CustomResource/Pages/View/UserLogView.xaml.cs b/BPASmartClient.CustomResource/Pages/View/UserLogView.xaml.cs
new file mode 100644
index 00000000..1149bcbd
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/View/UserLogView.xaml.cs
@@ -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 BPASmartClient.CustomResource.Pages.View
+{
+ ///
+ /// UserLogView.xaml 的交互逻辑
+ ///
+ public partial class UserLogView : UserControl
+ {
+ public UserLogView()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/BPASmartClient.CustomResource/Pages/ViewModel/AlarmViewModel.cs b/BPASmartClient.CustomResource/Pages/ViewModel/AlarmViewModel.cs
index b3c58e0d..1238f0c0 100644
--- a/BPASmartClient.CustomResource/Pages/ViewModel/AlarmViewModel.cs
+++ b/BPASmartClient.CustomResource/Pages/ViewModel/AlarmViewModel.cs
@@ -137,4 +137,6 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
}
+
+
}
diff --git a/BPASmartClient.CustomResource/Pages/ViewModel/LoginViewModel.cs b/BPASmartClient.CustomResource/Pages/ViewModel/LoginViewModel.cs
index 0d805e67..9e19a23a 100644
--- a/BPASmartClient.CustomResource/Pages/ViewModel/LoginViewModel.cs
+++ b/BPASmartClient.CustomResource/Pages/ViewModel/LoginViewModel.cs
@@ -3,6 +3,9 @@ using System.Collections.Generic;
using System.Linq;
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;
@@ -12,7 +15,64 @@ namespace BPASmartClient.CustomResource.Pages.ViewModel
{
public LoginViewModel()
{
+ LoginCommand = new RelayCommand(() =>
+ {
+ 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++)
+ {
+ 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).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;
+ }
+ }
+ ActionManage.GetInstance.Send("LoginOk");
+ }
+ else
+ {
+ ErrorInfo = "用户名或密码错误!";
+ }
+
+ });
+
+ ExitCommand = new RelayCommand(() =>
+ {
+ ActionManage.GetInstance.Send("ExitAction");
+ });
}
+
+ public RelayCommand LoginCommand { get; set; }
+
+ public RelayCommand ExitCommand { get; set; }
+
+
+
+ public string ErrorInfo { get { return _mErrorInfo; } set { _mErrorInfo = value; OnPropertyChanged(); } }
+ private string _mErrorInfo;
+
+
+ public string UserName { get { return _mUserName; } set { _mUserName = value; OnPropertyChanged(); } }
+ private string _mUserName = "admin";
+
+
+ public string Password { get { return _mPassword; } set { _mPassword = value; OnPropertyChanged(); } }
+ private string _mPassword;
+
+
}
}
diff --git a/BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs b/BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs
new file mode 100644
index 00000000..2416c422
--- /dev/null
+++ b/BPASmartClient.CustomResource/Pages/ViewModel/MainViewModel.cs
@@ -0,0 +1,64 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Reflection;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using BPASmartClient.CustomResource.Pages.Model;
+using Microsoft.Toolkit.Mvvm.ComponentModel;
+using Microsoft.Toolkit.Mvvm.Input;
+
+namespace BPASmartClient.CustomResource.Pages.ViewModel
+{
+ public class MainViewModel : ObservableObject
+ {
+ public MainViewModel()
+ {
+ NavChangedCommand = new RelayCommand