@@ -236,6 +236,12 @@ | |||
<ItemGroup> | |||
<PackageReference Include="BPA.Message" Version="1.0.45" /> | |||
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.1.2" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPASmartClient.Helper\BPASmartClient.Helper.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.Model\BPASmartClient.Model.csproj" /> | |||
</ItemGroup> | |||
<ItemGroup> | |||
@@ -0,0 +1,34 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.CustomResource.Pages.Model | |||
{ | |||
[AttributeUsage(AttributeTargets.Property)] | |||
public class AlarmAttribute : Attribute | |||
{ | |||
public AlarmAttribute(string Info, AlarmTriggerType alarmTriggerType = AlarmTriggerType.Rising, AlarmLevel alarmLevel = AlarmLevel.一般报警) | |||
{ | |||
AlarmInfo = Info; | |||
AlarmType = alarmTriggerType; | |||
@AlarmLevel = alarmLevel; | |||
} | |||
/// <summary> | |||
/// 报警信息 | |||
/// </summary> | |||
public string AlarmInfo { get; set; } | |||
/// <summary> | |||
/// 告警类型 | |||
/// </summary> | |||
public AlarmTriggerType AlarmType { get; set; } | |||
/// <summary> | |||
/// 告警级别 | |||
/// </summary> | |||
public AlarmLevel @AlarmLevel { get; set; } | |||
} | |||
} |
@@ -0,0 +1,126 @@ | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.Message; | |||
using BPASmartClient.Model; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Reflection; | |||
using System.Text; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
using System.Collections.ObjectModel; | |||
using System.Windows; | |||
namespace BPASmartClient.CustomResource.Pages.Model | |||
{ | |||
public class AlarmHelper<AlarmT> where AlarmT : class, new() | |||
{ | |||
public static ObservableCollection<Alarm> Alarms { get; set; } = new ObservableCollection<Alarm>(); | |||
public static List<Alarm> HistoryAlarms { get; set; } = new List<Alarm>(); | |||
static ConcurrentDictionary<string, bool> flagbit = new ConcurrentDictionary<string, bool>(); | |||
static ConcurrentDictionary<string, Delay> delays = new ConcurrentDictionary<string, Delay>(); | |||
public static Action<string> AddAction { get; set; } | |||
public static Action<string> RemoveAction { get; set; } | |||
public static Action ChangeAction { get; set; } | |||
public static AlarmT Alarm { get; set; } = new AlarmT(); | |||
public static void Init() | |||
{ | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
foreach (var item in Alarm.GetType().GetProperties()) | |||
{ | |||
if (item.CustomAttributes.Count() > 0) | |||
{ | |||
var AlarmModel = item.GetCustomAttribute<AlarmAttribute>(); | |||
if (AlarmModel != null) | |||
{ | |||
bool value = Convert.ToBoolean(Alarm.GetType().GetProperty(item.Name)?.GetValue(Alarm)); | |||
EdgeAlarm(value, AlarmModel.AlarmInfo, 1, AlarmModel.AlarmLevel, AlarmModel.AlarmType); | |||
} | |||
} | |||
} | |||
Thread.Sleep(100); | |||
}), "报警通用模块监听"); | |||
} | |||
/// <summary> | |||
/// 沿报警检测 | |||
/// </summary> | |||
/// <param name="Trigger">触发变量</param> | |||
/// <param name="text">报警信息</param> | |||
/// <param name="edgeType">触发类型,上升沿 或 下降沿</param> | |||
private static void EdgeAlarm(bool Trigger, string text, int delay = 2, AlarmLevel alarmLevel = AlarmLevel.一般报警, AlarmTriggerType edgeType = AlarmTriggerType.Rising) | |||
{ | |||
if (!flagbit.ContainsKey(text)) flagbit.TryAdd(text, false); | |||
if (!delays.ContainsKey(text)) delays.TryAdd(text, Delay.GetInstance(text)); | |||
if (edgeType == AlarmTriggerType.Rising ? delays[text].Start(Trigger, delay) : delays[text].Start(!Trigger, delay)) | |||
{ | |||
if (edgeType == AlarmTriggerType.Rising ? !flagbit[text] : flagbit[text]) | |||
{ | |||
AddAlarm(Trigger, text, alarmLevel); | |||
flagbit[text] = edgeType == AlarmTriggerType.Rising ? true : false; | |||
} | |||
} | |||
else RemoveAlarm(text); | |||
if (edgeType == AlarmTriggerType.Rising ? flagbit[text] : !flagbit[text]) flagbit[text] = Trigger; | |||
} | |||
/// <summary> | |||
/// 添加报警信息 | |||
/// </summary> | |||
/// <param name="AlarmInfo">报警信息</param> | |||
private static void AddAlarm(object value, string AlarmInfo, AlarmLevel alarmLevel) | |||
{ | |||
Alarm tempAlarm = new Alarm() | |||
{ | |||
NumId = Alarms.Count + 1, | |||
Date = DateTime.Now.ToString("yyyy/MM/dd"), | |||
Grade = alarmLevel.ToString(), | |||
Info = AlarmInfo, | |||
Value = value.ToString(), | |||
Time = DateTime.Now.ToString("HH:mm:ss"), | |||
}; | |||
var res = Sqlite<Alarm>.GetInstance.Base.Add(tempAlarm); | |||
Sqlite<Alarm>.GetInstance.Save(); | |||
if (Alarms.FirstOrDefault(p => p.Info == AlarmInfo) == null) | |||
{ | |||
Application.Current.Dispatcher.Invoke(new Action(() => | |||
{ | |||
Alarms.Insert(0, tempAlarm); | |||
for (int i = 0; i < Alarms.Count; i++) { Alarms.ElementAt(i).NumId = i + 1; } | |||
})); | |||
AddAction?.Invoke(AlarmInfo);//添加报警通知 | |||
ChangeAction?.Invoke();//更改报警通知 | |||
MessageLog.GetInstance.AddDeviceAlarmLogShow(tempAlarm.Info, Guid.NewGuid().ToString()); | |||
} | |||
} | |||
/// <summary> | |||
/// 移除报警信息 | |||
/// </summary> | |||
/// <param name="AlarmInfo">报警信息</param> | |||
private static void RemoveAlarm(string AlarmInfo) | |||
{ | |||
var result = Alarms.FirstOrDefault(p => p.Info == AlarmInfo); | |||
if (result != null) | |||
{ | |||
Application.Current.Dispatcher.Invoke(new Action(() => | |||
{ | |||
Alarms.Remove(result); | |||
for (int i = 0; i < Alarms.Count; i++) { Alarms.ElementAt(i).NumId = i + 1; } | |||
})); | |||
if (RemoveAction != null) RemoveAction(AlarmInfo); | |||
if (ChangeAction != null) ChangeAction(); | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,14 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.CustomResource.Pages.Model | |||
{ | |||
public enum AlarmLevel | |||
{ | |||
一般报警, | |||
严重报警 | |||
} | |||
} |
@@ -0,0 +1,20 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.CustomResource.Pages.Model | |||
{ | |||
public enum AlarmTriggerType | |||
{ | |||
/// <summary> | |||
/// 上升沿 | |||
/// </summary> | |||
Rising, | |||
/// <summary> | |||
/// 下降沿 | |||
/// </summary> | |||
Falling | |||
} | |||
} |
@@ -0,0 +1,379 @@ | |||
<UserControl | |||
x:Class="BPASmartClient.CustomResource.Pages.View.AlarmView" | |||
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:local="clr-namespace:BPASmartClient.CustomResource.Pages.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
<UserControl.DataContext> | |||
<vm:AlarmViewModel /> | |||
</UserControl.DataContext> | |||
<UserControl.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary> | |||
<!--<convert:TextDisplayConvert x:Key="textDisplayConvert" /> | |||
<convert:IsEnableConvert x:Key="isEnableConvert" /> | |||
<convert:AnalogAlarmConvert x:Key="analogAlarmConvert" /> | |||
<convert:DiscreteAlarmConvert x:Key="discreteAlarmConvert" /> | |||
<convert:AlarmTypeTextConvert x:Key="alarmTypeTextConvert" />--> | |||
<SolidColorBrush x:Key="BorderSolid" Color="#5523CACA" /> | |||
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" /> | |||
<SolidColorBrush x:Key="TitleFontColor" Color="#ddd" /> | |||
<SolidColorBrush x:Key="CursorColor" Color="Aqua" /> | |||
<SolidColorBrush x:Key="TitleBorderColor" Color="#FF2AB2E7" /> | |||
<Style x:Key="TextBlockStyle" TargetType="TextBlock"> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="FontSize" Value="18" /> | |||
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
<Setter Property="HorizontalAlignment" Value="Center" /> | |||
</Style> | |||
<Style x:Key="TextBoxStyle" TargetType="TextBox"> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="FontSize" Value="22" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" /> | |||
<Setter Property="BorderBrush" Value="#FF23CACA" /> | |||
<Setter Property="CaretBrush" Value="Aqua" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
</Style> | |||
<Style x:Key="DataTextBlockStyle" TargetType="TextBlock"> | |||
<Setter Property="HorizontalAlignment" Value="Center" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="Foreground" Value="Red" /> | |||
<Setter Property="FontSize" Value="14" /> | |||
</Style> | |||
<ControlTemplate x:Key="ButTemplate" TargetType="Button"> | |||
<Border | |||
x:Name="br" | |||
Background="Transparent" | |||
BorderBrush="#FF19B7EC" | |||
BorderThickness="2"> | |||
<StackPanel | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<ContentControl | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Content="{TemplateBinding Content}" | |||
Foreground="{TemplateBinding Foreground}" /> | |||
</StackPanel> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="br" Property="Background" Value="#2219B7EC" /> | |||
</Trigger> | |||
<Trigger Property="IsPressed" Value="true"> | |||
<Setter TargetName="br" Property="Background" Value="#2219B7EC" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</ResourceDictionary> | |||
</ResourceDictionary.MergedDictionaries> | |||
</ResourceDictionary> | |||
</UserControl.Resources> | |||
<Grid Margin="10"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="50" /> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<StackPanel | |||
Margin="0,8" | |||
HorizontalAlignment="Right" | |||
Orientation="Horizontal"> | |||
<DatePicker | |||
Background="Transparent" | |||
BorderBrush="#aa3aa7f3" | |||
BorderThickness="2" | |||
SelectedDate="{Binding StartDateTime}" | |||
Style="{StaticResource PickerStyle}" | |||
Text="请输入开始时间" | |||
Visibility="{Binding IsVisibility}" /> | |||
<DatePicker | |||
Margin="20,0,20,0" | |||
Background="Transparent" | |||
BorderBrush="#aa3aa7f3" | |||
BorderThickness="2" | |||
SelectedDate="{Binding EndDateTime}" | |||
Style="{StaticResource PickerStyle}" | |||
Text="请输入结束时间" | |||
Visibility="{Binding IsVisibility}" /> | |||
<Button | |||
Width="140" | |||
Height="30" | |||
Background="#FF19B7EC" | |||
Command="{Binding ControlCommand}" | |||
Content="{Binding ControlButText}" | |||
FontFamily="楷体" | |||
FontSize="18" | |||
Template="{StaticResource ButTemplate}"> | |||
<Button.Foreground> | |||
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> | |||
<GradientStop Color="#FFBB662A" /> | |||
<GradientStop Offset="1" Color="White" /> | |||
</LinearGradientBrush> | |||
</Button.Foreground> | |||
</Button> | |||
<Button | |||
Width="140" | |||
Height="30" | |||
Margin="20,0,0,0" | |||
Background="#FF19B7EC" | |||
Command="{Binding SwitchCommand}" | |||
Content="{Binding ButContent}" | |||
FontFamily="楷体" | |||
FontSize="18" | |||
Template="{StaticResource ButTemplate}"> | |||
<Button.Foreground> | |||
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> | |||
<GradientStop Color="#FFBB662A" /> | |||
<GradientStop Offset="1" Color="White" /> | |||
</LinearGradientBrush> | |||
</Button.Foreground> | |||
</Button> | |||
</StackPanel> | |||
<!--#region 表格标题栏设置--> | |||
<Grid Grid.Row="1" Background="#dd2AB2E7"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.3*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.5*" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="ID" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="报警日期" /> | |||
<Border | |||
BorderBrush="{StaticResource TitleBorderColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="报警时间" /> | |||
<Grid Grid.Column="3"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="报警信息" /> | |||
<Border | |||
BorderBrush="{StaticResource TitleBorderColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="4" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="报警值" /> | |||
<Grid Grid.Column="5"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="报警等级" /> | |||
<Border | |||
BorderBrush="{StaticResource TitleBorderColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
</Grid> | |||
<!--#endregion--> | |||
<!--#region 表格数据显示--> | |||
<ScrollViewer | |||
Grid.Row="2" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
<Grid> | |||
<!--#region 实时报警信息--> | |||
<ItemsControl ItemsSource="{Binding AlarmInfos}" Visibility="{Binding CurrentDataVis}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid x:Name="gr" Height="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.3*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.5*" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding NumId}" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Date}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Time}" /> | |||
<Grid Grid.Column="3"> | |||
<TextBlock | |||
Margin="10,0,0,0" | |||
HorizontalAlignment="Left" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Info}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="4" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Value}" /> | |||
<Grid Grid.Column="5"> | |||
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Grade}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<Border | |||
Grid.ColumnSpan="6" | |||
BorderBrush="{StaticResource BorderSolid}" | |||
BorderThickness="1" /> | |||
</Grid> | |||
<DataTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" /> | |||
</Trigger> | |||
</DataTemplate.Triggers> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
<!--#endregion--> | |||
<!--#region 历史报警信息--> | |||
<ItemsControl ItemsSource="{Binding HistoryAlarm}" Visibility="{Binding HistoryDataVis}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid x:Name="gr" Height="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.3*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.5*" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Id}" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Date}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Time}" /> | |||
<Grid Grid.Column="3"> | |||
<TextBlock | |||
Margin="10,0,0,0" | |||
HorizontalAlignment="Left" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Info}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="4" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Value}" /> | |||
<Grid Grid.Column="5"> | |||
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Grade}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<Border | |||
Grid.ColumnSpan="6" | |||
BorderBrush="{StaticResource BorderSolid}" | |||
BorderThickness="1" /> | |||
</Grid> | |||
<DataTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" /> | |||
</Trigger> | |||
</DataTemplate.Triggers> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
<!--#endregion--> | |||
</Grid> | |||
</ScrollViewer> | |||
<!--#endregion--> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,28 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
using System.Windows.Data; | |||
using System.Windows.Documents; | |||
using System.Windows.Input; | |||
using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace BPASmartClient.CustomResource.Pages.View | |||
{ | |||
/// <summary> | |||
/// AlarmView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class AlarmView : UserControl | |||
{ | |||
public AlarmView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -0,0 +1,140 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.Concurrent; | |||
using System.Collections.ObjectModel; | |||
using System.Windows; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.Model; | |||
using BPASmartClient.CustomResource.Pages.Model; | |||
namespace BPASmartClient.CustomResource.Pages.ViewModel | |||
{ | |||
public class AlarmViewModel : ObservableObject | |||
{ | |||
public AlarmViewModel() | |||
{ | |||
ControlCommand = new RelayCommand(() => | |||
{ | |||
if (ControlButText == "报警复位") | |||
{ | |||
return; | |||
} | |||
if (ControlButText == "开始查询") | |||
{ | |||
var lists = Sqlite<Alarm>.GetInstance.GetData(); | |||
var res = lists.Where(p => Convert.ToDateTime(p.Date) >= StartDateTime && Convert.ToDateTime(p.Date) <= EndDateTime).ToList(); | |||
if (res != null) | |||
{ | |||
HistoryAlarm.Clear(); | |||
foreach (var item in res) | |||
{ | |||
HistoryAlarm.Add(item); | |||
} | |||
} | |||
} | |||
}); | |||
SwitchCommand = new RelayCommand(() => | |||
{ | |||
if (ButContent == "历史报警") | |||
{ | |||
GetHistoryAlarm(); | |||
CurrentDataVis = Visibility.Hidden; | |||
HistoryDataVis = Visibility.Visible; | |||
IsVisibility = Visibility.Visible; | |||
ControlButText = "开始查询"; | |||
ButContent = "实时报警"; | |||
return; | |||
} | |||
if (ButContent == "实时报警") | |||
{ | |||
HistoryDataVis = Visibility.Hidden; | |||
CurrentDataVis = Visibility.Visible; | |||
IsVisibility = Visibility.Hidden; | |||
ControlButText = "报警复位"; | |||
ButContent = "历史报警"; | |||
return; | |||
} | |||
}); | |||
//AlarmInfos = AlarmHelper<tt>.Alarms; | |||
//AlarmHelper<tt>.Init(); | |||
} | |||
private void GetHistoryAlarm() | |||
{ | |||
var data = Sqlite<Alarm>.GetInstance.GetData(); | |||
if (data != null) | |||
{ | |||
HistoryAlarm.Clear(); | |||
foreach (var item in data) | |||
{ | |||
int day = DateTime.Now.Subtract(Convert.ToDateTime(item.Date)).Days; | |||
if (day == 0) | |||
{ | |||
HistoryAlarm.Add(item); | |||
} | |||
} | |||
} | |||
} | |||
public RelayCommand SwitchCommand { get; set; } | |||
public RelayCommand ControlCommand { get; set; } | |||
public Visibility CurrentDataVis { get { return _mCurrentDataVis; } set { _mCurrentDataVis = value; OnPropertyChanged(); } } | |||
private Visibility _mCurrentDataVis = Visibility.Visible; | |||
public Visibility HistoryDataVis { get { return _mHistoryDataVis; } set { _mHistoryDataVis = value; OnPropertyChanged(); } } | |||
private Visibility _mHistoryDataVis = Visibility.Hidden; | |||
/// <summary> | |||
/// 是否显示 | |||
/// </summary> | |||
public Visibility IsVisibility { get { return _mIsVisibility; } set { _mIsVisibility = value; OnPropertyChanged(); } } | |||
private Visibility _mIsVisibility = Visibility.Hidden; | |||
/// <summary> | |||
/// 文字显示 | |||
/// </summary> | |||
public string ButContent { get { return _mButContent; } set { _mButContent = value; OnPropertyChanged(); } } | |||
private string _mButContent = "历史报警"; | |||
/// <summary> | |||
/// 控制按钮文本显示 | |||
/// </summary> | |||
public string ControlButText { get { return _mControlButText; } set { _mControlButText = value; OnPropertyChanged(); } } | |||
private string _mControlButText = "报警复位"; | |||
/// <summary> | |||
/// 开始时间 | |||
/// </summary> | |||
public DateTime StartDateTime { get { return _mStartDateTime; } set { _mStartDateTime = value; OnPropertyChanged(); } } | |||
private DateTime _mStartDateTime = DateTime.Now; | |||
/// <summary> | |||
/// 结束时间 | |||
/// </summary> | |||
public DateTime EndDateTime { get { return _mEndDateTime; } set { _mEndDateTime = value; OnPropertyChanged(); } } | |||
private DateTime _mEndDateTime = DateTime.Now; | |||
public ObservableCollection<Alarm> AlarmInfos { get; set; } | |||
public ObservableCollection<Alarm> HistoryAlarm { get; set; } = new ObservableCollection<Alarm>(); | |||
} | |||
} |
@@ -1,57 +0,0 @@ | |||
//using System; | |||
//using System.Collections.Generic; | |||
//using System.ComponentModel.DataAnnotations; | |||
//using System.Linq; | |||
//using System.Text; | |||
//using System.Threading.Tasks; | |||
//namespace BPASmartClient.Device | |||
//{ | |||
// public class Alarm | |||
// { | |||
// /// <summary> | |||
// /// ID | |||
// /// </summary> | |||
// [Key] | |||
// public int Id { get { return _mId; } set { _mId = value; } } | |||
// private int _mId; | |||
// /// <summary> | |||
// /// 编号ID | |||
// /// </summary> | |||
// public int NumId { get { return _mNumId; } set { _mNumId = value; } } | |||
// private int _mNumId; | |||
// /// <summary> | |||
// /// 日期 | |||
// /// </summary> | |||
// public string Date { get { return _mDate; } set { _mDate = value; } } | |||
// private string _mDate; | |||
// /// <summary> | |||
// /// 时间 | |||
// /// </summary> | |||
// public string Time { get { return _mTime; } set { _mTime = value; } } | |||
// private string _mTime; | |||
// /// <summary> | |||
// /// 报警信息 | |||
// /// </summary> | |||
// public string Info { get { return _mInfo; } set { _mInfo = value; } } | |||
// private string _mInfo; | |||
// /// <summary> | |||
// /// 报警值 | |||
// /// </summary> | |||
// public string Value { get { return _mValue; } set { _mValue = value; } } | |||
// private string _mValue; | |||
// /// <summary> | |||
// /// 报警等级 | |||
// /// </summary> | |||
// public string Grade { get { return _mGrade; } set { _mGrade = value; } } | |||
// private string _mGrade; | |||
// } | |||
//} |
@@ -13,6 +13,7 @@ | |||
<Lcid>0</Lcid> | |||
<Isolated>false</Isolated> | |||
<EmbedInteropTypes>true</EmbedInteropTypes> | |||
<UseWindowsForms>true</UseWindowsForms> | |||
</COMReference> | |||
</ItemGroup> | |||
@@ -6,6 +6,8 @@ using System.Reflection; | |||
using System.Runtime.InteropServices; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.ComponentModel; | |||
using System.IO; | |||
namespace BPASmartClient.Helper | |||
{ | |||
@@ -13,26 +15,81 @@ namespace BPASmartClient.Helper | |||
{ | |||
//private static ILogger logger = NLog.LogManager.GetCurrentClassLogger(); | |||
public static bool isShowNumBoard = false; | |||
//public static bool isShowNumBoard = false; | |||
//[DllImport("kernel32.dll", SetLastError = true)] | |||
//public static extern bool Wow64DisableWow64FsRedirection(ref IntPtr ptr); | |||
//[DllImport("kernel32.dll", SetLastError = true)] | |||
//public static extern bool Wow64RevertWow64FsRedirection(IntPtr ptr); | |||
//public static IntPtr ptr = new IntPtr(); | |||
public static bool isShowNumBoard = false; | |||
[DllImport("kernel32.dll", SetLastError = true)] | |||
public static extern bool Wow64DisableWow64FsRedirection(ref IntPtr ptr); | |||
[DllImport("kernel32.dll", SetLastError = true)] | |||
public static extern bool Wow64RevertWow64FsRedirection(IntPtr ptr); | |||
public static IntPtr ptr = new IntPtr(); | |||
public static void StartKeyBoardFun() | |||
{ | |||
try | |||
{ | |||
} | |||
catch (Exception) | |||
{ | |||
throw; | |||
} | |||
} | |||
public static void ShowScreenKeyboard() | |||
{ | |||
try | |||
{ | |||
//string file = @"C:\Program Files\Common Files\microsoft shared\ink\TabTip.exe"; | |||
////if (!System.IO.File.Exists(file)) | |||
//// return; | |||
//Process.Start(file); | |||
string path = "C:/Program Files/Common Files/microsoft shared/ink/TabTip.exe"; | |||
if (File.Exists(path)) | |||
{ | |||
Process p = Process.Start(path); | |||
} | |||
else | |||
{ | |||
//判断软键盘是否进程是否已经存在,如果不存在进行调用 | |||
Process[] pro = Process.GetProcessesByName("osk"); | |||
//说明已经存在,不再进行调用 | |||
if (pro != null && pro.Length > 0) | |||
return; | |||
IntPtr ptr = new IntPtr(); | |||
bool isWow64FsRedirectionDisabled = Wow64DisableWow64FsRedirection(ref ptr); | |||
if (isWow64FsRedirectionDisabled) | |||
{ | |||
Process.Start(@"C:\WINDOWS\system32\osk.exe"); | |||
bool isWow64FsRedirectionReverted = Wow64RevertWow64FsRedirection(ptr); | |||
} | |||
} | |||
//ProcessStartInfo psi = new ProcessStartInfo(); | |||
//psi.FileName = @"C:\Windows\System32\osk.exe"; | |||
//psi.UseShellExecute = false; | |||
//psi.CreateNoWindow = true; | |||
//Process.Start(psi); | |||
Process kbpr = System.Diagnostics.Process.Start(@"C:\Windows\System32\osk.exe"); // 打开系统键盘 | |||
//Process kbpr = System.Diagnostics.Process.Start(@"C:\Windows\System32\osk.exe"); // 打开系统键盘 | |||
////判断软键盘是否进程是否已经存在,如果不存在进行调用 | |||
//Process[] pro = Process.GetProcessesByName("osk"); | |||
@@ -185,4 +242,7 @@ namespace BPASmartClient.Helper | |||
} |
@@ -1,9 +1,9 @@ | |||
<Application | |||
x:Class="DosingSystem.App" | |||
x:Class="BPASmartClient.DosingSystem.App" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:con="clr-namespace:BPASmartClient.CustomResource.Converters;assembly=BPASmartClient.CustomResource" | |||
xmlns:local="clr-namespace:DosingSystem" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem" | |||
StartupUri="View/MainWindow.xaml"> | |||
<Application.Resources> | |||
<ResourceDictionary> | |||
@@ -6,7 +6,7 @@ using System.Linq; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
namespace DosingSystem | |||
namespace BPASmartClient.DosingSystem | |||
{ | |||
/// <summary> | |||
/// Interaction logic for App.xaml | |||
@@ -6,7 +6,7 @@ using System.Threading.Tasks; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
namespace DosingSystem.Model | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
public class ActionMenu : ObservableObject | |||
{ | |||
@@ -19,5 +19,10 @@ namespace DosingSystem.Model | |||
public string MenuName { get { return _mMenuName; } set { _mMenuName = value; OnPropertyChanged(); } } | |||
private string _mMenuName; | |||
//public string NameSpace { get { return _mNameSpace; } set { _mNameSpace = value; OnPropertyChanged(); } } | |||
//private string _mNameSpace; | |||
} | |||
} |
@@ -7,7 +7,7 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace DosingSystem.Model | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
public class Config | |||
{ | |||
@@ -4,7 +4,7 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace DosingSystem.Model | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
public class DeviceAddress | |||
{ | |||
@@ -1,7 +1,7 @@ | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.Message; | |||
using BPASmartClient.Modbus; | |||
using DosingSystem.ViewModel; | |||
using BPASmartClient.DosingSystem.ViewModel; | |||
using System; | |||
using System.Collections.Concurrent; | |||
using System.Collections.Generic; | |||
@@ -12,7 +12,7 @@ using System.Text; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
namespace DosingSystem.Model | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
public class DeviceInquire | |||
{ | |||
@@ -38,6 +38,11 @@ namespace DosingSystem.Model | |||
}), "配料机设备上线监听", true); | |||
} | |||
public void Rescan() | |||
{ | |||
InvalidIP.Clear(); | |||
} | |||
public DeviceStatus GetDevice(string ip) | |||
{ | |||
if (ip != null) | |||
@@ -172,14 +177,15 @@ namespace DosingSystem.Model | |||
{ | |||
ThreadManage.GetInstance().StartLong(new Action(() => | |||
{ | |||
//获取设备运行状态 | |||
var res = this.modbusTcp.Read(DeviceAddress.RunStatus); | |||
if (res != null && res is ushort[] ushortValue) | |||
{ | |||
if (ushortValue.Length >= 1) deviceStatus.RunStatus = ushortValue[0]; | |||
} | |||
var res1 = this.modbusTcp.GetUint("LW202"); | |||
//获取设备料仓剩余重量 | |||
deviceStatus.WeightFeedback = this.modbusTcp.GetUint(DeviceAddress.WeightFeedback) * 10; | |||
Thread.Sleep(100); | |||
}), $"{DeviceName} 开始监听", true); | |||
@@ -4,7 +4,7 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace DosingSystem.Model | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
public class Global | |||
{ | |||
@@ -4,9 +4,9 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Collections.ObjectModel; | |||
using DosingSystem.ViewModel; | |||
using BPASmartClient.DosingSystem.ViewModel; | |||
namespace DosingSystem.Model | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
public class LocaPar | |||
{ | |||
@@ -4,7 +4,7 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace DosingSystem.Model | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
public class RawMaterialDeviceStatus | |||
{ | |||
@@ -5,7 +5,7 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace DosingSystem.Model | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
/// <summary> | |||
/// 原料模块 | |||
@@ -5,10 +5,10 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading; | |||
using System.Threading.Tasks; | |||
using DosingSystem.ViewModel; | |||
using BPASmartClient.DosingSystem.ViewModel; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
namespace DosingSystem.Model | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
/// <summary> | |||
/// 配方模块 | |||
@@ -4,7 +4,7 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace DosingSystem.Model | |||
namespace BPASmartClient.DosingSystem.Model | |||
{ | |||
public class UserManager | |||
{ | |||
@@ -24,7 +24,7 @@ namespace DosingSystem.Model | |||
管理员 = 1, | |||
操作员 = 2, | |||
观察员 = 3, | |||
技术员=4 | |||
技术员 = 4 | |||
} | |||
} |
@@ -1,13 +1,13 @@ | |||
<UserControl | |||
x:Class="DosingSystem.View.AdminstratorsView" | |||
x:Class="BPASmartClient.DosingSystem.View.AdminstratorsView" | |||
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:helper="clr-namespace:DosingSystem.View.Helper" | |||
xmlns:local="clr-namespace:DosingSystem.View" | |||
xmlns:helper="clr-namespace:BPASmartClient.DosingSystem.View.Helper" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:uc="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:DosingSystem.ViewModel" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
d:DesignHeight="600" | |||
d:DesignWidth="800" | |||
Loaded="UserControl_Loaded" | |||
@@ -14,7 +14,7 @@ using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
using static BPASmartClient.CustomResource.UserControls.UserKeyBoard; | |||
namespace DosingSystem.View | |||
namespace BPASmartClient.DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// AdministratorsView.xaml 的交互逻辑 | |||
@@ -1,27 +1,380 @@ | |||
<UserControl | |||
x:Class="DosingSystem.View.AlarmRecordView" | |||
x:Class="BPASmartClient.DosingSystem.View.AlarmRecordView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:DosingSystem.View" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:DosingSystem.ViewModel" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
<UserControl.DataContext> | |||
<vm:AlarmRecordViewModel/> | |||
<vm:AlarmRecordViewModel /> | |||
</UserControl.DataContext> | |||
<Grid> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="40" | |||
Foreground="Wheat" | |||
Text="报警记录" /> | |||
<UserControl.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary> | |||
<!--<convert:TextDisplayConvert x:Key="textDisplayConvert" /> | |||
<convert:IsEnableConvert x:Key="isEnableConvert" /> | |||
<convert:AnalogAlarmConvert x:Key="analogAlarmConvert" /> | |||
<convert:DiscreteAlarmConvert x:Key="discreteAlarmConvert" /> | |||
<convert:AlarmTypeTextConvert x:Key="alarmTypeTextConvert" />--> | |||
<SolidColorBrush x:Key="BorderSolid" Color="#5523CACA" /> | |||
<SolidColorBrush x:Key="FontColor" Color="#FF2AB2E7" /> | |||
<SolidColorBrush x:Key="TitleFontColor" Color="#ddd" /> | |||
<SolidColorBrush x:Key="CursorColor" Color="Aqua" /> | |||
<SolidColorBrush x:Key="TitleBorderColor" Color="#FF2AB2E7" /> | |||
<Style x:Key="TextBlockStyle" TargetType="TextBlock"> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="FontSize" Value="18" /> | |||
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
<Setter Property="HorizontalAlignment" Value="Center" /> | |||
</Style> | |||
<Style x:Key="TextBoxStyle" TargetType="TextBox"> | |||
<Setter Property="FontFamily" Value="楷体" /> | |||
<Setter Property="FontSize" Value="22" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="Foreground" Value="{StaticResource TextBlockForeground}" /> | |||
<Setter Property="BorderBrush" Value="#FF23CACA" /> | |||
<Setter Property="CaretBrush" Value="Aqua" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
</Style> | |||
<Style x:Key="DataTextBlockStyle" TargetType="TextBlock"> | |||
<Setter Property="HorizontalAlignment" Value="Center" /> | |||
<Setter Property="VerticalAlignment" Value="Center" /> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="Foreground" Value="Red" /> | |||
<Setter Property="FontSize" Value="14" /> | |||
</Style> | |||
<ControlTemplate x:Key="ButTemplate" TargetType="Button"> | |||
<Border | |||
x:Name="br" | |||
Background="Transparent" | |||
BorderBrush="#FF19B7EC" | |||
BorderThickness="2"> | |||
<StackPanel | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Orientation="Horizontal"> | |||
<ContentControl | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
Content="{TemplateBinding Content}" | |||
Foreground="{TemplateBinding Foreground}" /> | |||
</StackPanel> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="True"> | |||
<Setter TargetName="br" Property="Background" Value="#2219B7EC" /> | |||
</Trigger> | |||
<Trigger Property="IsPressed" Value="true"> | |||
<Setter TargetName="br" Property="Background" Value="#2219B7EC" /> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</ResourceDictionary> | |||
</ResourceDictionary.MergedDictionaries> | |||
</ResourceDictionary> | |||
</UserControl.Resources> | |||
<Grid Margin="10"> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="50" /> | |||
<RowDefinition Height="30" /> | |||
<RowDefinition /> | |||
</Grid.RowDefinitions> | |||
<StackPanel | |||
Margin="0,8" | |||
HorizontalAlignment="Right" | |||
Orientation="Horizontal"> | |||
<DatePicker | |||
Background="Transparent" | |||
BorderBrush="#aa3aa7f3" | |||
BorderThickness="2" | |||
SelectedDate="{Binding StartDateTime}" | |||
Style="{StaticResource PickerStyle}" | |||
Text="请输入开始时间" | |||
Visibility="{Binding IsVisibility}" /> | |||
<DatePicker | |||
Margin="20,0,20,0" | |||
Background="Transparent" | |||
BorderBrush="#aa3aa7f3" | |||
BorderThickness="2" | |||
SelectedDate="{Binding EndDateTime}" | |||
Style="{StaticResource PickerStyle}" | |||
Text="请输入结束时间" | |||
Visibility="{Binding IsVisibility}" /> | |||
<Button | |||
Width="140" | |||
Height="30" | |||
Background="#FF19B7EC" | |||
Command="{Binding ControlCommand}" | |||
Content="{Binding ControlButText}" | |||
FontFamily="楷体" | |||
FontSize="18" | |||
Template="{StaticResource ButTemplate}"> | |||
<Button.Foreground> | |||
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> | |||
<GradientStop Color="#FFBB662A" /> | |||
<GradientStop Offset="1" Color="White" /> | |||
</LinearGradientBrush> | |||
</Button.Foreground> | |||
</Button> | |||
<Button | |||
Width="140" | |||
Height="30" | |||
Margin="20,0,0,0" | |||
Background="#FF19B7EC" | |||
Command="{Binding SwitchCommand}" | |||
Content="{Binding ButContent}" | |||
FontFamily="楷体" | |||
FontSize="18" | |||
Template="{StaticResource ButTemplate}"> | |||
<Button.Foreground> | |||
<LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1"> | |||
<GradientStop Color="#FFBB662A" /> | |||
<GradientStop Offset="1" Color="White" /> | |||
</LinearGradientBrush> | |||
</Button.Foreground> | |||
</Button> | |||
</StackPanel> | |||
<!--#region 表格标题栏设置--> | |||
<Grid Grid.Row="1" Background="#dd2AB2E7"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.3*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.5*" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="ID" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="报警日期" /> | |||
<Border | |||
BorderBrush="{StaticResource TitleBorderColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="报警时间" /> | |||
<Grid Grid.Column="3"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="报警信息" /> | |||
<Border | |||
BorderBrush="{StaticResource TitleBorderColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="4" | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="报警值" /> | |||
<Grid Grid.Column="5"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
VerticalAlignment="Center" | |||
FontSize="16" | |||
Foreground="{StaticResource TitleFontColor}" | |||
Text="报警等级" /> | |||
<Border | |||
BorderBrush="{StaticResource TitleBorderColor}" | |||
BorderThickness="1,0,1,0" | |||
Cursor="SizeWE" /> | |||
</Grid> | |||
</Grid> | |||
<!--#endregion--> | |||
<!--#region 表格数据显示--> | |||
<ScrollViewer | |||
Grid.Row="2" | |||
HorizontalScrollBarVisibility="Hidden" | |||
VerticalScrollBarVisibility="Hidden"> | |||
<Grid> | |||
<!--#region 实时报警信息--> | |||
<ItemsControl ItemsSource="{Binding AlarmInfos}" Visibility="{Binding CurrentDataVis}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid x:Name="gr" Height="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.3*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.5*" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding NumId}" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Date}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Time}" /> | |||
<Grid Grid.Column="3"> | |||
<TextBlock | |||
Margin="10,0,0,0" | |||
HorizontalAlignment="Left" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Info}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="4" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Value}" /> | |||
<Grid Grid.Column="5"> | |||
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Grade}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<Border | |||
Grid.ColumnSpan="6" | |||
BorderBrush="{StaticResource BorderSolid}" | |||
BorderThickness="1" /> | |||
</Grid> | |||
<DataTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" /> | |||
</Trigger> | |||
</DataTemplate.Triggers> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
<!--#endregion--> | |||
<!--#region 历史报警信息--> | |||
<ItemsControl ItemsSource="{Binding HistoryAlarm}" Visibility="{Binding HistoryDataVis}"> | |||
<ItemsControl.ItemTemplate> | |||
<DataTemplate> | |||
<Grid x:Name="gr" Height="30"> | |||
<Grid.ColumnDefinitions> | |||
<ColumnDefinition Width="0.3*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition /> | |||
<ColumnDefinition Width="0.7*" /> | |||
<ColumnDefinition Width="0.5*" /> | |||
</Grid.ColumnDefinitions> | |||
<TextBlock | |||
Grid.Column="0" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Id}" /> | |||
<Grid Grid.Column="1"> | |||
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Date}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="2" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Time}" /> | |||
<Grid Grid.Column="3"> | |||
<TextBlock | |||
Margin="10,0,0,0" | |||
HorizontalAlignment="Left" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Info}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<TextBlock | |||
Grid.Column="4" | |||
Style="{StaticResource DataTextBlockStyle}" | |||
Text="{Binding Value}" /> | |||
<Grid Grid.Column="5"> | |||
<TextBlock Style="{StaticResource DataTextBlockStyle}" Text="{Binding Grade}" /> | |||
<Border BorderBrush="{StaticResource BorderSolid}" BorderThickness="1,0,1,0" /> | |||
</Grid> | |||
<Border | |||
Grid.ColumnSpan="6" | |||
BorderBrush="{StaticResource BorderSolid}" | |||
BorderThickness="1" /> | |||
</Grid> | |||
<DataTemplate.Triggers> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter TargetName="gr" Property="Background" Value="#112AB2E7" /> | |||
</Trigger> | |||
</DataTemplate.Triggers> | |||
</DataTemplate> | |||
</ItemsControl.ItemTemplate> | |||
</ItemsControl> | |||
<!--#endregion--> | |||
</Grid> | |||
</ScrollViewer> | |||
<!--#endregion--> | |||
</Grid> | |||
</UserControl> |
@@ -13,7 +13,7 @@ using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace DosingSystem.View | |||
namespace BPASmartClient.DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// AlarmRecordView.xaml 的交互逻辑 | |||
@@ -1,11 +1,11 @@ | |||
<Window | |||
x:Class="DosingSystem.View.ChangeDeviceNameView" | |||
x:Class="BPASmartClient.DosingSystem.View.ChangeDeviceNameView" | |||
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:local="clr-namespace:DosingSystem.View" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:DosingSystem.ViewModel" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
Title="ChangeDeviceNameView" | |||
Width="400" | |||
Height="200" | |||
@@ -13,7 +13,7 @@ using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Shapes; | |||
namespace DosingSystem.View | |||
namespace BPASmartClient.DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// ChangeDeviceNameView.xaml 的交互逻辑 | |||
@@ -1,13 +1,13 @@ | |||
<UserControl | |||
x:Class="DosingSystem.View.DeviceListView" | |||
x:Class="BPASmartClient.DosingSystem.View.DeviceListView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:DosingSystem.View" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:DosingSystem.ViewModel" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
@@ -13,7 +13,7 @@ using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace DosingSystem.View | |||
namespace BPASmartClient.DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// DeviceListView.xaml 的交互逻辑 | |||
@@ -1,13 +1,13 @@ | |||
<UserControl | |||
x:Class="DosingSystem.View.HardwareStatusView" | |||
x:Class="BPASmartClient.DosingSystem.View.HardwareStatusView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:DosingSystem.View" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:DosingSystem.ViewModel" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
@@ -13,7 +13,7 @@ using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace DosingSystem.View | |||
namespace BPASmartClient.DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// HardwareStatusView.xaml 的交互逻辑 | |||
@@ -6,7 +6,7 @@ using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Controls; | |||
namespace DosingSystem.View.Helper | |||
namespace BPASmartClient.DosingSystem.View.Helper | |||
{ | |||
/// <summary> | |||
/// 为PasswordBox控件的Password增加绑定功能 | |||
@@ -1,13 +1,13 @@ | |||
<Window | |||
x:Class="DosingSystem.View.MainWindow" | |||
x:Class="BPASmartClient.DosingSystem.View.MainWindow" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:DosingSystem" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:DosingSystem.ViewModel" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
Title="MainWindow" | |||
Width="1300" | |||
Height="800" | |||
@@ -13,7 +13,7 @@ using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace DosingSystem.View | |||
namespace BPASmartClient.DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// Interaction logic for MainWindow.xaml | |||
@@ -1,11 +1,11 @@ | |||
<Window | |||
x:Class="DosingSystem.View.NewRecipeView" | |||
x:Class="BPASmartClient.DosingSystem.View.NewRecipeView" | |||
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:local="clr-namespace:DosingSystem.View" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:vm="clr-namespace:DosingSystem.ViewModel" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
Title="NewRecipeView" | |||
Width="550" | |||
Height="450" | |||
@@ -13,7 +13,7 @@ using System.Windows.Media; | |||
using System.Windows.Media.Imaging; | |||
using System.Windows.Shapes; | |||
namespace DosingSystem.View | |||
namespace BPASmartClient.DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// NewRecipeView.xaml 的交互逻辑 | |||
@@ -1,13 +1,13 @@ | |||
<UserControl | |||
x:Class="DosingSystem.View.RecipeControlView" | |||
x:Class="BPASmartClient.DosingSystem.View.RecipeControlView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:DosingSystem.View" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:DosingSystem.ViewModel" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
@@ -13,7 +13,7 @@ using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace DosingSystem.View | |||
namespace BPASmartClient.DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// RecipeControlView.xaml 的交互逻辑 | |||
@@ -1,13 +1,13 @@ | |||
<UserControl | |||
x:Class="DosingSystem.View.RecipeSettingsView" | |||
x:Class="BPASmartClient.DosingSystem.View.RecipeSettingsView" | |||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |||
xmlns:control="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |||
xmlns:local="clr-namespace:DosingSystem.View" | |||
xmlns:local="clr-namespace:BPASmartClient.DosingSystem.View" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:DosingSystem.ViewModel" | |||
xmlns:vm="clr-namespace:BPASmartClient.DosingSystem.ViewModel" | |||
d:DesignHeight="450" | |||
d:DesignWidth="800" | |||
mc:Ignorable="d"> | |||
@@ -13,7 +13,7 @@ using System.Windows.Media.Imaging; | |||
using System.Windows.Navigation; | |||
using System.Windows.Shapes; | |||
namespace DosingSystem.View | |||
namespace BPASmartClient.DosingSystem.View | |||
{ | |||
/// <summary> | |||
/// RecipeSettingsView.xaml 的交互逻辑 | |||
@@ -8,7 +8,7 @@ using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Collections.ObjectModel; | |||
namespace DosingSystem.ViewModel | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class AdminstratorsViewModel : ObservableObject | |||
{ | |||
@@ -33,7 +33,7 @@ namespace DosingSystem.ViewModel | |||
{ | |||
AdminLoginCommand = new RelayCommand(() => | |||
{ | |||
var rest = ActionManage.GetInstance.SendResult("LoginDosingSystem", $"{Admin}-={Password}-={SelectText}"); | |||
var rest = ActionManage.GetInstance.SendResult("LoginBPASmartClient.DosingSystem", $"{Admin}-={Password}-={SelectText}"); | |||
if (rest != null && rest is string str) | |||
{ | |||
ErrorMessage = str; | |||
@@ -10,7 +10,7 @@ using System.Windows; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
namespace DosingSystem.ViewModel | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class AlarmRecordViewModel : ObservableObject | |||
{ | |||
@@ -4,11 +4,11 @@ using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using BPASmartClient.Helper; | |||
using DosingSystem.Model; | |||
using BPASmartClient.DosingSystem.Model; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
namespace DosingSystem.ViewModel | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class ChangeDeviceNameViewModel : ObservableObject | |||
{ | |||
@@ -9,9 +9,9 @@ using System.Collections.ObjectModel; | |||
using System.Windows; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using DosingSystem.View; | |||
using BPASmartClient.DosingSystem.View; | |||
namespace DosingSystem.ViewModel | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class DeviceListViewModel : ObservableObject | |||
{ | |||
@@ -10,7 +10,7 @@ using System.Windows; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
namespace DosingSystem.ViewModel | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class HardwareStatusViewModel : ObservableObject | |||
{ | |||
@@ -9,11 +9,12 @@ using System.Collections.ObjectModel; | |||
using System.Windows; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using DosingSystem.Model; | |||
using BPASmartClient.DosingSystem.Model; | |||
using Newtonsoft.Json; | |||
using System.IO; | |||
using System.Reflection; | |||
namespace DosingSystem.ViewModel | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class MainViewModel : ObservableObject | |||
{ | |||
@@ -40,7 +41,7 @@ namespace DosingSystem.ViewModel | |||
{ | |||
Json<LocaPar>.Read(); | |||
TogglePag = new RelayCommand<object>(DoNavChanged); | |||
Login = new RelayCommand(() => { DoNavChanged("AdminstratorsView.用户登录"); UserManagement = false; }); | |||
Login = new RelayCommand(() => { DoNavChanged("BPASmartClient.DosingSystem.View.AdminstratorsView_用户登录"); UserManagement = false; }); | |||
PasswordChange = new RelayCommand(() => | |||
{ | |||
//DoNavChanged("PasswordChangeView.密码修改"); | |||
@@ -48,6 +49,7 @@ namespace DosingSystem.ViewModel | |||
}); | |||
ExitLogin = new RelayCommand(() => | |||
{ | |||
SystemUtils.ShowScreenKeyboard(); | |||
//DoNavChanged("LoginView.退出登录"); | |||
UserManagement = false; | |||
}); | |||
@@ -78,7 +80,7 @@ namespace DosingSystem.ViewModel | |||
} | |||
} | |||
return "用户名或密码错误"; | |||
}), "LoginDosingSystem"); | |||
}), "LoginBPASmartClient.DosingSystem"); | |||
} | |||
private void MenuInit() | |||
@@ -86,31 +88,31 @@ namespace DosingSystem.ViewModel | |||
menus.Add(new ActionMenu() | |||
{ | |||
MenuName = "配方设置", | |||
CommandParameter = "RecipeSettingsView.配方设置", | |||
CommandParameter = "BPASmartClient.DosingSystem.View.RecipeSettingsView_配方设置", | |||
permission = new Permission[] { Permission.管理员, Permission.技术员 }, | |||
}); | |||
menus.Add(new ActionMenu() | |||
{ | |||
MenuName = "设备列表", | |||
CommandParameter = "DeviceListView.设备列表", | |||
CommandParameter = "BPASmartClient.DosingSystem.View.DeviceListView_设备列表", | |||
permission = new Permission[] { Permission.管理员, Permission.技术员 }, | |||
}); | |||
menus.Add(new ActionMenu() | |||
{ | |||
MenuName = "硬件状态", | |||
CommandParameter = "HardwareStatusView.硬件状态", | |||
CommandParameter = "BPASmartClient.DosingSystem.View.HardwareStatusView_硬件状态", | |||
permission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 }, | |||
}); | |||
menus.Add(new ActionMenu() | |||
{ | |||
MenuName = "报警记录", | |||
CommandParameter = "AlarmRecordView.报警记录", | |||
CommandParameter = "BPASmartClient.CustomResource.Pages.View.AlarmView_报警记录", | |||
permission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 }, | |||
}); | |||
menus.Add(new ActionMenu() | |||
{ | |||
MenuName = "配方下发", | |||
CommandParameter = "RecipeControlView.配方控制", | |||
CommandParameter = "BPASmartClient.DosingSystem.View.RecipeControlView_配方控制", | |||
permission = new Permission[] { Permission.管理员, Permission.操作员 }, | |||
}); | |||
} | |||
@@ -119,10 +121,15 @@ namespace DosingSystem.ViewModel | |||
{ | |||
if (obj != null && obj is string stobj) | |||
{ | |||
var strs = stobj.Split('.'); | |||
var strs = stobj.Split('_'); | |||
if (strs != null && strs.Length == 2) | |||
{ | |||
Type type = Type.GetType($"DosingSystem.View.{strs[0]}"); | |||
Type type; | |||
if (!stobj.Contains("BPASmartClient.DosingSystem")) | |||
{ | |||
type = Assembly.Load("BPASmartClient.CustomResource").GetType(strs[0]); | |||
} | |||
else type = Type.GetType(strs[0]); | |||
var res = type?.GetConstructor(System.Type.EmptyTypes)?.Invoke(null); | |||
if (res != null && res is FrameworkElement fe) MyWindow = fe; | |||
WindowTitleName = strs[1]; | |||
@@ -7,9 +7,9 @@ using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System.Collections.ObjectModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using BPASmartClient.Helper; | |||
using DosingSystem.Model; | |||
using BPASmartClient.DosingSystem.Model; | |||
namespace DosingSystem.ViewModel | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class NewRecipeViewModel : ObservableObject | |||
{ | |||
@@ -9,10 +9,10 @@ using System.Collections.ObjectModel; | |||
using System.Windows; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using DosingSystem.Model; | |||
using BPASmartClient.DosingSystem.Model; | |||
using System.Threading; | |||
namespace DosingSystem.ViewModel | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class RecipeControlViewModel : ObservableObject | |||
{ | |||
@@ -49,6 +49,7 @@ namespace DosingSystem.ViewModel | |||
int index = Array.FindIndex(Recipes.ToArray(), p => p.RecipeName == devices.ElementAt(0)); | |||
if (index >= 0 && index < Recipes.Count) | |||
{ | |||
Recipes.ElementAt(index).Are.Reset(); | |||
Recipes.ElementAt(index).IsEnable = false; | |||
foreach (var item in Recipes.ElementAt(index).RawMaterials) | |||
{ | |||
@@ -9,10 +9,10 @@ using System.Collections.ObjectModel; | |||
using System.Windows; | |||
using BPASmartClient.Helper; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using DosingSystem.Model; | |||
using DosingSystem.View; | |||
using BPASmartClient.DosingSystem.Model; | |||
using BPASmartClient.DosingSystem.View; | |||
namespace DosingSystem.ViewModel | |||
namespace BPASmartClient.DosingSystem.ViewModel | |||
{ | |||
public class RecipeSettingsViewModel : ObservableObject | |||
{ | |||
@@ -94,11 +94,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.Juicer", "BP | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkT_HQ", "BPASmartClient.MorkT_HQ\BPASmartClient.MorkT_HQ.csproj", "{00C17D87-A323-4A97-BC21-7039E55614DE}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DosingSystem", "DosingSystem\DosingSystem.csproj", "{4E0B01AD-CFD0-4BD5-BBE6-AD2A4183B4DB}" | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.DosingSystem", "DosingSystem\BPASmartClient.DosingSystem.csproj", "{4E0B01AD-CFD0-4BD5-BBE6-AD2A4183B4DB}" | |||
EndProject | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.MorkTJuicer", "BPASmartClient.MorkTJuicer\BPASmartClient.MorkTJuicer.csproj", "{724087A3-E7E7-4494-B844-414FF5CD1D40}" | |||
EndProject | |||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BPASmartClient.AGV", "BPASmartClient.AGV\BPASmartClient.AGV.csproj", "{507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}" | |||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BPASmartClient.AGV", "BPASmartClient.AGV\BPASmartClient.AGV.csproj", "{507A30E2-246E-4AC9-82F4-BE8FBBC1C5B8}" | |||
EndProject | |||
Global | |||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | |||