@@ -17,19 +17,23 @@ | |||
<None Remove="Images\biogebj.png" /> | |||
<None Remove="Images\bj.png" /> | |||
<None Remove="Images\btnkeys.png" /> | |||
<None Remove="Images\btn_close.png" /> | |||
<None Remove="Images\button1.png" /> | |||
<None Remove="Images\button2.png" /> | |||
<None Remove="Images\Cb_Checked.png" /> | |||
<None Remove="Images\Cb_HalfChecked.png" /> | |||
<None Remove="Images\databj.png" /> | |||
<None Remove="Images\error.png" /> | |||
<None Remove="Images\Exp.png" /> | |||
<None Remove="Images\Image_32x32.png" /> | |||
<None Remove="Images\info.png" /> | |||
<None Remove="Images\leftImage.png" /> | |||
<None Remove="Images\mqtt.png" /> | |||
<None Remove="Images\mqttrun.png" /> | |||
<None Remove="Images\mqttstop.png" /> | |||
<None Remove="Images\nbbj.png" /> | |||
<None Remove="Images\Pop_bg.png" /> | |||
<None Remove="Images\question.png" /> | |||
<None Remove="Images\redis.png" /> | |||
<None Remove="Images\redisrun.png" /> | |||
<None Remove="Images\redisstop.png" /> | |||
@@ -49,15 +53,24 @@ | |||
<None Remove="Images\光柱.png" /> | |||
<None Remove="Images\右1.png" /> | |||
<None Remove="Images\右2.png" /> | |||
<None Remove="Images\告警.png" /> | |||
<None Remove="Images\左1.png" /> | |||
<None Remove="Images\左2.png" /> | |||
<None Remove="Images\弹窗消息.png" /> | |||
<None Remove="Images\报错.png" /> | |||
<None Remove="Images\拉出 - 副本.png" /> | |||
<None Remove="Images\拉出.png" /> | |||
<None Remove="Images\收缩 - 副本.png" /> | |||
<None Remove="Images\收缩.png" /> | |||
<None Remove="Images\日期1.png" /> | |||
<None Remove="Images\暂无图片.png" /> | |||
<None Remove="Images\正常.png" /> | |||
<None Remove="Images\消息.png" /> | |||
<None Remove="Images\消息提示.png" /> | |||
<None Remove="Images\矩形边框.png" /> | |||
<None Remove="Images\矩形边框1.png" /> | |||
<None Remove="Images\系统名称.png" /> | |||
<None Remove="Images\背景2.png" /> | |||
<None Remove="Images\返回按钮1.png" /> | |||
<None Remove="Images\返回按钮2.png" /> | |||
<None Remove="Images\返回按钮图标.png" /> | |||
@@ -114,6 +127,9 @@ | |||
<Resource Include="Images\btnkeys.png"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Resource> | |||
<Resource Include="Images\btn_close.png"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Resource> | |||
<Resource Include="Images\Cb_Checked.png"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Resource> | |||
@@ -123,12 +139,18 @@ | |||
<Resource Include="Images\databj.png"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Resource> | |||
<Resource Include="Images\error.png"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Resource> | |||
<Resource Include="Images\Exp.png"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Resource> | |||
<Resource Include="Images\Image_32x32.png"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Resource> | |||
<Resource Include="Images\info.png"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Resource> | |||
<Resource Include="Images\leftImage.png"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Resource> | |||
@@ -147,6 +169,9 @@ | |||
<Resource Include="Images\Pop_bg.png"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Resource> | |||
<Resource Include="Images\question.png"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Resource> | |||
<Resource Include="Images\redis.png"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Resource> | |||
@@ -213,15 +238,30 @@ | |||
<Resource Include="Images\右2.png"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Resource> | |||
<Resource Include="Images\告警.png"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Resource> | |||
<Resource Include="Images\左1.png"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Resource> | |||
<Resource Include="Images\左2.png"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Resource> | |||
<Resource Include="Images\弹窗消息.png"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Resource> | |||
<Resource Include="Images\报错.png"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Resource> | |||
<Resource Include="Images\拉出 - 副本.png"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Resource> | |||
<Resource Include="Images\拉出.png"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Resource> | |||
<Resource Include="Images\收缩 - 副本.png"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Resource> | |||
<Resource Include="Images\收缩.png"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Resource> | |||
@@ -231,6 +271,15 @@ | |||
<Resource Include="Images\暂无图片.png"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Resource> | |||
<Resource Include="Images\正常.png"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Resource> | |||
<Resource Include="Images\消息.png"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Resource> | |||
<Resource Include="Images\消息提示.png"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Resource> | |||
<Resource Include="Images\矩形边框.png"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Resource> | |||
@@ -240,6 +289,9 @@ | |||
<Resource Include="Images\系统名称.png"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Resource> | |||
<Resource Include="Images\背景2.png"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Resource> | |||
<Resource Include="Images\返回按钮1.png"> | |||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | |||
</Resource> | |||
@@ -8,12 +8,10 @@ | |||
d:DesignHeight="450" d:DesignWidth="800"> | |||
<ListView | |||
ItemsSource="{Binding ViewItems,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" | |||
Background="{x:Null}" Foreground="White" | |||
PreviewMouseMove="ListView_PreviewMouseMove" | |||
PreviewMouseLeftButtonUp="lisbox_PreviewMouseLeftButtonUp"> | |||
Background="{x:Null}" Foreground="White" > | |||
<ListBox.ItemTemplate> | |||
<ItemContainerTemplate> | |||
<Border x:Name="border" Tag="border" BorderBrush="Aquamarine" MouseLeftButtonDown="Border_MouseLeftButtonDown" BorderThickness="1" Padding="5" Background="#FF18888A"> | |||
<Border Tag="border" BorderBrush="Aquamarine" BorderThickness="1" Padding="5" Background="#FF18888A"> | |||
<Grid> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="60"/> | |||
@@ -23,7 +23,7 @@ namespace BPASmartClient.SCADAControl.CustomerControls | |||
/// <summary> | |||
/// FYFTheListBox.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class FYFTheListBox : UserControl | |||
public partial class FYFTheListBox : UserControl, IExecutable | |||
{ | |||
/// <summary> | |||
/// 数据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 | |||
/// </summary> | |||
/// <param name="sender"></param> | |||
/// <param name="e"></param> | |||
/// <exception cref="NotImplementedException"></exception> | |||
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<ListBoxItem>(result.VisualHit); | |||
if (ChildElement != null) | |||
{ | |||
ChildElement.CaptureMouse();//设置了鼠标捕获,这样它可以不受到其它控件的影响。 | |||
ChildListBoxItem = Utils.FindVisualParent<ListBoxItem>(VisualTreeHelper.HitTest(ChildElement, e.GetPosition(ChildElement)).VisualHit); | |||
//创建一个Pop,表明拖拽开始 | |||
CreatePopup(ChildElement, e); | |||
isDown = true; | |||
} | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
} | |||
} | |||
/// <summary> | |||
/// 鼠标按下事件-->暂时不用 | |||
/// </summary> | |||
/// <param name="sender"></param> | |||
/// <param name="e"></param> | |||
private void Border_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) | |||
{ | |||
try | |||
@@ -0,0 +1,12 @@ | |||
<UserControl x:Class="BPASmartClient.SCADAControl.CustomerControls.TheMessage" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.SCADAControl.CustomerControls" | |||
mc:Ignorable="d" | |||
d:DesignHeight="40" d:DesignWidth="40"> | |||
<Grid> | |||
<Image Source="../Images/消息提示.png" Tag="正常" Visibility="Visible"/> | |||
</Grid> | |||
</UserControl> |
@@ -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 | |||
{ | |||
/// <summary> | |||
/// TheMessage.xaml 的交互逻辑 | |||
/// </summary> | |||
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 | |||
} | |||
} |
@@ -0,0 +1,12 @@ | |||
<UserControl x:Class="BPASmartClient.SCADAControl.CustomerControls.ThePopMessage" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:BPASmartClient.SCADAControl.CustomerControls" | |||
mc:Ignorable="d" | |||
d:DesignHeight="40" d:DesignWidth="40" > | |||
<Grid> | |||
<Image Source="../Images/弹窗消息.png" Tag="正常" Visibility="Visible"/> | |||
</Grid> | |||
</UserControl> |
@@ -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 | |||
{ | |||
/// <summary> | |||
/// ThePopMessage.xaml 的交互逻辑 | |||
/// </summary> | |||
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 | |||
} | |||
} |
@@ -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 | |||
{ | |||
/// <summary> | |||
/// 单个日期 | |||
/// </summary> | |||
SingleDate, | |||
/// <summary> | |||
/// 连续的多个日期 | |||
/// </summary> | |||
SingleDateRange, | |||
/// <summary> | |||
/// 只显示年份 | |||
/// </summary> | |||
Year, | |||
/// <summary> | |||
/// 只显示月份 | |||
/// </summary> | |||
Month, | |||
/// <summary> | |||
/// 显示一个日期和时间 | |||
/// </summary> | |||
DateTime, | |||
/// <summary> | |||
/// 显示连续的日期和时间 | |||
/// </summary> | |||
DateTimeRange, | |||
} | |||
#endregion | |||
#region FlatButtonSkinEnum | |||
/// <summary> | |||
/// Button类型 | |||
/// </summary> | |||
public enum FlatButtonSkinEnum | |||
{ | |||
Yes, | |||
No, | |||
Default, | |||
primary, | |||
ghost, | |||
dashed, | |||
text, | |||
info, | |||
success, | |||
error, | |||
warning, | |||
} | |||
#endregion | |||
#region EnumPromptType | |||
/// <summary> | |||
/// 提示类型 | |||
/// </summary> | |||
public enum EnumPromptType | |||
{ | |||
/// <summary> | |||
/// 消息 | |||
/// </summary> | |||
Info, | |||
/// <summary> | |||
/// 警告 | |||
/// </summary> | |||
Warn, | |||
/// <summary> | |||
/// 失败 | |||
/// </summary> | |||
Error, | |||
/// <summary> | |||
/// 成功 | |||
/// </summary> | |||
Success, | |||
} | |||
#endregion | |||
/// <summary> | |||
/// 加载类型 | |||
/// </summary> | |||
#region EnumLoadingType | |||
public enum EnumLoadingType | |||
{ | |||
/// <summary> | |||
/// 两个圆 | |||
/// </summary> | |||
DoubleRound, | |||
/// <summary> | |||
/// 一个圆 | |||
/// </summary> | |||
SingleRound, | |||
/// <summary> | |||
/// 仿Win10加载条 | |||
/// </summary> | |||
Win10, | |||
/// <summary> | |||
/// 仿Android加载条 | |||
/// </summary> | |||
Android, | |||
/// <summary> | |||
/// 仿苹果加载条 | |||
/// </summary> | |||
Apple, | |||
Cogs, | |||
Normal, | |||
/// <summary> | |||
/// 线条动画 | |||
/// </summary> | |||
Lines, | |||
/// <summary> | |||
/// 方格动画 | |||
/// </summary> | |||
Grids, | |||
/// <summary> | |||
/// 中心旋转动画 | |||
/// </summary> | |||
Rotate, | |||
/// <summary> | |||
/// 版块加载 | |||
/// </summary> | |||
Block, | |||
/// <summary> | |||
/// 自定义图标动画 | |||
/// </summary> | |||
PathAnimation | |||
} | |||
#endregion | |||
/// <summary> | |||
/// 方向 | |||
/// </summary> | |||
#region EnumPlacement | |||
public enum EnumPlacement | |||
{ | |||
/// <summary> | |||
/// 左上 | |||
/// </summary> | |||
LeftTop, | |||
/// <summary> | |||
/// 左中 | |||
/// </summary> | |||
LeftCenter, | |||
/// <summary> | |||
/// 左下 | |||
/// </summary> | |||
LeftBottom, | |||
/// <summary> | |||
/// 右上 | |||
/// </summary> | |||
RightTop, | |||
/// <summary> | |||
/// 右中 | |||
/// </summary> | |||
RightCenter, | |||
/// <summary> | |||
/// 右下 | |||
/// </summary> | |||
RightBottom, | |||
/// <summary> | |||
/// 上左 | |||
/// </summary> | |||
TopLeft, | |||
/// <summary> | |||
/// 上中 | |||
/// </summary> | |||
TopCenter, | |||
/// <summary> | |||
/// 上右 | |||
/// </summary> | |||
TopRight, | |||
/// <summary> | |||
/// 下左 | |||
/// </summary> | |||
BottomLeft, | |||
/// <summary> | |||
/// 下中 | |||
/// </summary> | |||
BottomCenter, | |||
/// <summary> | |||
/// 下右 | |||
/// </summary> | |||
BottomRight, | |||
} | |||
#endregion | |||
/// <summary> | |||
/// 动画容器类型 | |||
/// </summary> | |||
public enum TransitionMode | |||
{ | |||
Right2Left, | |||
Left2Right, | |||
Bottom2Top, | |||
Top2Bottom, | |||
Right2LeftWithFade, | |||
Left2RightWithFade, | |||
Bottom2TopWithFade, | |||
Top2BottomWithFade, | |||
Fade, | |||
Custom | |||
} | |||
/// <summary> | |||
/// 联系人类型 | |||
/// </summary> | |||
public enum ContactType | |||
{ | |||
SerialNumber, | |||
Single, | |||
Group, | |||
AddUser, | |||
CutUser | |||
} | |||
/// <summary> | |||
/// 进度条类型 | |||
/// </summary> | |||
public enum ProgressBarType | |||
{ | |||
Line, | |||
Round | |||
} | |||
/// <summary> | |||
/// XAML显示类型 | |||
/// </summary> | |||
public enum Scope | |||
{ | |||
None, | |||
This, | |||
ThisAndChildren | |||
} | |||
/// <summary> | |||
/// 加减数字控件 | |||
/// </summary> | |||
public enum EnumCompare | |||
{ | |||
/// <summary> | |||
/// 小于 | |||
/// </summary> | |||
Less, | |||
/// <summary> | |||
/// 等于 | |||
/// </summary> | |||
Equal, | |||
/// <summary> | |||
/// 大于 | |||
/// </summary> | |||
Large, | |||
None, | |||
} | |||
} |
@@ -0,0 +1,47 @@ | |||
<Window x:Class="BPASmartClient.SCADAControl.Windows.MyMessageBox" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:local="clr-namespace:BPASmartClient.SCADAControl.Windows" | |||
mc:Ignorable="d" | |||
x:Name="frmMessageBox" | |||
WindowState="Normal" | |||
WindowStyle="None" | |||
WindowStartupLocation="CenterScreen" | |||
Title="提示" Height="150" Width="393"> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="19"/> | |||
<RowDefinition/> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="100"/> | |||
<ColumnDefinition/> | |||
</Grid.ColumnDefinitions> | |||
<Grid Grid.Row="0" Grid.ColumnSpan="2"> | |||
<TextBlock Margin="10,0,0,0" FontSize="18" FontFamily="宋体" VerticalAlignment="Center" HorizontalAlignment="Left">提示</TextBlock> | |||
<Image Margin="0,0,10,0" VerticalAlignment="Center" HorizontalAlignment="Right" Source="../Images/报错.png" Cursor="Hand" MouseLeftButtonDown="Image_MouseLeftButtonDown"></Image> | |||
</Grid> | |||
<Image Grid.Row="1" x:Name="picICO" Width="70" Height="70" HorizontalAlignment="Center" VerticalAlignment="Center" Source="../Images/bj.png" Stretch="Fill"></Image> | |||
<Grid Grid.Column="1" Grid.Row="1" > | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="*"/> | |||
<RowDefinition Height="50"/> | |||
</Grid.RowDefinitions> | |||
<Border Padding="10"> | |||
<TextBlock x:Name="labInfo" Grid.Row="0" Text="确定要删除数据吗?" FontSize="18" FontFamily="宋体" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Center"></TextBlock> | |||
</Border> | |||
<Grid Grid.Row="1"> | |||
<StackPanel x:Name="panel2" Orientation="Horizontal"> | |||
<Button x:Name="btnYes" Cursor="Hand" Width="110" Height="31" Content="是(Y)" HorizontalAlignment="Left" VerticalAlignment="Top" ></Button> | |||
<Button x:Name="btnNo" Cursor="Hand" Width="110" Margin="30,0,0,0" Height="31" Content="否(N)" HorizontalAlignment="Left" VerticalAlignment="Top"></Button> | |||
</StackPanel> | |||
<StackPanel x:Name="panel1" Orientation="Horizontal" Visibility="Collapsed"> | |||
<Button x:Name="btnOk" Cursor="Hand" Width="250" Height="31" Content="确定(O)" HorizontalAlignment="Left" VerticalAlignment="Top" ></Button> | |||
</StackPanel> | |||
</Grid> | |||
</Grid> | |||
</Grid> | |||
</Window> |
@@ -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 | |||
{ | |||
/// <summary> | |||
/// MyMessageBox.xaml 的交互逻辑 | |||
/// </summary> | |||
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(); | |||
} | |||
} | |||
/// <summary> | |||
/// 消息样式类型 | |||
/// </summary> | |||
public enum MessageBoxStyle | |||
{ | |||
/// <summary> | |||
/// 通知 | |||
/// </summary> | |||
info = 0, | |||
/// <summary> | |||
/// 选择 | |||
/// </summary> | |||
question = 1, | |||
/// <summary> | |||
/// 错误 | |||
/// </summary> | |||
error = 2 | |||
}; | |||
} |
@@ -0,0 +1,42 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.SCADAControl.Windows | |||
{ | |||
/// <summary> | |||
/// 消息提示框 | |||
/// </summary> | |||
public class MyMessageBoxViewModel | |||
{ | |||
/// <summary> | |||
/// 提示对话框 | |||
/// </summary> | |||
/// <param name="msg">消息内容</param> | |||
public static void ShowMessageBoxInfo(string msg) | |||
{ | |||
new MyMessageBox(MessageBoxStyle.info, msg).ShowDialog(); | |||
} | |||
/// <summary> | |||
/// 错误对话框 | |||
/// </summary> | |||
/// <param name="msg">消息内容</param> | |||
public static void ShowMessageBoxError(string msg) | |||
{ | |||
new MyMessageBox(MessageBoxStyle.error, msg).ShowDialog(); | |||
} | |||
/// <summary> | |||
/// 询问对话框 | |||
/// </summary> | |||
/// <param name="msg">消息内容</param> | |||
/// <returns></returns> | |||
public static bool? ShowMessageBoxQuestion(string msg) | |||
{ | |||
return new MyMessageBox(MessageBoxStyle.question, msg).ShowDialog(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,90 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.SCADAControl.Windows | |||
{ | |||
/// <summary> | |||
/// 弹出提示 | |||
/// </summary> | |||
public class NoticeDemoViewModel | |||
{ | |||
public static Notifiaction NotifiactionShow { get; set; } | |||
#region 右侧弹框 | |||
/// <summary> | |||
/// 初始化 | |||
/// </summary> | |||
public static void OnStartup() | |||
{ | |||
//初始化通知弹框 | |||
if (NotifiactionShow == null) | |||
{ | |||
NotifiactionShow = new Notifiaction(); | |||
} | |||
} | |||
/// <summary> | |||
/// 手动关闭 | |||
/// </summary> | |||
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(); | |||
} | |||
/// <summary> | |||
/// 屏幕右下角信息提示弹窗 | |||
/// </summary> | |||
/// <param name="e">弹窗类型:Error、Success、Warm、Info,分别对应不同颜色</param> | |||
/// <param name="title">弹窗消息类型:属性判证、XX告警...</param> | |||
/// <param name="content">弹窗消息内容</param> | |||
/// <param name="kcmbbh">一般为对应目标的目标编号</param> | |||
/// <param name="id">该条消息的ID</param> | |||
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 | |||
} | |||
} |
@@ -0,0 +1,145 @@ | |||
<Window x:Class="BPASmartClient.SCADAControl.Windows.Notifiaction" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:local="clr-namespace:BPASmartClient.SCADAControl.Windows" | |||
mc:Ignorable="d" | |||
Title="Notifiaction" Width="300" MinHeight="700" | |||
AllowsTransparency="True" | |||
Background="Transparent" ShowActivated="False" | |||
ShowInTaskbar="False" | |||
UseLayoutRounding="True" WindowStyle="None" > | |||
<Window.Resources> | |||
<PathGeometry x:Key="Icon_Close" Figures="M754.782 212.596 512 455.368 269.218 212.596c-13.081-13.081-34.29-13.081-47.369 0-13.081 13.081-13.081 34.288 0 47.367l242.782 242.771L221.849 745.507c-13.081 13.081-13.081 34.288 0 47.367 13.081 13.081 34.29 13.081 47.369 0L512 550.103l242.782 242.771c13.081 13.081 34.289 13.081 47.37 0 13.081-13.081 13.081-34.288 0-47.367L559.37 502.735l242.782-242.771c13.081-13.081 13.081-34.288 0-47.367C789.07 199.517 767.862 199.517 754.782 212.596z" /> | |||
<PathGeometry x:Key="InfoIcon" Figures="M512 0C229.206 0 0 229.289 0 512s229.206 512 512 512 512-229.378 512-512C1024 229.289 794.794 0 512 0z m80.3 700.333c-38.656 58.028-77.911 102.656-144.128 102.656-45.139-7.339-63.66-39.678-53.844-72.617l85.078-281.683c2.05-6.911-1.367-14.25-7.678-16.467-6.228-2.216-18.6 5.972-29.267 17.578l-51.372 61.867c-1.367-10.328-0.083-27.561-0.083-34.473 38.572-58.027 102.06-103.766 145.15-103.766 40.872 4.183 60.16 36.95 53.077 72.872l-85.677 283.044c-1.112 6.484 2.216 12.8 8.105 15.017 6.228 2.133 19.539-5.972 30.206-17.667l51.455-61.866c1.284 10.333-1.022 28.505-1.022 35.505z m-11.433-367.96c-32.6 0-58.878-23.64-58.878-58.623s26.367-58.622 58.878-58.622c32.427 0 58.966 23.639 58.966 58.622s-26.455 58.622-58.966 58.622z" /> | |||
<!--<PathGeometry x:Key="WarnIcon" Figures="M514.63547095 64.50557607c-245.79772937 0-445.80505747 199.97978336-445.80505745 445.7795534 0 245.85077718 200.0073271 445.85810529 445.80505745 445.85810529 245.79875019 0 445.80505747-200.0073271 445.80505749-445.85810529C960.44052743 264.48535941 760.43422017 64.50557607 514.63547095 64.50557607zM572.44016637 798.25683382c-13.74446534 14.26678179-31.36753754 21.5057584-52.45401459 21.50575839-22.03113538 0-40.59886489-7.55216231-55.33899569-22.3453409-14.635056-14.79113893-22.03113538-32.5213256-22.03113537-52.66416523 0-19.46035985 6.87172326-35.87659514 20.50907311-48.78045812 17.93931743-17.04770793 36.61314256-25.70265117 55.39102367-25.70265118 20.40399732 0 38.08011732 7.3960794 52.55909039 21.92605961 14.58200819 14.47693239 21.92503973 32.31117502 21.92503974 53.08242667C593.00126648 766.25884451 586.0785361 784.14613494 572.44016637 798.25683382zM592.89721153 384.50077378l-26.12091168 136.06541617c-6.82071513 41.07119406-14.47693239 74.6932599-22.7656421 99.76545928l-0.94363748 3.04208384c0 0-8.28768988 0.42030118-11.59195128 0.42030118l-41.91077658-0.21015058-35.51138249-160.14195009c-12.43153382-62.47187666-20.40501816-106.16587322-24.39175932-133.59971641-2.09844638-17.73018767-3.09411183-30.84216056-3.09411182-39.34000105 0-2.51772771 0.7865347-7.92043552 2.5697547-16.10407044 1.5730694-17.57104421 8.39276469-31.21043477 20.24689454-40.23263136 11.43484853-8.60291527 27.48587116-13.74242565 47.89088833-15.21144013 10.85846444-1.67916503 18.25454379-2.57077553 21.55880619-2.57077552 23.28897839 0 43.22064757 6.03214073 59.16761426 17.99236524 16.4713238 12.27341122 24.75799285 29.68837249 24.75799287 51.87661064C602.75797079 305.71467607 599.50675619 337.81672134 592.89721153 384.50077378z" />--> | |||
<PathGeometry x:Key="ErrorIcon" Figures="M881.510752 573.386092c-15.745612-6.138814-21.400403-6.851035-48.313356-8.439206-26.912953-1.588171-31.004131 0.221034-59.474556 2.077312-128.870066 0.884137-257.154801 16.884552-382.724705 47.590901-80.273255 19.629059-159.52218 45.809325-235.43001 78.411861-48.994877 21.038152-57.654095 69.491701-15.294334 103.485933 50.149167 40.246633 118.762871-8.394181 164.725692-31.022551 78.463026-38.626739 315.544653-119.546723 404.01766-135.841851 99.574856-18.339694 186.075953-8.589632 187.662077-32.692586C894.074905 591.861886 897.256364 579.524906 881.510752 573.386092z M912.098397 578.64077c-23.939225 14.811334 6.349615 37.685297 27.733645 32.69975 25.548886-5.955642 18.216897-25.934672-0.203638-34.332946C929.971463 572.610426 919.367965 574.147432 912.098397 578.64077 M271.709285 387.416564c19.113313-8.293897 38.860053-15.419178 57.628512-24.099884 26.979468-12.481266 54.486962-30.454616 58.508555-62.534242 4.055362-32.310893-16.281825-58.32743-43.281759-73.349565-64.283072-35.768645-136.454812-2.146896-194.184631 30.063713-30.356378 16.941857-53.135174 43.911092-66.342987 75.990718-34.590819 83.989903-7.642051 197.990307 18.917862 254.121721 18.296715 38.675858 60.662615 56.901964 101.754498 55.561433 22.150486-0.723477 45.067428-6.814196 65.925479-13.956873 13.036921-4.461615 25.762757-9.830903 38.068014-16.030092 6.14393-3.099594 12.186554-6.405897 18.096147-9.934257 4.305049-2.569522 10.900258-9.100262 15.659655-10.091846 1.880837-0.38988 3.752464-1.033539 5.611811-1.943258 18.915815-9.314133 29.03836-26.543539 27.069519-46.076408-1.451048-14.461363-13.455453-29.566386-42.797735-28.596292-7.640004 0.252757-15.519462 1.623987-22.781866 3.963265-15.020088 4.845355-100.891851 58.340733-110.154819 37.502126-5.955642-13.403265 32.605605-27.402093 41.409109-31.347962 21.132296-9.466606 44.182268-13.373589 65.581648-22.104437 26.91193-10.980076 71.130014-32.04074 75.275427-65.014736 5.104251-40.612976-44.633546-45.369304-72.502267-40.136116-27.031657 5.078669-52.896744 12.673647-77.589123 25.018813-1.862417 0.933255-3.859911 1.889023-5.930059 1.648546-13.731746-1.593288 2.78237-15.542998 6.14086-17.753339C244.361427 400.046209 257.868045 393.427464 271.709285 387.416564 M566.432727 365.658004c-12.226462-11.811-32.686447-10.939143-48.75747-11.757788-20.536732-1.043772-41.192168 0.070608-61.497633 3.350304-75.191516 12.137435-54.967916 133.555785-40.393989 185.121208 6.725168 23.793916 40.133046 46.989197 57.488319 19.673062 9.198499-14.473643 1.916653-33.547047 1.585101-49.431829-0.313132-15.392572-0.656963-30.79026-0.86981-46.182832-0.319272-23.76424 8.90788-46.573735 31.006178-57.501622 22.234397-10.998495 53.559846-0.539282 64.325028-29.865191 0.887206-2.419096 1.520633-5.052063 0.957815-7.571443C569.845453 369.570103 568.390311 367.549074 566.432727 365.658004 M582.388117 392.262942c-11.023054 13.939477-10.873652 47.750537-11.437493 64.707744-0.586354 17.634636 1.388627 35.198663 4.034896 52.608172 0.832971 5.485945 2.725064 43.529399 16.673751 33.727149 3.596921-2.52859 8.435113-0.706081 12.378935-5.194302 12.890588-14.678304 17.025769-34.983769 18.679431-53.875025 0.952698-10.960633-2.405793-22.618137 0.553609-33.388435 4.76042-17.334807 17.551748-12.81998 31.66314-17.21508 25.586748-7.980765 41.24231-30.269397 12.945847-45.13906C649.435139 378.801349 597.08791 373.672538 582.388117 392.262942z M736.139873 496.272807c-3.832282 2.353604-8.368598 3.053546-13.228279 1.078565-24.283056-9.867742-4.149507-47.554062 21.378913-36.992519-0.147356 0.293689-0.25992 0.595564-0.38681 0.896416 0.309038 0.308015 0.688685 0.539282 0.949628 0.917906C751.596913 472.068546 746.357586 490.011196 736.139873 496.272807zM752.159732 413.68688c-15.767102-6.786567-31.175023-7.724938-45.830815 2.731204-10.084683 7.192819-17.23657 17.887392-22.060435 29.274744-10.021238 23.608697-19.142989 51.077306 2.40477 70.483284 13.657045 12.298094 37.884842 25.13547 56.625672 18.027585 13.382798-5.070482 22.468734-17.929348 28.14399-30.451546 11.054777-24.421202 15.767102-65.370847-8.566096-83.972507C759.845785 417.461857 756.147556 415.401941 752.159732 413.68688z M831.934636 482.111273c0.164752-0.167822 0.306992-0.357134 0.477884-0.522909 17.013489-16.610306 39.110763-10.090822 60.309574-12.124132 3.007497-0.289596 5.5279-3.162016 3.490497-6.037507-9.083889-12.839423-22.604834-18.491143-37.19104-23.449062-8.798387-2.995217-16.394389 3.368724-21.968337 10.380418-1.974981-12.604062-8.864902-22.789029-24.152073-16.647145-22.857591 9.17701-22.583344 48.02069-21.716604 67.3929 0.652869 14.504342 5.808286 45.686529 25.759687 29.064966 10.776438-8.977465 11.877515-33.568537 14.491039-45.938262C831.585689 483.510132 831.766814 482.812237 831.934636 482.111273" /> | |||
<PathGeometry x:Key="SelectedIcon" Figures="M512 0C229.231 0 0 229.231 0 512 0 794.771 229.231 1024 512 1024 794.771 1024 1024 794.771 1024 512 1024 229.231 794.769 0 512 0ZM805.671 379.193 474.533 710.332C474.533 710.332 474.529 710.336 474.524 710.342 459.258 725.612 435.98 727.996 418.209 717.5 414.918 715.555 411.815 713.166 408.989 710.342 408.987 710.338 408.983 710.336 408.983 710.336L218.331 519.684C200.235 501.587 200.235 472.244 218.331 454.144 236.427 436.048 265.771 436.048 283.867 454.144L441.759 612.036 740.136 313.659C758.235 295.563 787.578 295.563 805.675 313.659 823.766 331.755 823.766 361.097 805.671 379.193Z" /> | |||
<Storyboard x:Key="CollapseStoryboard"> | |||
<DoubleAnimation Duration="0:0:0.3" From="70" Storyboard.TargetProperty="Height" To="0" /> | |||
</Storyboard> | |||
<DataTemplate x:Key="NotifiactionTemplate"> | |||
<Grid x:Name="NoticeGrid" Margin="5" Tag="{Binding Path=Id}" | |||
RenderTransformOrigin="1,0.5" SizeChanged="NoticeGrid_SizeChanged"> | |||
<Grid.RenderTransform> | |||
<TransformGroup> | |||
<ScaleTransform /> | |||
<RotateTransform /> | |||
<SkewTransform /> | |||
<TranslateTransform /> | |||
</TransformGroup> | |||
</Grid.RenderTransform> | |||
<Border x:Name="border" Margin="5,0,0,0" BorderBrush="#419aff" CornerRadius="2" Padding="5" BorderThickness="1" VerticalAlignment="Center" HorizontalAlignment="Center"> | |||
<Border.Background> | |||
<ImageBrush Stretch="Fill" ImageSource="../Images/背景2.png" /> | |||
</Border.Background> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="auto" /> | |||
<RowDefinition Height="*" /> | |||
</Grid.RowDefinitions> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto" /> | |||
<ColumnDefinition Width="*" /> | |||
</Grid.ColumnDefinitions> | |||
<Image x:Name="Icon" Grid.RowSpan="2" MaxWidth="26" Margin="10,0,10,0" VerticalAlignment="Center" Stretch="Uniform" ></Image> | |||
<Grid Grid.Row="0" Grid.Column="1"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="auto" /> | |||
<ColumnDefinition Width="*" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock x:Name="title" Grid.Column="0" VerticalAlignment="Center" FontSize="14" | |||
Text="{Binding Title}" FontWeight="Bold"> | |||
<TextBlock.Foreground> | |||
<SolidColorBrush Color="{Binding Path=color}" Opacity="1"/> | |||
</TextBlock.Foreground> | |||
</TextBlock> | |||
<TextBlock x:Name="count" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="14" | |||
Text="{Binding count, StringFormat='1/{0}'}" FontWeight="Bold"> | |||
<TextBlock.Foreground> | |||
<SolidColorBrush Color="{Binding Path=color}" Opacity="1"/> | |||
</TextBlock.Foreground> | |||
</TextBlock> | |||
</Grid> | |||
<TextBlock x:Name="text" Grid.Row="1" Grid.Column="1" Margin="0,8,30,0" | |||
Text="{Binding Content}" | |||
TextWrapping="Wrap" Background="Transparent"> | |||
<TextBlock.Foreground> | |||
<SolidColorBrush Color="#f4f4f5" Opacity="1"/> | |||
</TextBlock.Foreground> | |||
</TextBlock> | |||
<Image x:Name="PART_CloseButton" Grid.ColumnSpan="2" ToolTip="关闭窗口" Margin="0,0,5,0" Source="../Images/btn_close.png" HorizontalAlignment="Right" Width="12" Height="12" VerticalAlignment="Center" MouseLeftButtonDown="PART_CloseButton_MouseLeftButtonDown" Cursor="Hand"></Image> | |||
</Grid> | |||
</Border> | |||
</Grid> | |||
<DataTemplate.Triggers> | |||
<DataTrigger Binding="{Binding NotifiactionType}" Value="Info"> | |||
<Setter TargetName="Icon" Property="Source" Value="../Images/消息.png"/> | |||
</DataTrigger> | |||
<DataTrigger Binding="{Binding NotifiactionType}" Value="Warn"> | |||
<Setter TargetName="Icon" Property="Source" Value="../Images/告警.png"/> | |||
</DataTrigger> | |||
<DataTrigger Binding="{Binding NotifiactionType}" Value="Error"> | |||
<Setter TargetName="Icon" Property="Source" Value="../Images/报错.png"/> | |||
</DataTrigger> | |||
<DataTrigger Binding="{Binding NotifiactionType}" Value="Success"> | |||
<Setter TargetName="Icon" Property="Source" Value="../Images/正常.png"/> | |||
</DataTrigger> | |||
<EventTrigger RoutedEvent="Grid.Loaded" SourceName="NoticeGrid"> | |||
<BeginStoryboard x:Name="FadeInStoryBoard"> | |||
<Storyboard> | |||
<DoubleAnimation Duration="0:0:0.2" From="0.01" Storyboard.TargetName="NoticeGrid" | |||
Storyboard.TargetProperty="Opacity" | |||
To="1" /> | |||
<DoubleAnimation From="50" To="0" Duration="0:0:0.4" Storyboard.TargetName="NoticeGrid" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)"> | |||
<DoubleAnimation.EasingFunction> | |||
<CubicEase EasingMode="EaseOut"/> | |||
</DoubleAnimation.EasingFunction> | |||
</DoubleAnimation> | |||
<DoubleAnimation BeginTime="0:0:10" Duration="0:0:0.2" From="1" | |||
Storyboard.TargetName="NoticeGrid" | |||
Storyboard.TargetProperty="Opacity" To="0" /> | |||
</Storyboard> | |||
</BeginStoryboard> | |||
</EventTrigger> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Trigger.EnterActions> | |||
<SeekStoryboard BeginStoryboardName="FadeInStoryBoard" Offset="0:0:3" /> | |||
<PauseStoryboard BeginStoryboardName="FadeInStoryBoard" /> | |||
</Trigger.EnterActions> | |||
<Trigger.ExitActions> | |||
<SeekStoryboard BeginStoryboardName="FadeInStoryBoard" Offset="0:0:3" /> | |||
<ResumeStoryboard BeginStoryboardName="FadeInStoryBoard" /> | |||
</Trigger.ExitActions> | |||
</Trigger> | |||
<EventTrigger RoutedEvent="Button.Click" SourceName="PART_CloseButton"> | |||
<BeginStoryboard> | |||
<Storyboard> | |||
<DoubleAnimation Duration="0:0:0" From="1" Storyboard.TargetName="NoticeGrid" | |||
Storyboard.TargetProperty="(Grid.Opacity)" | |||
To="0" /> | |||
</Storyboard> | |||
</BeginStoryboard> | |||
</EventTrigger> | |||
<Trigger SourceName="NoticeGrid" Property="Opacity" Value="0"> | |||
<Setter TargetName="NoticeGrid" Property="Visibility" Value="Hidden" /> | |||
<Trigger.EnterActions> | |||
<BeginStoryboard Storyboard="{StaticResource CollapseStoryboard}" /> | |||
</Trigger.EnterActions> | |||
</Trigger> | |||
</DataTemplate.Triggers> | |||
</DataTemplate> | |||
</Window.Resources> | |||
<ItemsControl x:Name="NotificationsControl" | |||
FocusVisualStyle="{x:Null}" | |||
ItemTemplate="{StaticResource NotifiactionTemplate}" | |||
ItemsSource="{Binding .}" /> | |||
</Window> |
@@ -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 | |||
{ | |||
/// <summary> | |||
/// Notifiaction.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class Notifiaction : Window | |||
{ | |||
private const byte MAX_NOTIFICATIONS = 10; | |||
private readonly ObservableCollection<NotifiactionModel> buffer = new ObservableCollection<NotifiactionModel>(); | |||
private ObservableCollection<NotifiactionModel> NotifiactionList = new ObservableCollection<NotifiactionModel>(); | |||
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 显示控制 | |||
/// <summary> | |||
/// 线程消失函数 | |||
/// </summary> | |||
/// <param name="sender"></param> | |||
/// <param name="e"></param> | |||
private void _timer_Tick(object sender, EventArgs e) | |||
{ | |||
NotifiactionList.ToList().ForEach(par => | |||
{ | |||
if (par.time > 0) | |||
par.time = par.time - 1; | |||
}); | |||
List<NotifiactionModel> Notifia = NotifiactionList.ToList().FindAll(x => x.time <= 0); | |||
foreach (var item in Notifia) | |||
{ | |||
RemoveNotification(item); | |||
} | |||
} | |||
/// <summary> | |||
/// 清除窗体显示函数 | |||
/// </summary> | |||
/// <param name="type"></param> | |||
public void Clear(EnumPromptType type) | |||
{ | |||
List<NotifiactionModel> buff = buffer.ToList().FindAll(x => x.NotifiactionType == type); | |||
foreach (var item in buff) | |||
{ | |||
buffer.Remove(item); | |||
} | |||
List<NotifiactionModel> Notifia = NotifiactionList.ToList().FindAll(x => x.NotifiactionType == type); | |||
foreach (var item in Notifia) | |||
{ | |||
NotifiactionList.Remove(item); | |||
} | |||
} | |||
/// <summary> | |||
/// 增加一个消息弹框 | |||
/// </summary> | |||
/// <param name="notification"></param> | |||
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) | |||
{ | |||
} | |||
} | |||
/// <summary> | |||
/// 将显示窗体移除 | |||
/// </summary> | |||
/// <param name="notification"></param> | |||
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 窗体事件 | |||
/// <summary> | |||
/// 关闭窗口 | |||
/// </summary> | |||
/// <param name="sender"></param> | |||
/// <param name="e"></param> | |||
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; | |||
/// <summary> | |||
/// Id不需要赋值 | |||
/// </summary> | |||
public string Id { get; set; } | |||
/// <summary> | |||
/// 通知标题 | |||
/// </summary> | |||
public string Title { get; set; } | |||
/// <summary> | |||
/// 通知内容 | |||
/// </summary> | |||
public string Content | |||
{ | |||
get { return _content; } | |||
set | |||
{ | |||
_content = value; | |||
if (this.PropertyChanged != null) | |||
{ | |||
this.PropertyChanged(this, new PropertyChangedEventArgs("Content")); | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 通知内容-显示全体 | |||
/// </summary> | |||
public string ContentToolTip { get; set; } | |||
/// <summary> | |||
/// 通知类型 | |||
/// </summary> | |||
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")); | |||
} | |||
} | |||
/// <summary> | |||
/// 背景颜色主题 | |||
/// </summary> | |||
public Color color { get; set; } | |||
/// <summary> | |||
/// 文本颜色 | |||
/// </summary> | |||
public Color textColor { get; set; } | |||
/// <summary> | |||
/// 外部windows | |||
/// </summary> | |||
public System.Windows.Window window { get; set; } | |||
/// <summary> | |||
/// 弹窗显示时长 | |||
/// </summary> | |||
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显示数量 | |||
/// <summary> | |||
/// 设置默认之 | |||
/// </summary> | |||
public NotifiactionModel() | |||
{ | |||
Id = Guid.NewGuid().ToString(); | |||
time = 5; | |||
count = 1; | |||
} | |||
public event PropertyChangedEventHandler PropertyChanged; | |||
} | |||
} |
@@ -21,7 +21,7 @@ namespace BeDesignerSCADA.Common | |||
"StatusValue", "NumberValue", "Text", | |||
"Direction","RefreshData", | |||
"ChangedText","Content","SendText","LeftTogIsChecked","RightTogIsChecked", | |||
"Visibility" | |||
"Visibility","Message","ReturnValue" | |||
}; | |||
public static List<ControlName> GetCustomerControlProperty(List<FrameworkElement> selectItems) | |||
{ | |||
@@ -15,7 +15,6 @@ | |||
<UserControl.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<!--<ResourceDictionary Source="/BeDesignerSCADA;component/Themes/Styles.xaml" />--> | |||
<ResourceDictionary Source="/可视化配置工具;component/Themes/Styles.xaml"></ResourceDictionary> | |||
<ResourceDictionary Source="/BPASmartClient.SCADAControl;component/Themes/Generic.xaml" /> | |||
</ResourceDictionary.MergedDictionaries> | |||
@@ -41,6 +40,7 @@ | |||
Background="Transparent" | |||
ScrollViewer.VerticalScrollBarVisibility="Auto" | |||
ItemTemplate="{DynamicResource PageBoxStyle}" | |||
SelectionChanged="PageList_SelectionChanged" | |||
FontSize="14" BorderThickness="0" > | |||
<ListBox.ContextMenu> | |||
<ContextMenu> | |||
@@ -220,6 +220,7 @@ | |||
<TextBlock Text="同步" Margin="4 0" VerticalAlignment="Center"/> | |||
</StackPanel> | |||
</Button> | |||
<TextBlock HorizontalAlignment="Center" Margin="4 0 0 0" MaxWidth="200" TextWrapping="Wrap" Height="25" FontSize="10" VerticalAlignment="Bottom" Foreground="Red">温馨提示:布局完成点击“同步”按钮,保存布局到菜单页面,菜单页面“右键”可导出整体布局!</TextBlock> | |||
<ToggleButton x:Name="showCode" Click="showCode_Click" DockPanel.Dock="Right" Margin="4 0 0 0" Padding="4 0"> | |||
@@ -325,6 +326,7 @@ | |||
<mypro:PropertyDefinition DisplayName="运行状态" Category="基本属性" DisplayOrder="2" Name="Direction" Description="Direction"/> | |||
<mypro:PropertyDefinition DisplayName="Tag" Category="基本属性" DisplayOrder="2" Name="Tag" Description="Tag"/> | |||
<mypro:PropertyDefinition DisplayName="启动路径" Category="基本属性" DisplayOrder="2" Name="StartPath" Description="StartPath"/> | |||
<mypro:PropertyDefinition DisplayName="消息类型" Category="基本属性" DisplayOrder="2" Name="MessageLX" Description="MessageLX"/> | |||
<mypro:PropertyDefinition DisplayName="最大值" Category="基本属性" DisplayOrder="3" Name="MaxValue" Description="MaxValue"/> | |||
<mypro:PropertyDefinition DisplayName="最小值" Category="基本属性" DisplayOrder="3" Name="MinValue" Description="MinValue"/> | |||
@@ -414,7 +416,6 @@ | |||
<mypro:EditorTemplateDefinition.EditingTemplate> | |||
<DataTemplate> | |||
<Slider Maximum="1" Minimum="0" Value="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" ></Slider> | |||
<!--<mypro: SelectedColor="{Binding Value,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged, Converter={x:Static s:ColorToStringConverter.Instance}}" />--> | |||
</DataTemplate> | |||
</mypro:EditorTemplateDefinition.EditingTemplate> | |||
</mypro:EditorTemplateDefinition> | |||
@@ -457,7 +458,6 @@ | |||
</mypro:EditorTemplateDefinition.EditingTemplate> | |||
</mypro:EditorTemplateDefinition> | |||
<!--子控件模板编辑--> | |||
<mypro:EditorTemplateDefinition TargetProperties="ChildTemplateXml"> | |||
<mypro:EditorTemplateDefinition.EditingTemplate> | |||
@@ -470,7 +470,6 @@ | |||
</mypro:EditorTemplateDefinition.EditingTemplate> | |||
</mypro:EditorTemplateDefinition> | |||
<!--代码绑定模块--> | |||
<mypro:EditorTemplateDefinition TargetProperties="ClickStr,ClickExec,ValueChangedExecute,TikcExecute,CheckedExec,UnCheckedExec,ChuLiaoExecute,StopChuLiaoExecute" > | |||
<mypro:EditorTemplateDefinition.EditingTemplate> | |||
@@ -518,6 +517,7 @@ | |||
</DataTemplate> | |||
</mypro:EditorTemplateDefinition.EditingTemplate> | |||
</mypro:EditorTemplateDefinition> | |||
<mypro:EditorTemplateDefinition TargetProperties="Text,Title,Value,BindingIsChecked,Header,KgValue,WLText,WLTitle,DataSouceInformation,Direction,LeftTogIsChecked,RightTogIsChecked" > | |||
<mypro:EditorTemplateDefinition.EditingTemplate> | |||
<DataTemplate> | |||
@@ -37,7 +37,14 @@ namespace BeDesignerSCADA.Controls | |||
/// </summary> | |||
public partial class CanvasPanelNew : System.Windows.Controls.UserControl | |||
{ | |||
/// <summary> | |||
/// 界面Model | |||
/// </summary> | |||
public MainViewModelNew viewModel = new MainViewModelNew(); | |||
/// <summary> | |||
/// 文件夹监视 | |||
/// </summary> | |||
public FileSystemWatcher _watcher; | |||
public CanvasPanelNew(string _Path) | |||
{ | |||
InitializeComponent(); | |||
@@ -59,7 +66,13 @@ namespace BeDesignerSCADA.Controls | |||
CtlList.ItemsSource = typesView; | |||
//读取文件 | |||
CreateDir(); | |||
FileRead(_Path); | |||
cav.SelectedItemAction += new Action<FrameworkElement>(o => { | |||
if (ReditSeleceTab.SelectedIndex!=1) | |||
ReditSeleceTab.SelectedIndex = 1; | |||
}); | |||
} | |||
#region 位置调整 | |||
@@ -128,6 +141,130 @@ namespace BeDesignerSCADA.Controls | |||
} | |||
#endregion | |||
#region 变量管理器文件夹监听事件 | |||
/// <summary> | |||
/// 创建文件夹,监视文件夹 | |||
/// </summary> | |||
public void CreateDir() | |||
{ | |||
try | |||
{ | |||
//不存在则创建布局文件夹 | |||
if (!Directory.Exists($"{System.AppDomain.CurrentDomain.BaseDirectory}Layouts")) | |||
{ | |||
Directory.CreateDirectory($"{System.AppDomain.CurrentDomain.BaseDirectory}Layouts"); | |||
} | |||
//不存在则创建变量管理器路径 AccessFile | |||
if (!Directory.Exists($"{System.AppDomain.CurrentDomain.BaseDirectory}AccessFile")) | |||
{ | |||
Directory.CreateDirectory($"{System.AppDomain.CurrentDomain.BaseDirectory}AccessFile"); | |||
} | |||
if (!Directory.Exists($"{System.AppDomain.CurrentDomain.BaseDirectory}AccessFile/JSON")) | |||
{ | |||
Directory.CreateDirectory($"{System.AppDomain.CurrentDomain.BaseDirectory}AccessFile/JSON"); | |||
} | |||
try | |||
{ | |||
this._watcher = new FileSystemWatcher(); | |||
_watcher.Path = $"{System.AppDomain.CurrentDomain.BaseDirectory}AccessFile/JSON"; | |||
_watcher.NotifyFilter = NotifyFilters.FileName | NotifyFilters.Size | NotifyFilters.DirectoryName; | |||
_watcher.IncludeSubdirectories = true; | |||
_watcher.Created += new FileSystemEventHandler(FileWatcher_Created); | |||
_watcher.Changed += new FileSystemEventHandler(FileWatcher_Changed); | |||
_watcher.Deleted += new FileSystemEventHandler(FileWatcher_Deleted); | |||
_watcher.Renamed += new RenamedEventHandler(FileWatcher_Renamed); | |||
Start(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
Console.WriteLine("Error:" + ex.Message); | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
} | |||
} | |||
/// <summary> | |||
/// 监视启动 | |||
/// </summary> | |||
public void Start() | |||
{ | |||
this._watcher.EnableRaisingEvents = true; | |||
Console.WriteLine("文件监控已经启动..."); | |||
ReadFileVlaue(); | |||
} | |||
/// <summary> | |||
/// 监视停止 | |||
/// </summary> | |||
public void Stop() | |||
{ | |||
this._watcher.EnableRaisingEvents = false; | |||
this._watcher.Dispose(); | |||
this._watcher = null; | |||
} | |||
/// <summary> | |||
/// 文件夹新增 | |||
/// </summary> | |||
/// <param name="sender"></param> | |||
/// <param name="e"></param> | |||
protected void FileWatcher_Created(object sender, FileSystemEventArgs e) | |||
{ | |||
Console.WriteLine("新增:" + e.ChangeType + ";" + e.FullPath + ";" + e.Name); | |||
ReadFileVlaue(); | |||
} | |||
/// <summary> | |||
/// 文件名变更-文件大小变化 | |||
/// </summary> | |||
/// <param name="sender"></param> | |||
/// <param name="e"></param> | |||
protected void FileWatcher_Changed(object sender, FileSystemEventArgs e) | |||
{ | |||
Console.WriteLine("变更:" + e.ChangeType + ";" + e.FullPath + ";" + e.Name); | |||
ReadFileVlaue(); | |||
} | |||
/// <summary> | |||
/// 删除 | |||
/// </summary> | |||
/// <param name="sender"></param> | |||
/// <param name="e"></param> | |||
protected void FileWatcher_Deleted(object sender, FileSystemEventArgs e) | |||
{ | |||
Console.WriteLine("删除:" + e.ChangeType + ";" + e.FullPath + ";" + e.Name); | |||
ReadFileVlaue(); | |||
} | |||
/// <summary> | |||
/// 文件名 | |||
/// </summary> | |||
/// <param name="sender"></param> | |||
/// <param name="e"></param> | |||
protected void FileWatcher_Renamed(object sender, RenamedEventArgs e) | |||
{ | |||
Console.WriteLine("重命名: OldPath:{0} NewPath:{1} OldFileName{2} NewFileName:{3}", e.OldFullPath, e.FullPath, e.OldName, e.Name); | |||
ReadFileVlaue(); | |||
} | |||
/// <summary> | |||
/// 读取文件变量 | |||
/// </summary> | |||
public void ReadFileVlaue() | |||
{ | |||
try | |||
{ | |||
Directory.CreateDirectory(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "AccessFile\\JSON")); | |||
viewModel.VariablePath = AppDomain.CurrentDomain.BaseDirectory + "AccessFile\\JSON\\CommunicationPar.json"; | |||
DataBusModel.GetInstance().RefreshVariableManager(viewModel.VariablePath); | |||
} | |||
catch (Exception ex) | |||
{ | |||
} | |||
} | |||
#endregion | |||
#region 外部调用事件 | |||
/// <summary> | |||
/// 传入变量管理器地址 | |||
@@ -350,6 +487,15 @@ namespace BeDesignerSCADA.Controls | |||
} | |||
} | |||
/// <summary> | |||
/// 页选中改变事件 | |||
/// </summary> | |||
/// <param name="sender"></param> | |||
/// <param name="e"></param> | |||
private void PageList_SelectionChanged(object sender, SelectionChangedEventArgs e) | |||
{ | |||
ReditSeleceTab.SelectedIndex = 0; | |||
} | |||
#endregion | |||
#region 左侧控件栏移动 | |||
@@ -522,5 +668,7 @@ namespace BeDesignerSCADA.Controls | |||
} | |||
} | |||
#endregion | |||
} | |||
} |
@@ -511,8 +511,5 @@ namespace BeDesignerSCADA.Controls | |||
} | |||
} | |||
#endregion | |||
} | |||
} |
@@ -201,12 +201,21 @@ namespace BeDesignerSCADA.Controls | |||
//拉出按钮 | |||
lachu.HorizontalAlignment = HorizontalAlignment.Right; | |||
lachu.VerticalAlignment = VerticalAlignment.Stretch; | |||
lachu.BorderThickness = new Thickness(1, 0, 0, 0); | |||
lachu.BorderThickness = new Thickness(0, 0, 1, 0); | |||
//closeGrid | |||
closeGrid.HorizontalAlignment = HorizontalAlignment.Center; | |||
closeGrid.VerticalAlignment = VerticalAlignment.Bottom; | |||
closeGrid.Margin = new Thickness(10); | |||
ButClose.Margin = new Thickness(0, 5, 0, 0); | |||
FrameworkElement border = null; | |||
foreach (FrameworkElement item in waibustack.Children) | |||
{ | |||
if (item is Border) | |||
border = item; | |||
} | |||
waibustack.Children.Remove(border); | |||
waibustack.Children.Insert(0,border); | |||
break; | |||
case MenuAlignment.底部: | |||
//左边菜单栏 | |||
@@ -236,16 +245,26 @@ namespace BeDesignerSCADA.Controls | |||
//外部Stackpanl | |||
waibustack.Orientation = Orientation.Vertical; | |||
waibustack.VerticalAlignment = VerticalAlignment.Bottom; | |||
waibustack.Margin = new Thickness(0, 0, 0, 25); | |||
//拉出按钮 | |||
lachu.HorizontalAlignment = HorizontalAlignment.Stretch; | |||
lachu.VerticalAlignment = VerticalAlignment.Bottom; | |||
lachu.LayoutTransform = new RotateTransform() { Angle = 270 }; | |||
lachu.BorderThickness = new Thickness(0, 0, 1, 0); | |||
lachu.BorderThickness = new Thickness(1, 0, 0, 0); | |||
lachu.Margin = new Thickness(0, 0, 0, 0); | |||
//closeGrid | |||
closeGrid.HorizontalAlignment = HorizontalAlignment.Right; | |||
closeGrid.VerticalAlignment = VerticalAlignment.Center; | |||
closeGrid.Margin = new Thickness(10, 0, 10, 0); | |||
ButClose.Margin = new Thickness(0, 5, 0, 0); | |||
border = null; | |||
foreach (FrameworkElement item in waibustack.Children) | |||
{ | |||
if (item is Border) | |||
border = item; | |||
} | |||
waibustack.Children.Remove(border); | |||
waibustack.Children.Insert(0, border); | |||
break; | |||
default: | |||
break; | |||
@@ -10,8 +10,8 @@ | |||
xmlns:ctl="clr-namespace:BeDesignerSCADA.Controls" | |||
xmlns:mypro="http://schemas.xceed.com/wpf/xaml/toolkit" | |||
mc:Ignorable="d" | |||
WindowStartupLocation="CenterScreen" | |||
Title="黑菠萝科技-[组态软件1.0]" Height="900" Width="1400" Icon="/Images/ico.ico" > | |||
WindowStartupLocation="CenterScreen" Height="900" Width="1400" | |||
Title="黑菠萝科技-[组态软件1.0]" Icon="/Images/ico.ico" > | |||
<Border x:Name="grid"> | |||
</Border> | |||
</Window> |
@@ -375,7 +375,10 @@ | |||
<Setter TargetName="icon" Property="Kind" Value="ViewHeadline" /> | |||
<Setter TargetName="txt" Property="Text" Value="列表控件" /> | |||
</DataTrigger> | |||
<DataTrigger Binding="{Binding Name}" Value="FYFTheListBox"> | |||
<Setter TargetName="icon" Property="Kind" Value="ViewHeadline" /> | |||
<Setter TargetName="txt" Property="Text" Value="列表控件-拖拽" /> | |||
</DataTrigger> | |||
<DataTrigger Binding="{Binding Name}" Value="TheRedis"> | |||
<Setter TargetName="icon" Property="Kind" Value="AlphaDBoxOutline" /> | |||
<Setter TargetName="txt" Property="Text" Value="Redis控件" /> | |||
@@ -430,16 +433,26 @@ | |||
<Setter TargetName="icon" Property="Kind" Value="AlphaGCircleOutline" /> | |||
<Setter TargetName="txt" Property="Text" Value="矩形" /> | |||
</DataTrigger> | |||
<DataTrigger Binding="{Binding Name}" Value="TheEllipse"> | |||
<Setter TargetName="icon" Property="Kind" Value="AlphaGCircleOutline" /> | |||
<Setter TargetName="txt" Property="Text" Value="圆形" /> | |||
</DataTrigger> | |||
<DataTrigger Binding="{Binding Name}" Value="TheWuLiaoControl"> | |||
<Setter TargetName="icon" Property="Kind" Value="AlphaGCircleOutline" /> | |||
<Setter TargetName="txt" Property="Text" Value="物料集合控件" /> | |||
</DataTrigger> | |||
<DataTrigger Binding="{Binding Name}" Value="ThePopMessage"> | |||
<Setter TargetName="icon" Property="Kind" Value="Message" /> | |||
<Setter TargetName="txt" Property="Text" Value="消息弹窗" /> | |||
</DataTrigger> | |||
<DataTrigger Binding="{Binding Name}" Value="TheMessage"> | |||
<Setter TargetName="icon" Property="Kind" Value="Message" /> | |||
<Setter TargetName="txt" Property="Text" Value="消息提示" /> | |||
</DataTrigger> | |||
</DataTemplate.Triggers> | |||
</DataTemplate> | |||
@@ -13,6 +13,14 @@ namespace BeDesignerSCADA.ViewModel | |||
public class DataBusModel | |||
{ | |||
#region 单例模式 | |||
private static string path | |||
{ | |||
get | |||
{ | |||
Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "AccessFile\\JSON")); | |||
return AppDomain.CurrentDomain.BaseDirectory + "AccessFile\\JSON\\CommunicationPar.json"; | |||
} | |||
} | |||
public static DataBusModel dataBus = null; | |||
public static DataBusModel GetInstance() | |||
@@ -75,5 +83,35 @@ namespace BeDesignerSCADA.ViewModel | |||
return IsSucess; | |||
} | |||
/// <summary> | |||
/// 读取文件 | |||
/// </summary> | |||
/// <returns></returns> | |||
public bool ReadFile() | |||
{ | |||
bool IsSucess = false; | |||
try | |||
{ | |||
if (File.Exists(path)) | |||
{ | |||
CommunicationPar val = JsonConvert.DeserializeObject<CommunicationPar>(File.ReadAllText(path)); | |||
if (val != null) | |||
{ | |||
if (KeyValues == null) | |||
{ | |||
KeyValues = new ConcurrentDictionary<string, CommunicationPar>(); | |||
} | |||
KeyValues[path] = val; | |||
IsSucess = true; | |||
} | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
} | |||
return IsSucess ; | |||
} | |||
} | |||
} |
@@ -160,7 +160,7 @@ namespace BeDesignerSCADA.ViewModel | |||
/// </summary> | |||
public Dictionary<string, string> ControlsNameValues = new Dictionary<string, string>() { | |||
{"GestureTapButton","按钮" }, | |||
{"TheButton","按钮" }, | |||
{"TheTimer","计时器" }, | |||
{"TheCheckBox","勾选框" }, | |||
{"DigitalNumber","液晶数字" }, | |||
@@ -196,6 +196,9 @@ namespace BeDesignerSCADA.ViewModel | |||
{"TheRectangle","矩形" }, | |||
{"TheEllipse","圆形" }, | |||
{"TheWuLiaoControl","物料集合控件" }, | |||
{"FYFTheListBox","列表控件-拖拽" }, | |||
{"ThePopMessage","消息弹窗" }, | |||
{"TheMessage","消息提示" }, | |||
}; | |||
#endregion | |||
@@ -620,7 +623,7 @@ namespace BeDesignerSCADA.ViewModel | |||
} | |||
} | |||
/// <summary> | |||
/// 导出页面文件 | |||
/// 保存页面文件 | |||
/// </summary> | |||
public void SaveAllPageHeader() | |||
{ | |||
@@ -6,14 +6,11 @@ | |||
xmlns:local="clr-namespace:WPFDemo" | |||
mc:Ignorable="d" | |||
Title="Window2" Height="450" Width="800"> | |||
<Grid> | |||
<Grid.Background> | |||
<Canvas> | |||
<Canvas.Background> | |||
<ImageBrush ImageSource="/bj.png"/> | |||
</Grid.Background> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="50"/> | |||
<RowDefinition Height="*"/> | |||
</Grid.RowDefinitions> | |||
<local:TheListBox HorizontalAlignment="Right" Grid.Row="1"></local:TheListBox> | |||
</Grid> | |||
</Canvas.Background> | |||
<local:TheListBox Canvas.Left="180" Canvas.Top="100" HorizontalAlignment="Right" Grid.Row="1"></local:TheListBox> | |||
</Canvas> | |||
</Window> |