@@ -38,6 +38,7 @@ namespace BPASmartClient.Business | |||
/// </summary> | |||
public void Stop() | |||
{ | |||
Plugin.GetInstance().Dispose(); | |||
} | |||
} | |||
} |
@@ -50,13 +50,19 @@ | |||
<None Remove="Image\内部.png" /> | |||
<None Remove="Image\告警.png" /> | |||
<None Remove="Image\告警\Wifi_NO.ico" /> | |||
<None Remove="Image\告警\Wifi_NO.png" /> | |||
<None Remove="Image\告警\Wifi_OK.ico" /> | |||
<None Remove="Image\告警\Wifi_OK.png" /> | |||
<None Remove="Image\告警\严重告警.png" /> | |||
<None Remove="Image\告警\告警.png" /> | |||
<None Remove="Image\告警\成功0ecb74.png" /> | |||
<None Remove="Image\告警\报错.png" /> | |||
<None Remove="Image\告警\提醒359fda.png" /> | |||
<None Remove="Image\告警\无告警.png" /> | |||
<None Remove="Image\告警\无告警1.png" /> | |||
<None Remove="Image\告警\正常.png" /> | |||
<None Remove="Image\告警\消息.png" /> | |||
<None Remove="Image\告警\轻微告警.png" /> | |||
<None Remove="Image\告警\预警f44b4b.png" /> | |||
<None Remove="Image\图层1.png" /> | |||
<None Remove="Image\圆形.png" /> | |||
@@ -152,6 +158,12 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<Resource Include="Image\告警\Wifi_NO.png" /> | |||
<Resource Include="Image\告警\Wifi_OK.png" /> | |||
<Resource Include="Image\告警\严重告警.png" /> | |||
<Resource Include="Image\告警\无告警.png" /> | |||
<Resource Include="Image\告警\无告警1.png" /> | |||
<Resource Include="Image\告警\轻微告警.png" /> | |||
<Resource Include="Image\边角.png" /> | |||
</ItemGroup> | |||
@@ -823,11 +823,11 @@ | |||
</Style> | |||
<Style TargetType="{x:Type DataGridRow}"> | |||
<Setter Property="Background" Value="Transparent" /> | |||
<Setter Property="HorizontalContentAlignment" Value="Center" /> | |||
<Setter Property="SnapsToDevicePixels" Value="true" /> | |||
<Setter Property="Foreground" Value="#abf4ff" /> | |||
<Setter Property="FontSize" Value="12" /> | |||
<Setter Property="Background" Value="Transparent"/> | |||
<Setter Property="HorizontalContentAlignment" Value="Center"/> | |||
<Setter Property="SnapsToDevicePixels" Value="true"/> | |||
<Setter Property="Foreground" Value="#abf4ff"></Setter> | |||
<Setter Property="FontSize" Value="10"></Setter> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type DataGridRow}"> | |||
@@ -2234,24 +2234,12 @@ | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type CheckBox}"> | |||
<StackPanel | |||
Background="Transparent" | |||
Orientation="Horizontal" | |||
SnapsToDevicePixels="True"> | |||
<Image | |||
x:Name="image1" | |||
Width="12" | |||
Height="14" | |||
Source="/BPASmartClient.CustomResource;component/Image/Cb_HalfChecked.png" /> | |||
<ContentPresenter | |||
Margin="{TemplateBinding Padding}" | |||
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" | |||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" | |||
Content="{TemplateBinding Content}" | |||
ContentStringFormat="{TemplateBinding ContentStringFormat}" | |||
RecognizesAccessKey="True" | |||
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" /> | |||
<StackPanel Background="Transparent" SnapsToDevicePixels="True" Orientation="Horizontal"> | |||
<Grid> | |||
<Image Source="/BPASmartClient.CustomResource;component/Image/Cb_HalfChecked.png" Width="12" Height="14"></Image> | |||
<Image x:Name="image1" Source="/BPASmartClient.CustomResource;component/Image/Cb_HalfChecked.png" Width="12" Height="14"></Image> | |||
</Grid> | |||
<ContentPresenter Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> | |||
</StackPanel> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="HasContent" Value="True"> | |||
@@ -20,42 +20,23 @@ | |||
<!--#region ToggleButton--> | |||
<Style x:Key="StatusBtnStyle告警" TargetType="ToggleButton"> | |||
<Style.Setters> | |||
<Setter Property="Width" Value="36" /> | |||
<Setter Property="Height" Value="32" /> | |||
<Setter Property="Cursor" Value="Hand" /> | |||
<Setter Property="IsChecked" Value="{Binding IsCheck, Mode=TwoWay}" /> | |||
<Setter Property="Width" Value="30"></Setter> | |||
<Setter Property="Height" Value="19"></Setter> | |||
<Setter Property="Cursor" Value="Hand"></Setter> | |||
<Setter Property="IsChecked" Value="{Binding IsCheck,Mode=TwoWay}"></Setter> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="ToggleButton"> | |||
<Grid Cursor="Hand"> | |||
<Border | |||
x:Name="bd1" | |||
Width="25" | |||
Height="13" | |||
Margin="0,-5,-5,0" | |||
HorizontalAlignment="Right" | |||
VerticalAlignment="Top" | |||
Panel.ZIndex="100" | |||
Background="#33FF0000" | |||
CornerRadius="3" | |||
Cursor="Hand" | |||
Visibility="Collapsed"> | |||
<TextBlock | |||
HorizontalAlignment="Center" | |||
Foreground="#FF2AA7D3" | |||
Text="{Binding ListNum}" /> | |||
<Border x:Name="bd1" Cursor="Hand" Visibility="Collapsed" Width="25" Height="13" HorizontalAlignment="Right" Panel.ZIndex="100" VerticalAlignment="Top" Margin="0,-10,-5,0" CornerRadius="3" Background="#2600CAFF" > | |||
<TextBlock Text="{Binding ListNum}" Foreground="#FF00E6F7" HorizontalAlignment="Center" FontSize="8"></TextBlock> | |||
<!----> | |||
</Border> | |||
<Image | |||
x:Name="image1" | |||
Width="{TemplateBinding Width}" | |||
Height="{TemplateBinding Height}" | |||
Panel.ZIndex="0" | |||
Source="/BPASmartClient.CustomResource;component/Image/告警.png" | |||
Stretch="UniformToFill" /> | |||
<Image x:Name="image1" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" Source="/BPASmartClient.CustomResource;component/Image/告警/无告警.png" Panel.ZIndex="0" UseLayoutRounding="True" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="HighQuality" ></Image> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsChecked" Value="true"> | |||
<Setter TargetName="image1" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/有告警.png" /> | |||
<Setter TargetName="image1" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/告警/严重告警.png"></Setter> | |||
</Trigger> | |||
<MultiDataTrigger> | |||
<MultiDataTrigger.Conditions> | |||
@@ -63,8 +44,8 @@ | |||
<Condition Binding="{Binding IsAlarm}" Value="true" /> | |||
</MultiDataTrigger.Conditions> | |||
<MultiDataTrigger.Setters> | |||
<Setter TargetName="image1" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/有告警.png" /> | |||
<Setter TargetName="bd1" Property="Visibility" Value="Visible" /> | |||
<Setter TargetName="image1" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/告警/严重告警.png"></Setter> | |||
<Setter TargetName="bd1" Property="Visibility" Value="Visible"></Setter> | |||
</MultiDataTrigger.Setters> | |||
</MultiDataTrigger> | |||
</ControlTemplate.Triggers> | |||
@@ -84,16 +65,11 @@ | |||
<Setter.Value> | |||
<ControlTemplate TargetType="ToggleButton"> | |||
<Grid Cursor="Hand"> | |||
<Image | |||
x:Name="image1" | |||
Width="{TemplateBinding Width}" | |||
Height="{TemplateBinding Height}" | |||
Panel.ZIndex="0" | |||
Source="/BPASmartClient.CustomResource;component/Image/告警/Wifi_NO.ico" /> | |||
<Image x:Name="image1" Width="{TemplateBinding Width}" Height="{TemplateBinding Height}" Source="/BPASmartClient.CustomResource;component/Image/告警/Wifi_NO.png" Panel.ZIndex="0" UseLayoutRounding="True" SnapsToDevicePixels="True" RenderOptions.BitmapScalingMode="HighQuality"></Image> | |||
</Grid> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsChecked" Value="true"> | |||
<Setter TargetName="image1" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/告警/Wifi_OK.ico" /> | |||
<Setter TargetName="image1" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/告警/Wifi_OK.png"></Setter> | |||
</Trigger> | |||
<MultiDataTrigger> | |||
<MultiDataTrigger.Conditions> | |||
@@ -101,7 +77,7 @@ | |||
<Condition Binding="{Binding IsAlarm}" Value="true" /> | |||
</MultiDataTrigger.Conditions> | |||
<MultiDataTrigger.Setters> | |||
<Setter TargetName="image1" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/告警/Wifi_OK.ico" /> | |||
<Setter TargetName="image1" Property="Source" Value="/BPASmartClient.CustomResource;component/Image/告警/Wifi_OK.png"></Setter> | |||
</MultiDataTrigger.Setters> | |||
</MultiDataTrigger> | |||
</ControlTemplate.Triggers> | |||
@@ -111,8 +87,16 @@ | |||
</Style.Setters> | |||
</Style> | |||
<!--#endregion--> | |||
<!--#region Image --> | |||
<Style TargetType="Image"> | |||
<Style.Setters> | |||
<Setter Property="UseLayoutRounding" Value="True"></Setter> | |||
<Setter Property="SnapsToDevicePixels" Value="True"></Setter> | |||
<Setter Property="RenderOptions.BitmapScalingMode" Value="HighQuality"></Setter> | |||
</Style.Setters> | |||
</Style> | |||
<!--#region Image--> | |||
<Style x:Key="imagetop_L" TargetType="Image"> | |||
<Style.Setters> | |||
<Setter Property="Height" Value="80" /> | |||
@@ -740,6 +724,11 @@ | |||
<VisualState x:Name="Disabled" /> | |||
</VisualStateGroup> | |||
</VisualStateManager.VisualStateGroups> | |||
<StackPanel HorizontalAlignment="Center" Margin="5" Orientation="Horizontal"> | |||
<Image Source="/BPASmartClient.CustomResource;component/Image/退出.png" Width="16" ></Image> | |||
<TextBlock Margin="5,0,0,0" x:Name="textBlock" Text="{TemplateBinding Content}" FontSize="14" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Foreground="#A5FFFFFF" /> | |||
</StackPanel> | |||
</Border> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
@@ -0,0 +1,32 @@ | |||
<UserControl x:Class=" BPASmartClient.CustomResource.UserControls.DateTimeUI" | |||
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.CustomResource.UserControls" | |||
mc:Ignorable="d" | |||
d:DesignHeight="50" d:DesignWidth="100"> | |||
<UserControl.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml"/> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml"/> | |||
</ResourceDictionary.MergedDictionaries> | |||
</ResourceDictionary> | |||
</UserControl.Resources> | |||
<Grid> | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="30"></RowDefinition> | |||
<RowDefinition></RowDefinition> | |||
</Grid.RowDefinitions> | |||
<StackPanel Orientation="Horizontal" Grid.Row="0"> | |||
<TextBlock x:Name="time" FontSize="16">14:48:30</TextBlock> | |||
<Image Style="{DynamicResource timeImage}" Margin="10,0,0,0"></Image> | |||
</StackPanel> | |||
<StackPanel Grid.Row="1" Orientation="Horizontal"> | |||
<TextBlock x:Name="dateRL" FontSize="10">星期一</TextBlock> | |||
<TextBlock x:Name="date" Margin="10,0,0,0" FontSize="10">2021-11-13</TextBlock> | |||
</StackPanel> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,56 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading; | |||
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.UserControls | |||
{ | |||
/// <summary> | |||
/// DateTimeUI.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class DateTimeUI : UserControl | |||
{ | |||
public DateTimeUI() | |||
{ | |||
InitializeComponent(); | |||
Task.Run(new Action(() => | |||
{ | |||
while (true) | |||
{ | |||
this.Dispatcher.Invoke(new Action(() => | |||
{ | |||
time.Text = DateTime.Now.ToString("HH:mm:ss"); | |||
date.Text = DateTime.Now.ToString("yyyy-MM-dd"); | |||
if (DateTime.Now.DayOfWeek == DayOfWeek.Monday) | |||
dateRL.Text = "星期一"; | |||
else if (DateTime.Now.DayOfWeek == DayOfWeek.Tuesday) | |||
dateRL.Text = "星期二"; | |||
else if (DateTime.Now.DayOfWeek == DayOfWeek.Wednesday) | |||
dateRL.Text = "星期三"; | |||
else if (DateTime.Now.DayOfWeek == DayOfWeek.Thursday) | |||
dateRL.Text = "星期四"; | |||
else if (DateTime.Now.DayOfWeek == DayOfWeek.Friday) | |||
dateRL.Text = "星期五"; | |||
else if (DateTime.Now.DayOfWeek == DayOfWeek.Saturday) | |||
dateRL.Text = "星期六"; | |||
else if (DateTime.Now.DayOfWeek == DayOfWeek.Sunday) | |||
dateRL.Text = "星期天"; | |||
})); | |||
Thread.Sleep(500); | |||
} | |||
})); | |||
} | |||
} | |||
} |
@@ -11,6 +11,7 @@ | |||
</ItemGroup> | |||
<ItemGroup> | |||
<ProjectReference Include="..\BPASmartClient.Business\BPASmartClient.Business.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.Helper\BPASmartClient.Helper.csproj" /> | |||
<ProjectReference Include="..\BPASmartClient.Model\BPASmartClient.Model.csproj" /> | |||
</ItemGroup> | |||
@@ -1,9 +1,18 @@ | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using BPASmartClient.Message; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using Microsoft.Win32; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Diagnostics; | |||
using System.IO; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows; | |||
using System.Windows.Media; | |||
using System.Windows.Threading; | |||
namespace BPASmartClient.ViewModel | |||
{ | |||
@@ -12,9 +21,231 @@ namespace BPASmartClient.ViewModel | |||
/// </summary> | |||
public class LogViewModel :ObservableObject | |||
{ | |||
public DispatcherTimer dispatcherTimer; | |||
private ObservableCollection<LogModel> _LogModels; | |||
public ObservableCollection<LogModel> LogDataGrid | |||
{ | |||
get | |||
{ | |||
return _LogModels; | |||
} | |||
set | |||
{ | |||
if (_LogModels == value) | |||
return; | |||
_LogModels = value; | |||
OnPropertyChanged("LogDataGrid"); | |||
} | |||
} | |||
public LogViewModel() | |||
{ | |||
LogDataGrid = new ObservableCollection<LogModel>(); | |||
MessageLog.GetInstance.InfoNotify = new Action<string>((s) => | |||
{ | |||
System.Windows.Application.Current.Dispatcher.Invoke((Action)(() => | |||
{ | |||
LogDataGrid.Insert(0,new LogModel { message = s,type = "Info" }); | |||
})); | |||
}); | |||
MessageLog.GetInstance.ExInfoNotify = new Action<string>((s) => | |||
{ | |||
System.Windows.Application.Current.Dispatcher.Invoke((Action)(() => | |||
{ | |||
LogDataGrid.Insert(0,new LogModel { message = s,type = "Error" }); | |||
})); | |||
}); | |||
ExcelCommand = new RelayCommand(() => | |||
{ | |||
ExcellOrder(); | |||
}); | |||
//dispatcherTimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1) };//1秒一流转 | |||
//dispatcherTimer.Tick += delegate | |||
//{ | |||
// if (TimedClear) | |||
// { | |||
// } | |||
//}; | |||
//dispatcherTimer.Start(); | |||
} | |||
/// <summary> | |||
/// 导出数据 | |||
/// </summary> | |||
public void ExcellOrder() | |||
{ | |||
if (LogDataGrid.Count > 0) | |||
{ | |||
string text = "时间 类型 日志内容\n"; | |||
LogDataGrid?.ToList().ForEach(temp => | |||
{ | |||
text = text + temp.time + " " + temp.type + " " + temp.message+ "\n"; | |||
}); | |||
SaveFileDialog openfile = new SaveFileDialog(); | |||
openfile.Filter = "Txt文件(*.txt)|*.txt"; | |||
if (openfile.ShowDialog() == false) | |||
{ | |||
return; | |||
} | |||
string path = openfile.FileName; | |||
if (!System.IO.File.Exists(path)) | |||
{ | |||
//没有则创建这个文件 | |||
FileStream fs1 = new FileStream(path,FileMode.Create,FileAccess.Write);//创建写入文件 | |||
StreamWriter sw = new StreamWriter(fs1); | |||
sw.WriteLine(text);//开始写入值 | |||
sw.Close(); | |||
fs1.Close(); | |||
} | |||
else | |||
{ | |||
FileStream fs = new FileStream(path,FileMode.Open,FileAccess.Write); | |||
StreamWriter sr = new StreamWriter(fs); | |||
sr.WriteLine(text);//开始写入值 | |||
sr.Close(); | |||
fs.Close(); | |||
} | |||
string msg = string.Format("记录导出完成,共导出记录{0}条,是否打开!",LogDataGrid.Count); | |||
if (System.Windows.MessageBox.Show(msg,"提示",MessageBoxButton.OKCancel) == MessageBoxResult.OK) | |||
{ | |||
OpenFile(openfile.FileName); | |||
} | |||
} | |||
else | |||
System.Windows.MessageBox.Show("无数据!"); | |||
} | |||
/// <summary> | |||
/// 打开指定路径下文件,比如:Word、Excel、Dll、图片等都可以(前提是你已经安装打开程序的对应软件) | |||
/// </summary> | |||
/// <param name="NewFileName">eg:D:\Test\模版8.doc</param> | |||
/// <param name="NewFileName">eg:D:\Test\模版8.doc</param> | |||
private void OpenFile(string NewFileName) | |||
{ | |||
Process process = new Process(); | |||
ProcessStartInfo processStartInfo = new ProcessStartInfo(NewFileName); | |||
process.StartInfo = processStartInfo; | |||
#region 下面这段被注释掉代码(可以用来全屏打开代码) | |||
//建立新的系统进程 | |||
////System.Diagnostics.Process process = new System.Diagnostics.Process(); | |||
//设置文件名,此处为图片的真实路径 + 文件名(需要有后缀) | |||
////process.StartInfo.FileName = NewFileName; | |||
//此为关键部分。设置进程运行参数,此时为最大化窗口显示图片。 | |||
////process.StartInfo.Arguments = "rundll32.exe C://WINDOWS//system32//shimgvw.dll,ImageView_Fullscreen"; | |||
// 此项为是否使用Shell执行程序,因系统默认为true,此项也可不设,但若设置必须为true | |||
process.StartInfo.UseShellExecute = true; | |||
#endregion | |||
try | |||
{ | |||
process.Start(); | |||
try | |||
{ | |||
// process.WaitForExit(); | |||
} | |||
catch (Exception ex) | |||
{ | |||
throw ex; | |||
} | |||
} | |||
catch (Exception ex) | |||
{ | |||
throw ex; | |||
} | |||
finally | |||
{ | |||
try | |||
{ | |||
if (process != null) | |||
{ | |||
process.Close(); | |||
process = null; | |||
} | |||
} | |||
catch { } | |||
} | |||
} | |||
private bool _RealTimeModel = true; | |||
public bool RealTimeModel | |||
{ | |||
get | |||
{ | |||
return _RealTimeModel; | |||
} | |||
set | |||
{ | |||
if (_RealTimeModel == value) | |||
return; | |||
_RealTimeModel = value; | |||
OnPropertyChanged("RealTimeModel"); | |||
} | |||
} | |||
private bool _TimedClear = true; | |||
public bool TimedClear | |||
{ | |||
get | |||
{ | |||
return _TimedClear; | |||
} | |||
set | |||
{ | |||
if (_TimedClear == value) | |||
return; | |||
_TimedClear = value; | |||
OnPropertyChanged("TimedClear"); | |||
} | |||
} | |||
public RelayCommand ExcelCommand { get; set; } | |||
} | |||
public class LogModel :ObservableObject | |||
{ | |||
public string time { get; set; } | |||
private string _type; | |||
public string type | |||
{ | |||
get | |||
{ | |||
return _type; | |||
} | |||
set | |||
{ | |||
if (_type == value) | |||
return; | |||
_type = value; | |||
if(_type== "Error") foreground = new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#ed0032")); | |||
OnPropertyChanged("type"); | |||
} | |||
} | |||
public string message { get; set; } | |||
private Brush _foreground; | |||
public Brush foreground | |||
{ | |||
get | |||
{ | |||
return _foreground; | |||
} | |||
set | |||
{ | |||
if (_foreground == value) | |||
return; | |||
_foreground = value; | |||
OnPropertyChanged("foreground"); | |||
} | |||
} | |||
public LogModel() | |||
{ | |||
foreground=new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#21bb2e")); | |||
time =DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); | |||
} | |||
} | |||
} |
@@ -1,4 +1,5 @@ | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using BPASmartClient.Business; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using System; | |||
using System.Collections.Generic; | |||
@@ -20,6 +21,5 @@ namespace BPASmartClient.ViewModel | |||
{ | |||
} | |||
} | |||
} |
@@ -4,7 +4,7 @@ | |||
<!--通用配置--> | |||
<!--测试服务 Consul 地址--> | |||
<add key="ConsulAddress" value="http://111.9.47.105:9011/" /> | |||
<!--<add key="ConsulAddress" value="http://111.9.47.105:9011/" />--> | |||
<!--正式服务 Consul 地址--> | |||
<!--<add key="ConsulAddress" value="http://162.14.105.138:9005" />--> | |||
@@ -10,7 +10,8 @@ | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecCheckBox.xaml" /> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/RecDictionarys/RecTitleBarButton.xaml" /> | |||
<!--<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml"/> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml"/>--> | |||
<ResourceDictionary> | |||
<con:ColorConverter x:Key="ColorConverter" /> | |||
@@ -0,0 +1,103 @@ | |||
<UserControl x:Class="BPASmartClient.Control.LogOrAlarmView" | |||
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.Control" | |||
mc:Ignorable="d" | |||
d:DesignHeight="450" d:DesignWidth="800"> | |||
<UserControl.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml"/> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml"/> | |||
</ResourceDictionary.MergedDictionaries> | |||
</ResourceDictionary> | |||
</UserControl.Resources> | |||
<!--底部窗体栏--> | |||
<Grid > | |||
<Grid.RowDefinitions> | |||
<RowDefinition Height="45"/> | |||
<RowDefinition/> | |||
</Grid.RowDefinitions> | |||
<!--查询按钮栏--> | |||
<StackPanel Orientation="Horizontal" Margin="10,0,10,0"> | |||
<ComboBox SelectedIndex="0" Width="80"> | |||
<ComboBoxItem>一般日志</ComboBoxItem> | |||
<ComboBoxItem>错误日志</ComboBoxItem> | |||
<ComboBoxItem>告警信息</ComboBoxItem> | |||
</ComboBox> | |||
<Button Margin="10,0,0,0">查询</Button> | |||
<Button Margin="10,0,0,0">导出</Button> | |||
<CheckBox Margin="10,0,0,0" IsChecked="True">实时模式</CheckBox> | |||
<CheckBox Margin="10,0,0,0" IsChecked="True">定时清除</CheckBox> | |||
</StackPanel> | |||
<!--表格栏--> | |||
<Grid Grid.Row="1"> | |||
<DataGrid x:Name="datagrid" Margin="10" ItemsSource="{Binding EquiPment1, UpdateSourceTrigger=PropertyChanged}" Grid.Row="2"> | |||
<DataGrid.Columns> | |||
<DataGridTemplateColumn Header="紧急程度" Width="2*"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<Ellipse Width="12" Height="12" ToolTip="{Binding Status, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Fill="{Binding color, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="报警时间或恢复时间" Width="4.4*"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBlock HorizontalAlignment="Center" Text="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Foreground="#00ccff"/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="类型" Width="4.4*"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBlock HorizontalAlignment="Center" Text="{Binding Status, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Foreground="#00ccff"/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="状态" Width="4.4*"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBlock HorizontalAlignment="Center" Text="{Binding Status, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Foreground="#00ccff"/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="变量名" Width="4.4*"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBlock HorizontalAlignment="Center" Text="{Binding Status, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Foreground="#00ccff"/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="报警值或恢复值" Width="4.4*"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBlock HorizontalAlignment="Center" Text="{Binding Status, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Foreground="#00ccff"/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="参考值" Width="4.4*"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBlock HorizontalAlignment="Center" Text="{Binding Status, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Foreground="#00ccff"/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="操作" Width="2*"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBlock HorizontalAlignment="Center" Text="{Binding Status, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Foreground="#00ccff"/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
</DataGrid.Columns> | |||
</DataGrid> | |||
</Grid> | |||
</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.Control | |||
{ | |||
/// <summary> | |||
/// LogOrAlarmView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class LogOrAlarmView :UserControl | |||
{ | |||
public LogOrAlarmView() | |||
{ | |||
InitializeComponent(); | |||
} | |||
} | |||
} |
@@ -27,76 +27,34 @@ | |||
<!--查询按钮栏--> | |||
<StackPanel Orientation="Horizontal" Margin="10,0,10,0"> | |||
<ComboBox SelectedIndex="0" Width="80"> | |||
<ComboBoxItem>一般日志</ComboBoxItem> | |||
<ComboBoxItem>错误日志</ComboBoxItem> | |||
<ComboBoxItem>告警信息</ComboBoxItem> | |||
</ComboBox> | |||
<Button Margin="10,0,0,0">查询</Button> | |||
<Button Margin="10,0,0,0">导出</Button> | |||
<CheckBox Margin="10,0,0,0" IsChecked="True">实时模式</CheckBox> | |||
<CheckBox Margin="10,0,0,0" IsChecked="True">定时清除</CheckBox> | |||
<CheckBox Margin="10,0,0,0" IsChecked="{Binding RealTimeModel, UpdateSourceTrigger=PropertyChanged}" >实时模式</CheckBox> | |||
<CheckBox Margin="10,0,0,0" IsChecked="{Binding TimedClear, UpdateSourceTrigger=PropertyChanged}">定时清除</CheckBox> | |||
<Button Margin="10,0,0,0" Cursor="Hand" Command="{Binding ExcelCommand}">导出</Button> | |||
</StackPanel> | |||
<!--表格栏--> | |||
<Grid Grid.Row="1"> | |||
<DataGrid x:Name="datagrid" Margin="10" ItemsSource="{Binding EquiPment1, UpdateSourceTrigger=PropertyChanged}" Grid.Row="2"> | |||
<DataGrid Margin="10" ItemsSource="{Binding LogDataGrid, UpdateSourceTrigger=PropertyChanged}" Grid.Row="2"> | |||
<DataGrid.Columns> | |||
<DataGridTemplateColumn Header="紧急程度" Width="2*"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<Ellipse Width="12" Height="12" ToolTip="{Binding Status, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Fill="{Binding color, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="报警时间或恢复时间" Width="4.4*"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBlock HorizontalAlignment="Center" Text="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Foreground="#00ccff"/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="类型" Width="4.4*"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBlock HorizontalAlignment="Center" Text="{Binding Status, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Foreground="#00ccff"/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="状态" Width="4.4*"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBlock HorizontalAlignment="Center" Text="{Binding Status, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Foreground="#00ccff"/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="变量名" Width="4.4*"> | |||
<DataGridTemplateColumn Header="日志时间" Width="300"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBlock HorizontalAlignment="Center" Text="{Binding Status, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Foreground="#00ccff"/> | |||
<TextBlock HorizontalAlignment="Center" Text="{Binding time, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="14" Foreground="{Binding foreground, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="报警值或恢复值" Width="4.4*"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBlock HorizontalAlignment="Center" Text="{Binding Status, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Foreground="#00ccff"/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="参考值" Width="4.4*"> | |||
<DataGridTemplateColumn Header="日志类型" Width="300"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBlock HorizontalAlignment="Center" Text="{Binding Status, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Foreground="#00ccff"/> | |||
<TextBlock HorizontalAlignment="Center" Text="{Binding type, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="14" Foreground="{Binding foreground, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="操作" Width="2*"> | |||
<DataGridTemplateColumn Header="日志内容" Width="*"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBlock HorizontalAlignment="Center" Text="{Binding Status, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Foreground="#00ccff"/> | |||
<TextBlock HorizontalAlignment="Center" Text="{Binding message, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="14" Foreground="{Binding foreground, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
@@ -24,10 +24,5 @@ namespace BPASmartClient.Control | |||
{ | |||
InitializeComponent(); | |||
} | |||
private void Button_Click(object sender,RoutedEventArgs e) | |||
{ | |||
} | |||
} | |||
} |
@@ -1,21 +1,19 @@ | |||
<Window | |||
x:Class="BPASmartClient.MainWindow" | |||
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" | |||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
xmlns:vm="clr-namespace:BPASmartClient.ViewModel;assembly=BPASmartClient.ViewModel" | |||
Title="MainWindow" | |||
Width="1600" | |||
Height="900" | |||
AllowsTransparency="True" | |||
Background="{x:Null}" | |||
Topmost="False" | |||
WindowStartupLocation="CenterScreen" | |||
WindowStyle="None" | |||
mc:Ignorable="d"> | |||
<Window x:Class="BPASmartClient.MainWindow" | |||
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" | |||
xmlns:vm="clr-namespace:BPASmartClient.ViewModel;assembly=BPASmartClient.ViewModel" | |||
xmlns:pry="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource" | |||
Title="MainWindow" Width="1600" | |||
Height="900" | |||
AllowsTransparency="True" | |||
Background="{x:Null}" | |||
Topmost="False" | |||
WindowStartupLocation="CenterScreen" | |||
WindowStyle="None" | |||
mc:Ignorable="d"> | |||
<Window.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
@@ -41,6 +39,9 @@ | |||
<ColumnDefinition Width="300" /> | |||
<ColumnDefinition /> | |||
</Grid.ColumnDefinitions> | |||
<Border Grid.ColumnSpan="2" Style="{DynamicResource bordertop矩形}"></Border> | |||
<Border Style="{DynamicResource bordertopL}"></Border> | |||
<Image Margin="20,0,0,0" VerticalAlignment="Center" Style="{DynamicResource imagetop_Title}" ></Image> | |||
<Border Grid.ColumnSpan="2" Style="{DynamicResource bordertop矩形}" /> | |||
<Border Style="{DynamicResource bordertopL}" /> | |||
<Image | |||
@@ -79,6 +80,17 @@ | |||
FontSize="12" | |||
Header="IOT监视" | |||
Tag="RealTimeDataControl" /> | |||
<Menu > | |||
<MenuItem Header="状态监视" > | |||
<MenuItem Header="日志监视" FontSize="12" Click="MenuItem_Click" Tag="LogView" /> | |||
<Separator/> | |||
<MenuItem Header="订单监视" FontSize="12" Click="MenuItem_Click" Tag="OrderStatusView" /> | |||
<Separator/> | |||
<MenuItem Header="设备监视" FontSize="12" Click="MenuItem_Click" Tag="RealTimeDataControl" /> | |||
<Separator/> | |||
<MenuItem Header="告警监视" FontSize="12" Click="MenuItem_Click" Tag="RealTimeDataControl" /> | |||
<Separator/> | |||
<MenuItem Header="IOT监视" FontSize="12" Click="MenuItem_Click" Tag="RealTimeDataControl" /> | |||
</MenuItem> | |||
<MenuItem Header="综合查询"> | |||
<MenuItem | |||
@@ -169,6 +181,7 @@ | |||
DataContext="{Binding GaoJingMessage}" | |||
Style="{DynamicResource StatusBtnStyle网络连接状态}" | |||
ToolTip="网络连接状态" /> | |||
<ToggleButton Margin="5" VerticalAlignment="Center" ToolTip="网络连接状态" HorizontalAlignment="Center" Style="{DynamicResource StatusBtnStyle网络连接状态}" IsChecked="True" DataContext="{Binding GaoJingMessage}" Cursor="Hand"/> | |||
<Border Style="{DynamicResource border竖线}" /> | |||
<ToggleButton | |||
HorizontalAlignment="Center" | |||
@@ -200,6 +213,7 @@ | |||
</TextBlock> | |||
</StackPanel> | |||
</Grid> | |||
<control:DateTimeUI Margin="10,0,10,0" VerticalAlignment="Center"></control:DateTimeUI> | |||
<Border Style="{DynamicResource border竖线}" /> | |||
<Button | |||
x:Name="ButClose" | |||
@@ -210,6 +224,7 @@ | |||
Cursor="Hand" | |||
Style="{DynamicResource CommonBtnStyle退出按钮}" | |||
ToolTip="退出程序" /> | |||
<Button x:Name="ButClose" Grid.Column="4" Margin="10,0,20,0" Style="{DynamicResource CommonBtn_返回}" VerticalAlignment="Center" ToolTip="退出程序" Cursor="Hand" Content="退出"/> | |||
</StackPanel> | |||
</Grid> | |||
@@ -252,6 +267,9 @@ | |||
Foreground="#feffff"> | |||
日志监控界面 | |||
</TextBlock> | |||
<Border Style="{DynamicResource borderFromTitle}" Width="600"></Border> | |||
<Button Grid.Row="0" Content="返回" Style="{DynamicResource CommonBtn_返回}" HorizontalAlignment="Left" VerticalAlignment="Top" Click="Button_Click" Cursor="Hand"/> | |||
<TextBlock x:Name="Title" HorizontalAlignment="Center" FontSize="18" Foreground="#feffff">日志监控界面</TextBlock> | |||
</Grid> | |||
<!--#region 底部窗体栏--> | |||