@@ -527,7 +527,7 @@ | |||
<Setter Property="HorizontalContentAlignment" Value="Center"/> | |||
<Setter Property="SnapsToDevicePixels" Value="true"/> | |||
<Setter Property="Foreground" Value="#abf4ff"></Setter> | |||
<Setter Property="FontSize" Value="12"></Setter> | |||
<Setter Property="FontSize" Value="10"></Setter> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type DataGridRow}"> | |||
@@ -699,7 +699,7 @@ | |||
</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}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Foreground="#A5FFFFFF" /> | |||
<TextBlock Margin="5,0,0,0" x:Name="textBlock" Text="{TemplateBinding Content}" FontSize="16" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Foreground="#A5FFFFFF" /> | |||
</StackPanel> | |||
</Border> | |||
@@ -1,9 +1,13 @@ | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using BPASmartClient.Message; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using Microsoft.Toolkit.Mvvm.Input; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
using System.Windows.Media; | |||
namespace BPASmartClient.ViewModel | |||
{ | |||
@@ -12,9 +16,93 @@ namespace BPASmartClient.ViewModel | |||
/// </summary> | |||
public class LogViewModel :ObservableObject | |||
{ | |||
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 = "一般日志" }); | |||
})); | |||
}); | |||
MessageLog.GetInstance.ExInfoNotify = new Action<string>((s) => | |||
{ | |||
System.Windows.Application.Current.Dispatcher.Invoke((Action)(() => | |||
{ | |||
LogDataGrid.Insert(0,new LogModel { message = s,type = "错误日志" }); | |||
})); | |||
}); | |||
ExcelCommand = new RelayCommand(() => | |||
{ | |||
}); | |||
} | |||
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== "错误日志") 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"); | |||
} | |||
} | |||
} |
@@ -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,95 @@ | |||
<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"> | |||
<!--底部窗体栏--> | |||
<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(); | |||
} | |||
} | |||
} |
@@ -7,14 +7,6 @@ | |||
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> | |||
<UserControl.DataContext> | |||
<vm:LogViewModel></vm:LogViewModel> | |||
</UserControl.DataContext> | |||
@@ -27,76 +19,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> | |||
<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) | |||
{ | |||
} | |||
} | |||
} |
@@ -14,14 +14,7 @@ | |||
WindowStartupLocation="CenterScreen" | |||
WindowStyle="None" | |||
mc:Ignorable="d"> | |||
<Window.Resources> | |||
<ResourceDictionary> | |||
<ResourceDictionary.MergedDictionaries> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/GenricStyle.xaml"/> | |||
<ResourceDictionary Source="/BPASmartClient.CustomResource;component/Themes/MyStyle.xaml"/> | |||
</ResourceDictionary.MergedDictionaries> | |||
</ResourceDictionary> | |||
</Window.Resources> | |||
<Window.DataContext> | |||
<vm:MainViewModel></vm:MainViewModel> | |||
</Window.DataContext> | |||
@@ -107,7 +100,7 @@ | |||
</StackPanel> | |||
</Grid> | |||
<Border Style="{DynamicResource border竖线}" /> | |||
<Button x:Name="ButClose" Grid.Column="4" Margin="10,0,20,0" Style="{DynamicResource CommonBtnStyle退出按钮}" VerticalAlignment="Center" ToolTip="退出程序" Cursor="Hand" Content="退出"/> | |||
<Button x:Name="ButClose" Grid.Column="4" Margin="10,0,20,0" Style="{DynamicResource CommonBtnStyle退出按钮}" VerticalAlignment="Center" ToolTip="退出程序" Cursor="Hand" Content="退出"/> | |||
</StackPanel> | |||
</Grid> | |||