diff --git a/BPASmartClient.SCADAControl/BPASmartClient.SCADAControl.csproj b/BPASmartClient.SCADAControl/BPASmartClient.SCADAControl.csproj
index 90ffcd71..6c7bc60f 100644
--- a/BPASmartClient.SCADAControl/BPASmartClient.SCADAControl.csproj
+++ b/BPASmartClient.SCADAControl/BPASmartClient.SCADAControl.csproj
@@ -17,19 +17,23 @@
+
+
+
+
@@ -49,15 +53,24 @@
+
+
+
+
+
+
+
+
+
@@ -114,6 +127,9 @@
Always
+
+ Always
+
Always
@@ -123,12 +139,18 @@
Always
+
+ Always
+
Always
Always
+
+ Always
+
Always
@@ -147,6 +169,9 @@
Always
+
+ Always
+
Always
@@ -213,15 +238,30 @@
Always
+
+ Always
+
Always
Always
+
+ Always
+
+
+ Always
+
+
+ Always
+
Always
+
+ Always
+
Always
@@ -231,6 +271,15 @@
Always
+
+ Always
+
+
+ Always
+
+
+ Always
+
Always
@@ -240,6 +289,9 @@
Always
+
+ Always
+
Always
diff --git a/BPASmartClient.SCADAControl/CustomerControls/FYFTheListBox.xaml b/BPASmartClient.SCADAControl/CustomerControls/FYFTheListBox.xaml
index 1d5f0f01..2152c230 100644
--- a/BPASmartClient.SCADAControl/CustomerControls/FYFTheListBox.xaml
+++ b/BPASmartClient.SCADAControl/CustomerControls/FYFTheListBox.xaml
@@ -8,12 +8,10 @@
d:DesignHeight="450" d:DesignWidth="800">
+ Background="{x:Null}" Foreground="White" >
-
+
diff --git a/BPASmartClient.SCADAControl/CustomerControls/FYFTheListBox.xaml.cs b/BPASmartClient.SCADAControl/CustomerControls/FYFTheListBox.xaml.cs
index a72fba62..8f422fb1 100644
--- a/BPASmartClient.SCADAControl/CustomerControls/FYFTheListBox.xaml.cs
+++ b/BPASmartClient.SCADAControl/CustomerControls/FYFTheListBox.xaml.cs
@@ -23,7 +23,7 @@ namespace BPASmartClient.SCADAControl.CustomerControls
///
/// FYFTheListBox.xaml 的交互逻辑
///
- public partial class FYFTheListBox : UserControl
+ public partial class FYFTheListBox : UserControl, IExecutable
{
///
/// 数据model
@@ -34,15 +34,8 @@ namespace BPASmartClient.SCADAControl.CustomerControls
public FYFTheListBox()
{
InitializeComponent();
- this.DataContext = TheListBoxModel;
- TheListBoxModel.ViewItems.Add(new ItemModel { Name = "张三", Ph = "125486545" });
- TheListBoxModel.ViewItems.Add(new ItemModel { Name = "李四", Ph = "125486545" });
- TheListBoxModel.ViewItems.Add(new ItemModel { Name = "王麻子", Ph = "125486545" });
- TheListBoxModel.ViewItems.Add(new ItemModel { Name = "二货", Ph = "125486545" });
- TheListBoxModel.ViewItems.Add(new ItemModel { Name = "张三1", Ph = "125486545" });
- TheListBoxModel.ViewItems.Add(new ItemModel { Name = "李四2", Ph = "125486545" });
- TheListBoxModel.ViewItems.Add(new ItemModel { Name = "王麻子3", Ph = "125486545" });
- this.SizeChanged += Silos_SizeChanged; ;
+
+ this.SizeChanged += Silos_SizeChanged;
}
private void Silos_SizeChanged(object sender, SizeChangedEventArgs e)
{
@@ -52,10 +45,22 @@ namespace BPASmartClient.SCADAControl.CustomerControls
{
// do something with tb here
listView = tb;
+ listView.PreviewMouseMove += ListView_PreviewMouseMove;
+ listView.PreviewMouseLeftButtonUp += lisbox_PreviewMouseLeftButtonUp;
+ listView.PreviewMouseLeftButtonDown += ListView_PreviewMouseLeftButtonDown;
+ TheListBoxModel.ViewItems.Add(new ItemModel { Name = "张三", Ph = "125486545" });
+ TheListBoxModel.ViewItems.Add(new ItemModel { Name = "李四", Ph = "125486545" });
+ TheListBoxModel.ViewItems.Add(new ItemModel { Name = "王麻子", Ph = "125486545" });
+ TheListBoxModel.ViewItems.Add(new ItemModel { Name = "二货", Ph = "125486545" });
+ TheListBoxModel.ViewItems.Add(new ItemModel { Name = "张三1", Ph = "125486545" });
+ TheListBoxModel.ViewItems.Add(new ItemModel { Name = "李四2", Ph = "125486545" });
+ TheListBoxModel.ViewItems.Add(new ItemModel { Name = "王麻子3", Ph = "125486545" });
+ this.DataContext = TheListBoxModel;
}
}
}
+
public string ControlType => "控件";
private bool isExecuteState;
@@ -98,6 +103,45 @@ namespace BPASmartClient.SCADAControl.CustomerControls
///
///
///
+ ///
+ private void ListView_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+ {
+ try
+ {
+ //isDown变量是防止多次操作。
+ if (isDown)
+ {
+ isDown = false;
+ return;
+ }
+ var pos = e.GetPosition(listView);
+ HitTestResult result = VisualTreeHelper.HitTest(listView, pos);
+ if (result != null)
+ {
+ ChildElement = Utils.FindVisualParent(result.VisualHit);
+ if (ChildElement != null)
+ {
+ ChildElement.CaptureMouse();//设置了鼠标捕获,这样它可以不受到其它控件的影响。
+ ChildListBoxItem = Utils.FindVisualParent(VisualTreeHelper.HitTest(ChildElement, e.GetPosition(ChildElement)).VisualHit);
+
+ //创建一个Pop,表明拖拽开始
+ CreatePopup(ChildElement, e);
+
+ isDown = true;
+ }
+ }
+
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
+ ///
+ /// 鼠标按下事件-->暂时不用
+ ///
+ ///
+ ///
private void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
try
diff --git a/BPASmartClient.SCADAControl/CustomerControls/TheMessage.xaml b/BPASmartClient.SCADAControl/CustomerControls/TheMessage.xaml
new file mode 100644
index 00000000..7f715051
--- /dev/null
+++ b/BPASmartClient.SCADAControl/CustomerControls/TheMessage.xaml
@@ -0,0 +1,12 @@
+
+
+
+
+
diff --git a/BPASmartClient.SCADAControl/CustomerControls/TheMessage.xaml.cs b/BPASmartClient.SCADAControl/CustomerControls/TheMessage.xaml.cs
new file mode 100644
index 00000000..e333a5b9
--- /dev/null
+++ b/BPASmartClient.SCADAControl/CustomerControls/TheMessage.xaml.cs
@@ -0,0 +1,109 @@
+using BPASmartClient.Compiler;
+using BPASmartClient.SCADAControl.Windows;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+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.SCADAControl.CustomerControls
+{
+ ///
+ /// TheMessage.xaml 的交互逻辑
+ ///
+ public partial class TheMessage : UserControl, IExecutable
+ {
+ public event EventHandler PropertyChange; //声明一个事件
+ public string ControlType => "控件";
+ private bool isExecuteState;
+ public bool IsExecuteState
+ {
+ get { return isExecuteState; }
+ set
+ {
+ isExecuteState = value;
+ if (IsExecuteState)
+ {
+ Register();
+ }
+ }
+ }
+ public TheMessage()
+ {
+ InitializeComponent();
+ Width = 40;
+ Height = 40;
+ }
+ public void Register()
+ {
+
+ }
+
+ #region 弹窗属性
+ [Category("消息类型")]
+ public MessageBoxStyle MessageLX
+ {
+ get { return (MessageBoxStyle)GetValue(MessageLXProperty); }
+ set { SetValue(MessageLXProperty, value); }
+ }
+ public static readonly DependencyProperty MessageLXProperty =
+ DependencyProperty.Register("MessageLX", typeof(MessageBoxStyle), typeof(TheMessage), new PropertyMetadata(MessageBoxStyle.info));
+ [Category("消息数据")]
+ public string Message
+ {
+ get { return (string)GetValue(MessageProperty); }
+ set
+ {
+ SetValue(MessageProperty, value);
+ MessageDataRefresh();
+ }
+ }
+ public static readonly DependencyProperty MessageProperty =
+ DependencyProperty.Register("Message", typeof(string), typeof(TheMessage), new PropertyMetadata(string.Empty));
+ [Category("消息数据")]
+ public bool ReturnValue
+ {
+ get { return (bool)GetValue(ReturnValueProperty); }
+ set
+ {
+ SetValue(ReturnValueProperty, value);
+ }
+ }
+ public static readonly DependencyProperty ReturnValueProperty =
+ DependencyProperty.Register("ReturnValue", typeof(bool), typeof(TheMessage), new PropertyMetadata(false));
+ public void MessageDataRefresh()
+ {
+ try
+ {
+ if (!string.IsNullOrEmpty(Message))
+ {
+ if (MessageBoxStyle.question == MessageLX)
+ {
+ ReturnValue = false;
+ bool? bo= new MyMessageBox(MessageLX, Message).ShowDialog();
+ ReturnValue=bo.Value;
+ }
+ else
+ {
+ new MyMessageBox(MessageLX, Message).ShowDialog();
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
+ #endregion
+ }
+}
diff --git a/BPASmartClient.SCADAControl/CustomerControls/ThePopMessage.xaml b/BPASmartClient.SCADAControl/CustomerControls/ThePopMessage.xaml
new file mode 100644
index 00000000..0d9ae781
--- /dev/null
+++ b/BPASmartClient.SCADAControl/CustomerControls/ThePopMessage.xaml
@@ -0,0 +1,12 @@
+
+
+
+
+
diff --git a/BPASmartClient.SCADAControl/CustomerControls/ThePopMessage.xaml.cs b/BPASmartClient.SCADAControl/CustomerControls/ThePopMessage.xaml.cs
new file mode 100644
index 00000000..f9fe8196
--- /dev/null
+++ b/BPASmartClient.SCADAControl/CustomerControls/ThePopMessage.xaml.cs
@@ -0,0 +1,89 @@
+using BPASmartClient.Compiler;
+using BPASmartClient.SCADAControl.Windows;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+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.SCADAControl.CustomerControls
+{
+ ///
+ /// ThePopMessage.xaml 的交互逻辑
+ ///
+ public partial class ThePopMessage : UserControl, IExecutable
+ {
+ public event EventHandler PropertyChange; //声明一个事件
+ public string ControlType => "控件";
+ private bool isExecuteState;
+ public bool IsExecuteState
+ {
+ get { return isExecuteState; }
+ set
+ {
+ isExecuteState = value;
+ if (IsExecuteState)
+ {
+ Register();
+ }
+ }
+ }
+ public ThePopMessage()
+ {
+ InitializeComponent();
+ Width = 40;
+ Height = 40;
+ }
+ public void Register()
+ {
+
+ }
+
+ #region 弹窗属性
+ [Category("消息类型")]
+ public EnumPromptType MessageLX
+ {
+ get { return (EnumPromptType)GetValue(MessageLXProperty); }
+ set { SetValue(MessageLXProperty, value); }
+ }
+ public static readonly DependencyProperty MessageLXProperty =
+ DependencyProperty.Register("MessageLX", typeof(EnumPromptType), typeof(ThePopMessage), new PropertyMetadata(EnumPromptType.Info));
+ [Category("消息数据")]
+ public string Message
+ {
+ get { return (string)GetValue(MessageProperty); }
+ set
+ {
+ SetValue(MessageProperty, value);
+ MessageDataRefresh();
+ }
+ }
+ public static readonly DependencyProperty MessageProperty =
+ DependencyProperty.Register("Message", typeof(string), typeof(ThePopMessage), new PropertyMetadata(string.Empty));
+ public void MessageDataRefresh()
+ {
+ try
+ {
+ if (!string.IsNullOrEmpty(Message))
+ {
+ NoticeDemoViewModel.OpenMsg(MessageLX, Window.GetWindow(this), "通知", Message);
+ }
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
+ #endregion
+ }
+}
diff --git a/BPASmartClient.SCADAControl/Images/btn_close.png b/BPASmartClient.SCADAControl/Images/btn_close.png
new file mode 100644
index 00000000..c531c188
Binary files /dev/null and b/BPASmartClient.SCADAControl/Images/btn_close.png differ
diff --git a/BPASmartClient.SCADAControl/Images/error.png b/BPASmartClient.SCADAControl/Images/error.png
new file mode 100644
index 00000000..4f255caf
Binary files /dev/null and b/BPASmartClient.SCADAControl/Images/error.png differ
diff --git a/BPASmartClient.SCADAControl/Images/info.png b/BPASmartClient.SCADAControl/Images/info.png
new file mode 100644
index 00000000..aea9b407
Binary files /dev/null and b/BPASmartClient.SCADAControl/Images/info.png differ
diff --git a/BPASmartClient.SCADAControl/Images/question.png b/BPASmartClient.SCADAControl/Images/question.png
new file mode 100644
index 00000000..2c8a0c59
Binary files /dev/null and b/BPASmartClient.SCADAControl/Images/question.png differ
diff --git a/BPASmartClient.SCADAControl/Images/告警.png b/BPASmartClient.SCADAControl/Images/告警.png
new file mode 100644
index 00000000..3e6042e2
Binary files /dev/null and b/BPASmartClient.SCADAControl/Images/告警.png differ
diff --git a/BPASmartClient.SCADAControl/Images/弹窗消息.png b/BPASmartClient.SCADAControl/Images/弹窗消息.png
new file mode 100644
index 00000000..ba0fdf72
Binary files /dev/null and b/BPASmartClient.SCADAControl/Images/弹窗消息.png differ
diff --git a/BPASmartClient.SCADAControl/Images/报错.png b/BPASmartClient.SCADAControl/Images/报错.png
new file mode 100644
index 00000000..21fa4117
Binary files /dev/null and b/BPASmartClient.SCADAControl/Images/报错.png differ
diff --git a/BPASmartClient.SCADAControl/Images/正常.png b/BPASmartClient.SCADAControl/Images/正常.png
new file mode 100644
index 00000000..7aa97469
Binary files /dev/null and b/BPASmartClient.SCADAControl/Images/正常.png differ
diff --git a/BPASmartClient.SCADAControl/Images/消息.png b/BPASmartClient.SCADAControl/Images/消息.png
new file mode 100644
index 00000000..d260c772
Binary files /dev/null and b/BPASmartClient.SCADAControl/Images/消息.png differ
diff --git a/BPASmartClient.SCADAControl/Images/消息提示.png b/BPASmartClient.SCADAControl/Images/消息提示.png
new file mode 100644
index 00000000..9be0eec0
Binary files /dev/null and b/BPASmartClient.SCADAControl/Images/消息提示.png differ
diff --git a/BPASmartClient.SCADAControl/Images/背景2.png b/BPASmartClient.SCADAControl/Images/背景2.png
new file mode 100644
index 00000000..03580fad
Binary files /dev/null and b/BPASmartClient.SCADAControl/Images/背景2.png differ
diff --git a/BPASmartClient.SCADAControl/Windows/ControlEnum.cs b/BPASmartClient.SCADAControl/Windows/ControlEnum.cs
new file mode 100644
index 00000000..3b0ed78d
--- /dev/null
+++ b/BPASmartClient.SCADAControl/Windows/ControlEnum.cs
@@ -0,0 +1,255 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.SCADAControl.Windows
+{
+ #region EnumDatePickerType
+ public enum EnumDatePickerType
+ {
+ ///
+ /// 单个日期
+ ///
+ SingleDate,
+ ///
+ /// 连续的多个日期
+ ///
+ SingleDateRange,
+ ///
+ /// 只显示年份
+ ///
+ Year,
+ ///
+ /// 只显示月份
+ ///
+ Month,
+ ///
+ /// 显示一个日期和时间
+ ///
+ DateTime,
+ ///
+ /// 显示连续的日期和时间
+ ///
+ DateTimeRange,
+ }
+ #endregion
+
+ #region FlatButtonSkinEnum
+ ///
+ /// Button类型
+ ///
+ public enum FlatButtonSkinEnum
+ {
+ Yes,
+ No,
+ Default,
+ primary,
+ ghost,
+ dashed,
+ text,
+ info,
+ success,
+ error,
+ warning,
+ }
+ #endregion
+
+ #region EnumPromptType
+ ///
+ /// 提示类型
+ ///
+ public enum EnumPromptType
+ {
+ ///
+ /// 消息
+ ///
+ Info,
+ ///
+ /// 警告
+ ///
+ Warn,
+ ///
+ /// 失败
+ ///
+ Error,
+ ///
+ /// 成功
+ ///
+ Success,
+ }
+ #endregion
+
+ ///
+ /// 加载类型
+ ///
+ #region EnumLoadingType
+ public enum EnumLoadingType
+ {
+ ///
+ /// 两个圆
+ ///
+ DoubleRound,
+ ///
+ /// 一个圆
+ ///
+ SingleRound,
+ ///
+ /// 仿Win10加载条
+ ///
+ Win10,
+ ///
+ /// 仿Android加载条
+ ///
+ Android,
+ ///
+ /// 仿苹果加载条
+ ///
+ Apple,
+ Cogs,
+ Normal,
+ ///
+ /// 线条动画
+ ///
+ Lines,
+ ///
+ /// 方格动画
+ ///
+ Grids,
+ ///
+ /// 中心旋转动画
+ ///
+ Rotate,
+ ///
+ /// 版块加载
+ ///
+ Block,
+ ///
+ /// 自定义图标动画
+ ///
+ PathAnimation
+ }
+ #endregion
+
+ ///
+ /// 方向
+ ///
+ #region EnumPlacement
+ public enum EnumPlacement
+ {
+ ///
+ /// 左上
+ ///
+ LeftTop,
+ ///
+ /// 左中
+ ///
+ LeftCenter,
+ ///
+ /// 左下
+ ///
+ LeftBottom,
+ ///
+ /// 右上
+ ///
+ RightTop,
+ ///
+ /// 右中
+ ///
+ RightCenter,
+ ///
+ /// 右下
+ ///
+ RightBottom,
+ ///
+ /// 上左
+ ///
+ TopLeft,
+ ///
+ /// 上中
+ ///
+ TopCenter,
+ ///
+ /// 上右
+ ///
+ TopRight,
+ ///
+ /// 下左
+ ///
+ BottomLeft,
+ ///
+ /// 下中
+ ///
+ BottomCenter,
+ ///
+ /// 下右
+ ///
+ BottomRight,
+ }
+ #endregion
+
+ ///
+ /// 动画容器类型
+ ///
+ public enum TransitionMode
+ {
+ Right2Left,
+ Left2Right,
+ Bottom2Top,
+ Top2Bottom,
+ Right2LeftWithFade,
+ Left2RightWithFade,
+ Bottom2TopWithFade,
+ Top2BottomWithFade,
+ Fade,
+ Custom
+ }
+ ///
+ /// 联系人类型
+ ///
+ public enum ContactType
+ {
+ SerialNumber,
+ Single,
+ Group,
+ AddUser,
+ CutUser
+ }
+ ///
+ /// 进度条类型
+ ///
+ public enum ProgressBarType
+ {
+ Line,
+ Round
+ }
+ ///
+ /// XAML显示类型
+ ///
+ public enum Scope
+ {
+ None,
+ This,
+ ThisAndChildren
+ }
+ ///
+ /// 加减数字控件
+ ///
+ public enum EnumCompare
+ {
+ ///
+ /// 小于
+ ///
+ Less,
+ ///
+ /// 等于
+ ///
+ Equal,
+ ///
+ /// 大于
+ ///
+ Large,
+ None,
+ }
+}
diff --git a/BPASmartClient.SCADAControl/Windows/MyMessageBox.xaml b/BPASmartClient.SCADAControl/Windows/MyMessageBox.xaml
new file mode 100644
index 00000000..b37bd084
--- /dev/null
+++ b/BPASmartClient.SCADAControl/Windows/MyMessageBox.xaml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+ 提示
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BPASmartClient.SCADAControl/Windows/MyMessageBox.xaml.cs b/BPASmartClient.SCADAControl/Windows/MyMessageBox.xaml.cs
new file mode 100644
index 00000000..8bb249b5
--- /dev/null
+++ b/BPASmartClient.SCADAControl/Windows/MyMessageBox.xaml.cs
@@ -0,0 +1,126 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+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.Forms;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace BPASmartClient.SCADAControl.Windows
+{
+ ///
+ /// MyMessageBox.xaml 的交互逻辑
+ ///
+ public partial class MyMessageBox : Window
+ {
+ public MyMessageBox(MessageBoxStyle messageBoxStyle, string msg)
+ {
+ InitializeComponent();
+ this.Width = 393;
+ btnYes.Click += BtnYes_Click;
+ btnNo.Click += BtnNo_Click;
+ btnOk.Click += BtnOk_Click;
+ this.KeyDown += MyMessageBox_KeyDown;
+ if (messageBoxStyle == MessageBoxStyle.info)
+ {
+ picICO.Source = new BitmapImage(new Uri("../Images/info.png", UriKind.Relative));
+ //picICO.Image = global::myAlarmSystem.Properties.Resources.info;
+ this.Title = "提示";
+ panel1.Visibility = Visibility.Visible;
+ panel2.Visibility = Visibility.Collapsed;
+ }
+ else if (messageBoxStyle == MessageBoxStyle.question)
+ {
+ picICO.Source = new BitmapImage(new Uri("../Images/question.png", UriKind.Relative));
+ //picICO.Image = global::myAlarmSystem.Properties.Resources.question;
+ this.Title = "询问";
+ panel1.Visibility = Visibility.Collapsed;
+ panel2.Visibility = Visibility.Visible;
+ }
+ else if (messageBoxStyle == MessageBoxStyle.error)
+ {
+ picICO.Source = new BitmapImage(new Uri("../Images/error.png", UriKind.Relative));
+ //picICO.Image = global::myAlarmSystem.Properties.Resources.error;
+ this.Title = "错误";
+ panel1.Visibility = Visibility.Visible;
+ panel2.Visibility = Visibility.Collapsed;
+ }
+
+ this.labInfo.Text = msg;
+
+ SizeF size = TextRenderer.MeasureText(msg, new Font("宋体", 15, System.Drawing.FontStyle.Regular));
+
+ int TempWidth = (int)size.Width;
+ if (TempWidth <= 289) { return; }
+
+ this.Height = 150+((int)size.Width/289)*20;
+ //this.panel1.Width = TempWidth - 20;
+ //this.panel2.Width = TempWidth - 20;
+ //btnYes.Width = TempWidth / 2 - 20;
+ //btnNo.Width = TempWidth / 2 - 20;
+ }
+
+ private void MyMessageBox_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
+ {
+ if (e.KeyStates == Keyboard.GetKeyStates(Key.N))
+ {
+ BtnNo_Click(null, null);
+ }
+ else if (e.KeyStates == Keyboard.GetKeyStates(Key.Y))
+ {
+ BtnYes_Click(null, null);
+ }
+ else if (e.KeyStates == Keyboard.GetKeyStates(Key.O))
+ {
+ BtnOk_Click(null, null);
+ }
+ }
+
+ private void BtnOk_Click(object sender, RoutedEventArgs e)
+ {
+ this.DialogResult = true;
+ }
+
+ private void BtnNo_Click(object sender, RoutedEventArgs e)
+ {
+ this.DialogResult = false;
+ }
+
+ private void BtnYes_Click(object sender, RoutedEventArgs e)
+ {
+ this.DialogResult = true;
+ }
+
+ private void Image_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+ {
+ this.Close();
+ }
+ }
+
+ ///
+ /// 消息样式类型
+ ///
+ public enum MessageBoxStyle
+ {
+ ///
+ /// 通知
+ ///
+ info = 0,
+ ///
+ /// 选择
+ ///
+ question = 1,
+ ///
+ /// 错误
+ ///
+ error = 2
+ };
+}
diff --git a/BPASmartClient.SCADAControl/Windows/MyMessageBoxViewModel.cs b/BPASmartClient.SCADAControl/Windows/MyMessageBoxViewModel.cs
new file mode 100644
index 00000000..d9174201
--- /dev/null
+++ b/BPASmartClient.SCADAControl/Windows/MyMessageBoxViewModel.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.SCADAControl.Windows
+{
+ ///
+ /// 消息提示框
+ ///
+ public class MyMessageBoxViewModel
+ {
+ ///
+ /// 提示对话框
+ ///
+ /// 消息内容
+ public static void ShowMessageBoxInfo(string msg)
+ {
+ new MyMessageBox(MessageBoxStyle.info, msg).ShowDialog();
+ }
+
+ ///
+ /// 错误对话框
+ ///
+ /// 消息内容
+ public static void ShowMessageBoxError(string msg)
+ {
+ new MyMessageBox(MessageBoxStyle.error, msg).ShowDialog();
+ }
+
+ ///
+ /// 询问对话框
+ ///
+ /// 消息内容
+ ///
+ public static bool? ShowMessageBoxQuestion(string msg)
+ {
+ return new MyMessageBox(MessageBoxStyle.question, msg).ShowDialog();
+ }
+ }
+}
diff --git a/BPASmartClient.SCADAControl/Windows/NoticeDemoViewModel.cs b/BPASmartClient.SCADAControl/Windows/NoticeDemoViewModel.cs
new file mode 100644
index 00000000..f4b2e8b0
--- /dev/null
+++ b/BPASmartClient.SCADAControl/Windows/NoticeDemoViewModel.cs
@@ -0,0 +1,90 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace BPASmartClient.SCADAControl.Windows
+{
+ ///
+ /// 弹出提示
+ ///
+ public class NoticeDemoViewModel
+ {
+ public static Notifiaction NotifiactionShow { get; set; }
+
+ #region 右侧弹框
+ ///
+ /// 初始化
+ ///
+ public static void OnStartup()
+ {
+ //初始化通知弹框
+ if (NotifiactionShow == null)
+ {
+ NotifiactionShow = new Notifiaction();
+ }
+ }
+ ///
+ /// 手动关闭
+ ///
+ public static void OnExit(string e)
+ {
+ switch (e)
+ {
+ case "Error":
+ NotifiactionShow.Clear(EnumPromptType.Error);
+ return;
+ case "Success":
+ NotifiactionShow.Clear(EnumPromptType.Success);
+ return;
+ case "Warm":
+ NotifiactionShow.Clear(EnumPromptType.Warn);
+ return;
+ case "Info":
+ NotifiactionShow.Clear(EnumPromptType.Info);
+ return;
+ default:
+ break;
+ }
+ //NoticeManager.ExitNotifiaction();
+
+ }
+
+ ///
+ /// 屏幕右下角信息提示弹窗
+ ///
+ /// 弹窗类型:Error、Success、Warm、Info,分别对应不同颜色
+ /// 弹窗消息类型:属性判证、XX告警...
+ /// 弹窗消息内容
+ /// 一般为对应目标的目标编号
+ /// 该条消息的ID
+ public static void OpenMsg(EnumPromptType type, System.Windows.Window window, string title, string content)
+ {
+ string text = string.Empty;
+ if (content != null)
+ {
+ if (content.Length < 40)
+ {
+ int count = 40 - content.Length;
+ for (int i = 0; i < count * 2; i++)
+ {
+ content += " ";
+ }
+
+ }
+ text = content;
+ }
+ if (NotifiactionShow == null) NotifiactionShow = new Notifiaction();
+ NotifiactionShow.AddNotifiaction(new NotifiactionModel()
+ {
+ Title = title,//"这是Error通知标题",
+ Content = text,//"这条通知不会自动关闭,需要点击关闭按钮",
+ ContentToolTip = content,
+ NotifiactionType = type,
+ window = window
+ });
+ }
+ #endregion
+ }
+}
diff --git a/BPASmartClient.SCADAControl/Windows/Notifiaction.xaml b/BPASmartClient.SCADAControl/Windows/Notifiaction.xaml
new file mode 100644
index 00000000..0552606d
--- /dev/null
+++ b/BPASmartClient.SCADAControl/Windows/Notifiaction.xaml
@@ -0,0 +1,145 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BPASmartClient.SCADAControl/Windows/Notifiaction.xaml.cs b/BPASmartClient.SCADAControl/Windows/Notifiaction.xaml.cs
new file mode 100644
index 00000000..38280a4a
--- /dev/null
+++ b/BPASmartClient.SCADAControl/Windows/Notifiaction.xaml.cs
@@ -0,0 +1,353 @@
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.ComponentModel;
+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.Interop;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+using System.Windows.Threading;
+
+namespace BPASmartClient.SCADAControl.Windows
+{
+ ///
+ /// Notifiaction.xaml 的交互逻辑
+ ///
+ public partial class Notifiaction : Window
+ {
+ private const byte MAX_NOTIFICATIONS = 10;
+ private readonly ObservableCollection buffer = new ObservableCollection();
+ private ObservableCollection NotifiactionList = new ObservableCollection();
+ private const double topOffset = 40;
+ private const double leftOffset = 350;
+ public DispatcherTimer uptimer = null;
+ public Notifiaction()
+ {
+ InitializeComponent();
+ this.NotificationsControl.DataContext = this.NotifiactionList;
+ this.Top = 130;
+ this.Left = SystemParameters.WorkArea.Left + SystemParameters.WorkArea.Width - this.Width;
+ this.Height = SystemParameters.WorkArea.Height - 460;
+ this.WindowStartupLocation = System.Windows.WindowStartupLocation.Manual;
+ if (uptimer == null)
+ uptimer = new DispatcherTimer();
+ uptimer.Tick += new EventHandler(_timer_Tick);
+ uptimer.Interval = TimeSpan.FromSeconds(1);
+ uptimer.Start();
+ }
+
+ #region 显示控制
+ ///
+ /// 线程消失函数
+ ///
+ ///
+ ///
+ private void _timer_Tick(object sender, EventArgs e)
+ {
+ NotifiactionList.ToList().ForEach(par =>
+ {
+ if (par.time > 0)
+ par.time = par.time - 1;
+ });
+ List Notifia = NotifiactionList.ToList().FindAll(x => x.time <= 0);
+ foreach (var item in Notifia)
+ {
+ RemoveNotification(item);
+ }
+ }
+ ///
+ /// 清除窗体显示函数
+ ///
+ ///
+ public void Clear(EnumPromptType type)
+ {
+ List buff = buffer.ToList().FindAll(x => x.NotifiactionType == type);
+ foreach (var item in buff)
+ {
+ buffer.Remove(item);
+ }
+ List Notifia = NotifiactionList.ToList().FindAll(x => x.NotifiactionType == type);
+ foreach (var item in Notifia)
+ {
+ NotifiactionList.Remove(item);
+ }
+ }
+ ///
+ /// 增加一个消息弹框
+ ///
+ ///
+ public void AddNotifiaction(NotifiactionModel notification)
+ {
+ try
+ {
+ var window = Window.GetWindow(notification.window);
+ var intPtr = new WindowInteropHelper(window).Handle;
+ var screen = System.Windows.Forms.Screen.FromHandle(intPtr);
+ this.Left = screen.WorkingArea.Left + screen.WorkingArea.Width / 2 - this.Width / 2;// screen.WorkingArea.Left + screen.WorkingArea.Width - this.Width;
+
+ WindowInteropHelper helper = new WindowInteropHelper(this);
+ helper.Owner = new WindowInteropHelper(notification.window).Handle;
+ this.Topmost = false;
+ if (notification.window != null)
+ {
+ if (notification.window.WindowState == WindowState.Minimized)
+ {
+ this.WindowState = WindowState.Minimized;
+ }
+ else
+ {
+ this.WindowState = WindowState.Normal;
+ }
+ }
+
+ if (NotifiactionList.Count + 1 > MAX_NOTIFICATIONS)//且数量超过了限制
+ {
+ buffer.Add(notification);
+ }
+ else//已经显示的没找到,数量没有超过限制
+ {
+ NotifiactionList.Add(notification);
+ }
+
+ if (NotifiactionList.Count > 0 && !IsActive)
+ this.Show();
+ }
+ catch (Exception ex)
+ {
+
+ }
+ }
+ ///
+ /// 将显示窗体移除
+ ///
+ ///
+ public void RemoveNotification(NotifiactionModel notification)
+ {
+ if (notification == null)
+ return;
+
+ if (NotifiactionList.Contains(notification))
+ NotifiactionList.Remove(notification);
+
+ if (buffer.Count > 0)
+ {
+ if (notification.NotifiactionType == EnumPromptType.Warn)
+ {
+ NotifiactionModel mode = buffer.ToList().Find(par => par.NotifiactionType == EnumPromptType.Info);
+ if (mode == null)
+ {
+ NotifiactionModel mode1 = buffer.ToList().Find(par => par.NotifiactionType == EnumPromptType.Success);
+ if (mode1 == null)
+ {
+ NotifiactionList.Add(buffer[0]);
+ buffer.RemoveAt(0);
+ }
+ else
+ {
+ NotifiactionList.Add(mode1);
+ buffer.Remove(mode);
+ }
+ }
+ else
+ {
+ NotifiactionList.Add(mode);
+ buffer.Remove(mode);
+ }
+ }
+ else if (notification.NotifiactionType == EnumPromptType.Info)
+ {
+ NotifiactionModel mode = buffer.ToList().Find(par => par.NotifiactionType == EnumPromptType.Success);
+ if (mode == null)
+ {
+ NotifiactionModel mode1 = buffer.ToList().Find(par => par.NotifiactionType == EnumPromptType.Warn);
+ if (mode1 == null)
+ {
+ NotifiactionList.Add(buffer[0]);
+ buffer.RemoveAt(0);
+ }
+ else
+ {
+ NotifiactionList.Add(mode1);
+ buffer.Remove(mode);
+ }
+ }
+ else
+ {
+ NotifiactionList.Add(mode);
+ buffer.Remove(mode);
+ }
+ }
+ else if (notification.NotifiactionType == EnumPromptType.Success)
+ {
+ NotifiactionModel mode = buffer.ToList().Find(par => par.NotifiactionType == EnumPromptType.Warn);
+ if (mode == null)
+ {
+ NotifiactionModel mode1 = buffer.ToList().Find(par => par.NotifiactionType == EnumPromptType.Info);
+ if (mode1 == null)
+ {
+ NotifiactionList.Add(buffer[0]);
+ buffer.RemoveAt(0);
+ }
+ else
+ {
+ NotifiactionList.Add(mode1);
+ buffer.Remove(mode);
+ }
+ }
+ else
+ {
+ NotifiactionList.Add(mode);
+ buffer.Remove(mode);
+ }
+ }
+ else
+ {
+ NotifiactionList.Add(buffer[0]);
+ buffer.RemoveAt(0);
+ }
+ }
+
+ //Close window if there's nothing to show
+ if (NotifiactionList.Count < 1)
+ Hide();
+ }
+
+ private void NoticeGrid_SizeChanged(object sender, SizeChangedEventArgs e)
+ {
+
+ }
+ #endregion
+
+ #region 窗体事件
+
+ ///
+ /// 关闭窗口
+ ///
+ ///
+ ///
+ private void PART_CloseButton_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
+ {
+ Image border = (Image)sender;
+ NotifiactionModel mode = border.DataContext as NotifiactionModel;
+ RemoveNotification(mode);
+ }
+ #endregion
+ }
+
+ public class NotifiactionModel : INotifyPropertyChanged
+ {
+ private int _count;
+ private string _content;
+ private int _time;
+ ///
+ /// Id不需要赋值
+ ///
+ public string Id { get; set; }
+ ///
+ /// 通知标题
+ ///
+ public string Title { get; set; }
+ ///
+ /// 通知内容
+ ///
+ public string Content
+ {
+ get { return _content; }
+ set
+ {
+ _content = value;
+ if (this.PropertyChanged != null)
+ {
+ this.PropertyChanged(this, new PropertyChangedEventArgs("Content"));
+ }
+ }
+ }
+ ///
+ /// 通知内容-显示全体
+ ///
+ public string ContentToolTip { get; set; }
+ ///
+ /// 通知类型
+ ///
+ private EnumPromptType enumPromptType;
+ public EnumPromptType NotifiactionType
+ {
+ get { return enumPromptType; }
+ set
+ {
+ enumPromptType = value;
+ switch (enumPromptType)
+ {
+ case EnumPromptType.Info:
+ color = Color.FromRgb(35, 132, 190);
+ break;
+ case EnumPromptType.Warn:
+ color = Color.FromRgb(255, 170, 22);
+ break;
+ case EnumPromptType.Error:
+ color = Color.FromRgb(245, 49, 49);
+ break;
+ case EnumPromptType.Success:
+ color = Color.FromRgb(28, 194, 59);
+ break;
+ }
+ if (this.PropertyChanged != null)
+ this.PropertyChanged(this, new PropertyChangedEventArgs("enumPromptType"));
+ }
+ }
+ ///
+ /// 背景颜色主题
+ ///
+ public Color color { get; set; }
+ ///
+ /// 文本颜色
+ ///
+ public Color textColor { get; set; }
+ ///
+ /// 外部windows
+ ///
+ public System.Windows.Window window { get; set; }
+ ///
+ /// 弹窗显示时长
+ ///
+ public int time
+ {
+ get { return _time; }
+ set
+ {
+ _time = value;
+ if (this.PropertyChanged != null)
+ this.PropertyChanged(this, new PropertyChangedEventArgs("time"));
+ }
+ }
+ public int count
+ {
+ get { return _count; }
+ set
+ {
+ _count = value;
+ if (this.PropertyChanged != null)
+ this.PropertyChanged(this, new PropertyChangedEventArgs("count"));
+ }
+ }//超过1显示数量
+ ///
+ /// 设置默认之
+ ///
+ public NotifiactionModel()
+ {
+ Id = Guid.NewGuid().ToString();
+ time = 5;
+ count = 1;
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+ }
+}
diff --git a/BeDesignerSCADA/Common/PropertyHelper.cs b/BeDesignerSCADA/Common/PropertyHelper.cs
index 2a6cf195..d7589802 100644
--- a/BeDesignerSCADA/Common/PropertyHelper.cs
+++ b/BeDesignerSCADA/Common/PropertyHelper.cs
@@ -21,7 +21,7 @@ namespace BeDesignerSCADA.Common
"StatusValue", "NumberValue", "Text",
"Direction","RefreshData",
"ChangedText","Content","SendText","LeftTogIsChecked","RightTogIsChecked",
- "Visibility"
+ "Visibility","Message","ReturnValue"
};
public static List GetCustomerControlProperty(List selectItems)
{
diff --git a/BeDesignerSCADA/Controls/CanvasPanelNew.xaml b/BeDesignerSCADA/Controls/CanvasPanelNew.xaml
index 0ed2cf8f..891c23d8 100644
--- a/BeDesignerSCADA/Controls/CanvasPanelNew.xaml
+++ b/BeDesignerSCADA/Controls/CanvasPanelNew.xaml
@@ -15,7 +15,6 @@
-
@@ -325,6 +324,7 @@
+
@@ -414,7 +414,6 @@
-
@@ -457,7 +456,6 @@
-
@@ -470,7 +468,6 @@
-
@@ -518,6 +515,7 @@
+
diff --git a/BeDesignerSCADA/Themes/Styles.xaml b/BeDesignerSCADA/Themes/Styles.xaml
index df866648..c2ca4e7b 100644
--- a/BeDesignerSCADA/Themes/Styles.xaml
+++ b/BeDesignerSCADA/Themes/Styles.xaml
@@ -375,7 +375,10 @@
-
+
+
+
+
@@ -430,16 +433,26 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/BeDesignerSCADA/ViewModel/MainViewModelNew.cs b/BeDesignerSCADA/ViewModel/MainViewModelNew.cs
index 448f20a1..f5db3681 100644
--- a/BeDesignerSCADA/ViewModel/MainViewModelNew.cs
+++ b/BeDesignerSCADA/ViewModel/MainViewModelNew.cs
@@ -160,7 +160,7 @@ namespace BeDesignerSCADA.ViewModel
///
public Dictionary ControlsNameValues = new Dictionary() {
- {"GestureTapButton","按钮" },
+ {"TheButton","按钮" },
{"TheTimer","计时器" },
{"TheCheckBox","勾选框" },
{"DigitalNumber","液晶数字" },
@@ -196,6 +196,9 @@ namespace BeDesignerSCADA.ViewModel
{"TheRectangle","矩形" },
{"TheEllipse","圆形" },
{"TheWuLiaoControl","物料集合控件" },
+ {"FYFTheListBox","列表控件-拖拽" },
+ {"ThePopMessage","消息弹窗" },
+ {"TheMessage","消息提示" },
};
#endregion
diff --git a/WPFDemo/Window2.xaml b/WPFDemo/Window2.xaml
index 797d065b..96617065 100644
--- a/WPFDemo/Window2.xaml
+++ b/WPFDemo/Window2.xaml
@@ -6,14 +6,11 @@
xmlns:local="clr-namespace:WPFDemo"
mc:Ignorable="d"
Title="Window2" Height="450" Width="800">
-
-
+
-
-
-
-
-
-
+
+
+
+