diff --git a/BPASmartClient.CustomResource/Pages/Model/MessageLog.cs b/BPASmartClient.CustomResource/Pages/Model/MessageLog.cs index 96a0fa4f..b8da7d9b 100644 --- a/BPASmartClient.CustomResource/Pages/Model/MessageLog.cs +++ b/BPASmartClient.CustomResource/Pages/Model/MessageLog.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using System.Windows; using BPASmartClient.Model; using System.Windows.Media; +using BPASmartClient.CustomResource.Pages.View; namespace BPASmartClient.CustomResource.Pages.Model { @@ -44,7 +45,7 @@ namespace BPASmartClient.CustomResource.Pages.Model { lock (userlock) { - if (!string.IsNullOrEmpty(Global.userInfo.UserName) && !string.IsNullOrEmpty(Global.userInfo.permission.ToString())&& !string.IsNullOrEmpty(info)) + if (!string.IsNullOrEmpty(Global.userInfo.UserName) && !string.IsNullOrEmpty(Global.userInfo.permission.ToString()) && !string.IsNullOrEmpty(info)) { UserLog userLog = new UserLog() { @@ -76,7 +77,7 @@ namespace BPASmartClient.CustomResource.Pages.Model RunLog?.Invoke(info); } } - + int AlarmID; public void ShowAlarmLog(string info, string AlarmNumber = "_", AlarmLevel level = AlarmLevel.一般报警) { @@ -97,5 +98,39 @@ namespace BPASmartClient.CustomResource.Pages.Model AlarmLog?.Invoke(info); } } + + public bool ShowDialog(string info, DialogType dialogType = DialogType.Information) + { + PromptView PV = new PromptView(); + switch (dialogType) + { + case DialogType.Warning: + PV.TextBlockIcon = ""; + PV.TextBlockForeground = Brushes.Yellow; + PV.TextBlockInfo = $"警告:{info}"; + break; + case DialogType.Error: + PV.TextBlockIcon = ""; + PV.TextBlockForeground = Brushes.Red; + PV.TextBlockInfo = $"错误:{info}"; + break; + case DialogType.Information: + PV.TextBlockIcon = ""; + PV.TextBlockForeground = Brushes.DeepSkyBlue; + PV.TextBlockInfo = $"提示:{info}"; + break; + default: + break; + } + var res = PV.ShowDialog(); + return res == null ? false : (bool)res; + } + } + + public enum DialogType + { + Warning, + Error, + Information, } } diff --git a/BPASmartClient.CustomResource/Pages/View/PromptView.xaml b/BPASmartClient.CustomResource/Pages/View/PromptView.xaml index 917ceb69..78dc8238 100644 --- a/BPASmartClient.CustomResource/Pages/View/PromptView.xaml +++ b/BPASmartClient.CustomResource/Pages/View/PromptView.xaml @@ -13,6 +13,21 @@ WindowStartupLocation="CenterScreen" WindowStyle="None" mc:Ignorable="d"> + + + + + @@ -34,8 +49,12 @@ - + + + + + - + + + + + BorderBrush="#e69519" + FontSize="14" + Foreground="LightGray" + Text="{Binding MaterialWeight}" /> + + +