diff --git a/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj b/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj index 5130dc63..80cbab40 100644 --- a/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj +++ b/BPASmartClient.CustomResource/BPASmartClient.CustomResource.csproj @@ -20,6 +20,7 @@ + @@ -233,6 +234,7 @@ + diff --git a/BPASmartClient.CustomResource/Fonts/font/iconfont.ttf b/BPASmartClient.CustomResource/Fonts/font/iconfont.ttf new file mode 100644 index 00000000..f964af1f Binary files /dev/null and b/BPASmartClient.CustomResource/Fonts/font/iconfont.ttf differ diff --git a/BPASmartClient.CustomResource/Pages/Model/Config.cs b/BPASmartClient.CustomResource/Pages/Model/Config.cs index 9e5c2887..e07be50c 100644 --- a/BPASmartClient.CustomResource/Pages/Model/Config.cs +++ b/BPASmartClient.CustomResource/Pages/Model/Config.cs @@ -38,10 +38,10 @@ namespace BPASmartClient.CustomResource.Pages.Model private void AddData() { - Global.userManager.userInfos.Add(new UserInfo() {Id= IdProcess(), Permission = Permission.管理员, UserName = "admin", Password = "admin" }); ; - Global.userManager.userInfos.Add(new UserInfo() { Id = IdProcess(), Permission = Permission.操作员, UserName = "czy", Password = "123456" }); - Global.userManager.userInfos.Add(new UserInfo() { Id = IdProcess(), Permission = Permission.观察员, UserName = "gcy", Password = "654321" }); - Global.userManager.userInfos.Add(new UserInfo() { Id = IdProcess(), Permission = Permission.技术员, UserName = "jsy", Password = "88888888" }); + Global.userManager.userInfos.Add(new UserInfo() {Id= IdProcess(), permission = Permission.管理员, UserName = "admin", Password = "admin" }); ; + Global.userManager.userInfos.Add(new UserInfo() { Id = IdProcess(), permission = Permission.操作员, UserName = "czy", Password = "123456" }); + Global.userManager.userInfos.Add(new UserInfo() { Id = IdProcess(), permission = Permission.观察员, UserName = "gcy", Password = "654321" }); + Global.userManager.userInfos.Add(new UserInfo() { Id = IdProcess(), permission = Permission.技术员, UserName = "jsy", Password = "88888888" }); SaveUser(); } diff --git a/BPASmartClient.CustomResource/Pages/Model/MessageLog.cs b/BPASmartClient.CustomResource/Pages/Model/MessageLog.cs index f49f8f33..b82a7dca 100644 --- a/BPASmartClient.CustomResource/Pages/Model/MessageLog.cs +++ b/BPASmartClient.CustomResource/Pages/Model/MessageLog.cs @@ -6,6 +6,7 @@ using System.Collections.ObjectModel; using System.Text; using System.Threading.Tasks; using System.Windows; +using BPASmartClient.Model; namespace BPASmartClient.CustomResource.Pages.Model { @@ -16,22 +17,26 @@ namespace BPASmartClient.CustomResource.Pages.Model public static readonly object runLock = new object(); public static readonly object userlock = new object(); + public static readonly object alarmlock = new object(); private MessageLog() { } public Action UserLog { get; set; } public Action RunLog { get; set; } - + public Action AlarmLog { get; set; } public ObservableCollection runLogs { get; set; } = new ObservableCollection(); public ObservableCollection userLogs { get; set; } = new ObservableCollection(); + public ObservableCollection alarmLogs { get; set; } = new ObservableCollection(); + public void LogSave() { Sqlite.GetInstance.Save(); Sqlite.GetInstance.Save(); + Sqlite.GetInstance.Save(); } public void ShowUserLog(string info) @@ -42,7 +47,7 @@ namespace BPASmartClient.CustomResource.Pages.Model { Date = DateTime.Now.ToString("yyyy-MM-dd"), Time = DateTime.Now.ToString("HH:mm:ss"), - Permission = Global.userInfo.Permission.ToString(), + Permission = Global.userInfo.permission.ToString(), UserName = Global.userInfo.UserName, LogInfo = info }; @@ -67,9 +72,25 @@ namespace BPASmartClient.CustomResource.Pages.Model RunLog?.Invoke(info); } } - - - - + int AlarmID; + public void ShowAlarmLog(string info, string AlarmNumber="_", AlarmLevel level= AlarmLevel.一般报警) + { + lock (alarmlock) + { + AlarmID++; + Alarm alarmLog = new Alarm() + { + NumId = AlarmID, + Date = DateTime.Now.ToString("yyyy-MM-dd"), + Time = DateTime.Now.ToString("HH:mm:ss"), + Info = info, + Value = AlarmNumber, + Grade = (level)+"" + }; + Sqlite.GetInstance.Base.Add(alarmLog); + Application.Current.Dispatcher.Invoke(new Action(() => { alarmLogs.Insert(0, alarmLog); })); + AlarmLog?.Invoke(info); + } + } } } diff --git a/BPASmartClient.CustomResource/Pages/Model/UserInfo.cs b/BPASmartClient.CustomResource/Pages/Model/UserInfo.cs index eeb35e4c..b0bd7add 100644 --- a/BPASmartClient.CustomResource/Pages/Model/UserInfo.cs +++ b/BPASmartClient.CustomResource/Pages/Model/UserInfo.cs @@ -10,9 +10,14 @@ namespace BPASmartClient.CustomResource.Pages.Model { public class UserInfo:ObservableObject { - public Permission permission { get; set; } - public string UserName { get; set; } - public string Password { get; set; } + public string Id { get { return _id; }set { _id = value;OnPropertyChanged(); } } + private string _id; + public Permission permission { get { return _perimission; } set { _perimission = value;OnPropertyChanged(); } } + private Permission _perimission; + public string UserName { get { return _userName; } set { _userName = value;OnPropertyChanged(); } } + private string _userName; + public string Password { get { return _password; } set { _password = value;OnPropertyChanged(); } } + private string _password; public List CardId { get; set; } = new List(); } diff --git a/BPASmartClient.CustomResource/Pages/View/UserManageView.xaml b/BPASmartClient.CustomResource/Pages/View/UserManageView.xaml index aa93f831..a3e55d72 100644 --- a/BPASmartClient.CustomResource/Pages/View/UserManageView.xaml +++ b/BPASmartClient.CustomResource/Pages/View/UserManageView.xaml @@ -342,7 +342,7 @@ - + @@ -365,21 +365,29 @@ - + + + + + + + + + - + - +