@@ -123,6 +123,52 @@ | |||
</Setter.Value> | |||
</Setter> | |||
</Style> | |||
<SolidColorBrush x:Key="TextBox.Static.Border" Color="#FFABAdB3"/> | |||
<SolidColorBrush x:Key="TextBox.MouseOver.Border" Color="#FF7EB4EA"/> | |||
<SolidColorBrush x:Key="TextBox.Focus.Border" Color="#FF569DE5"/> | |||
<Style TargetType="{x:Type PasswordBox}"> | |||
<Setter Property="PasswordChar" Value="●"/> | |||
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/> | |||
<Setter Property="BorderBrush" Value="{StaticResource TextBox.Static.Border}"/> | |||
<Setter Property="Foreground" Value="#FF02C9FD"/> | |||
<Setter Property="BorderThickness" Value="1"/> | |||
<Setter Property="KeyboardNavigation.TabNavigation" Value="None"/> | |||
<Setter Property="HorizontalContentAlignment" Value="Left"/> | |||
<Setter Property="FocusVisualStyle" Value="{x:Null}"/> | |||
<Setter Property="AllowDrop" Value="true"/> | |||
<Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/> | |||
<Setter Property="Stylus.IsFlicksEnabled" Value="False"/> | |||
<Setter Property="CaretBrush" Value="White" /> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
<ControlTemplate TargetType="{x:Type PasswordBox}"> | |||
<Border x:Name="border" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True" BorderBrush="#FF08335F"> | |||
<ScrollViewer x:Name="PART_ContentHost" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/> | |||
</Border> | |||
<ControlTemplate.Triggers> | |||
<Trigger Property="IsEnabled" Value="false"> | |||
<Setter Property="Opacity" TargetName="border" Value="0.56"/> | |||
</Trigger> | |||
<Trigger Property="IsMouseOver" Value="true"> | |||
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource TextBox.MouseOver.Border}"/> | |||
</Trigger> | |||
<Trigger Property="IsKeyboardFocused" Value="true"> | |||
<Setter Property="BorderBrush" TargetName="border" Value="{StaticResource TextBox.Focus.Border}"/> | |||
</Trigger> | |||
</ControlTemplate.Triggers> | |||
</ControlTemplate> | |||
</Setter.Value> | |||
</Setter> | |||
<Style.Triggers> | |||
<MultiTrigger> | |||
<MultiTrigger.Conditions> | |||
<Condition Property="IsInactiveSelectionHighlightEnabled" Value="true"/> | |||
<Condition Property="IsSelectionActive" Value="false"/> | |||
</MultiTrigger.Conditions> | |||
<Setter Property="SelectionBrush" Value="{DynamicResource {x:Static SystemColors.InactiveSelectionHighlightBrushKey}}"/> | |||
</MultiTrigger> | |||
</Style.Triggers> | |||
</Style> | |||
<Style x:Key="ExpanderUpHeaderStyle" TargetType="{x:Type ToggleButton}"> | |||
<Setter Property="Template"> | |||
<Setter.Value> | |||
@@ -60,12 +60,13 @@ namespace BPASmartClient.Device | |||
List<DevStatus> StatusALL = new List<DevStatus>(); | |||
foreach (var item in status) | |||
{ | |||
string sta = string.Empty; | |||
string name = item.Key; | |||
string Ms = string.Empty; | |||
string id = string.Empty; | |||
if (item.Key.Contains(".")) | |||
{ | |||
string sta = item.Key.Split('.')[0]; | |||
sta = item.Key.Split('.')[0]; | |||
string sop = item.Key.Split('.')[item.Key.Split('.').Length - 1]; name = sop; | |||
string value = item.Value.ToString(); | |||
if (keyValues.ContainsKey(sta)) sta = keyValues[sta]; | |||
@@ -75,8 +76,9 @@ namespace BPASmartClient.Device | |||
Ms = $"[{sta}]-[{sop}]-[{value}]"; | |||
id = $"[{sta}]-[{sop}]"; | |||
} | |||
StatusALL.Add(new DevStatus { id = id, Name = name, Status = item.Value.ToString(), Ms = Ms }); | |||
StatusALL.Add(new DevStatus { id = id, Name = name, type = sta, Status = item.Value.ToString(), Ms = Ms }); | |||
} | |||
StatusALL = StatusALL?.OrderBy(x => x.type).ToList(); | |||
return new { data = StatusALL }; | |||
} | |||
@@ -88,9 +90,10 @@ namespace BPASmartClient.Device | |||
string name = item.Key; | |||
string Ms = string.Empty; | |||
string id=string.Empty; | |||
string sta=string.Empty; | |||
if (item.Key.Contains(".")) | |||
{ | |||
string sta = item.Key.Split('.')[0]; | |||
sta = item.Key.Split('.')[0]; | |||
string sop = item.Key.Split('.')[item.Key.Split('.').Length - 1]; name = sop; | |||
string value = item.Value.ToString(); | |||
if (keyValues.ContainsKey(sta)) sta = keyValues[sta]; | |||
@@ -100,14 +103,16 @@ namespace BPASmartClient.Device | |||
Ms = $"[{sta}]-[{sop}]-[{value}]"; | |||
id= $"[{sta}]-[{sop}]"; | |||
} | |||
StatusALL.Add(new DevStatus {id= id, Name = name, Status = item.Value.ToString(), Ms = Ms }); | |||
StatusALL.Add(new DevStatus {id= id, Name = name,type=sta, Status = item.Value.ToString(), Ms = Ms }); | |||
} | |||
StatusALL = StatusALL?.OrderBy(x => x.type).ToList(); | |||
return StatusALL; | |||
} | |||
} | |||
public class DevStatus | |||
{ | |||
public string type { get; set; } | |||
public string id { get; set; } | |||
public string Name { get; set; } | |||
private string _status { get; set; } | |||
@@ -0,0 +1,80 @@ | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.Helper | |||
{ | |||
/// <summary> | |||
/// 创建AES加密解密 add fyf 20211122 | |||
/// </summary> | |||
public class AESHelper | |||
{ | |||
/// <summary> | |||
/// 默认密钥-密钥的长度必须是32 | |||
/// </summary> | |||
private const string PublicKey = "9848461354184618"; | |||
/// <summary> | |||
/// 默认向量 | |||
/// </summary> | |||
private const string Iv = "dfkladnasldnfdcv"; | |||
/// <summary> | |||
/// AES加密 | |||
/// </summary> | |||
/// <param name="str">需要加密字符串</param> | |||
/// <returns>加密后字符串</returns> | |||
public static String Encrypt(string str) | |||
{ | |||
return Encrypt(str, PublicKey); | |||
} | |||
/// <summary> | |||
/// AES解密 | |||
/// </summary> | |||
/// <param name="str">需要解密字符串</param> | |||
/// <returns>解密后字符串</returns> | |||
public static String Decrypt(string str) | |||
{ | |||
return Decrypt(str, PublicKey); | |||
} | |||
/// <summary> | |||
/// AES加密 | |||
/// </summary> | |||
/// <param name="str">需要加密的字符串</param> | |||
/// <param name="key">32位密钥</param> | |||
/// <returns>加密后的字符串</returns> | |||
public static string Encrypt(string str, string key) | |||
{ | |||
Byte[] keyArray = System.Text.Encoding.UTF8.GetBytes(key); | |||
Byte[] toEncryptArray = System.Text.Encoding.UTF8.GetBytes(str); | |||
var rijndael = new System.Security.Cryptography.RijndaelManaged(); | |||
rijndael.Key = keyArray; | |||
rijndael.Mode = System.Security.Cryptography.CipherMode.ECB; | |||
rijndael.Padding = System.Security.Cryptography.PaddingMode.PKCS7; | |||
rijndael.IV = System.Text.Encoding.UTF8.GetBytes(Iv); | |||
System.Security.Cryptography.ICryptoTransform cTransform = rijndael.CreateEncryptor(); | |||
Byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length); | |||
return Convert.ToBase64String(resultArray, 0, resultArray.Length); | |||
} | |||
/// <summary> | |||
/// AES解密 | |||
/// </summary> | |||
/// <param name="str">需要解密的字符串</param> | |||
/// <param name="key">32位密钥</param> | |||
/// <returns>解密后的字符串</returns> | |||
public static string Decrypt(string str, string key) | |||
{ | |||
Byte[] keyArray = System.Text.Encoding.UTF8.GetBytes(key); | |||
Byte[] toEncryptArray = Convert.FromBase64String(str); | |||
var rijndael = new System.Security.Cryptography.RijndaelManaged(); | |||
rijndael.Key = keyArray; | |||
rijndael.Mode = System.Security.Cryptography.CipherMode.ECB; | |||
rijndael.Padding = System.Security.Cryptography.PaddingMode.PKCS7; | |||
rijndael.IV = System.Text.Encoding.UTF8.GetBytes(Iv); | |||
System.Security.Cryptography.ICryptoTransform cTransform = rijndael.CreateDecryptor(); | |||
Byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length); | |||
return System.Text.Encoding.UTF8.GetString(resultArray); | |||
} | |||
} | |||
} |
@@ -0,0 +1,189 @@ | |||
| |||
using BPASmartClient.Helper; | |||
using BPASmartClient.IoT; | |||
using DataVAPI.Tool.IOT; | |||
using Microsoft.Toolkit.Mvvm.ComponentModel; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.Collections.ObjectModel; | |||
using System.Linq; | |||
using System.Text; | |||
using System.Threading.Tasks; | |||
namespace BPASmartClient.ViewModel | |||
{ | |||
public class DataVViewModel : ObservableObject | |||
{ | |||
#region 单一变量 | |||
private volatile static DataVViewModel _Instance; | |||
public static DataVViewModel GetInstance() => _Instance ?? (_Instance = new DataVViewModel()); | |||
private DataVViewModel() | |||
{ | |||
deviceTable = new ObservableCollection<DeviceTable>(); | |||
device = new DeviceTable(); | |||
deviceTableSelectedItem = new DeviceTable(); | |||
ApiURL = System.Configuration.ConfigurationManager.AppSettings["DataVServiceUri"].ToString(); | |||
Refresh(); | |||
} | |||
#endregion | |||
#region 公有变量 | |||
/// <summary> | |||
/// 设备表 | |||
/// </summary> | |||
public ObservableCollection<DeviceTable> deviceTable { get; set; } | |||
/// <summary> | |||
/// 选中行 | |||
/// </summary> | |||
private DeviceTable _deviceTableSelectedItem; | |||
public DeviceTable deviceTableSelectedItem | |||
{ | |||
get { return _deviceTableSelectedItem; } | |||
set | |||
{ | |||
if (_deviceTableSelectedItem == value) | |||
return; | |||
_deviceTableSelectedItem = value; | |||
OnPropertyChanged("deviceTableSelectedItem"); | |||
} | |||
} | |||
/// <summary> | |||
/// 当前设备 | |||
/// </summary> | |||
private DeviceTable _device; | |||
public DeviceTable device | |||
{ | |||
get { return _device; } | |||
set | |||
{ | |||
if (_device == value) | |||
return; | |||
_device = value; | |||
OnPropertyChanged("device"); | |||
} | |||
} | |||
/// <summary> | |||
/// API 地址 | |||
/// </summary> | |||
public string ApiURL { get; set; } | |||
#endregion | |||
#region 公有函数 | |||
/// <summary> | |||
/// 刷新 | |||
/// </summary> | |||
public void Refresh() | |||
{ | |||
deviceTable.Clear(); | |||
Inquire()?.OrderBy(o => int.Parse(o.ClientId)).ToList().ForEach(d => | |||
{ | |||
if (int.Parse(d.ClientId) > 0) | |||
{ | |||
deviceTable.Add(d); | |||
} | |||
}); | |||
} | |||
/// <summary> | |||
/// 根据客户端iD查询 | |||
/// </summary> | |||
/// <param name="clientId"></param> | |||
public List<DeviceTable> Inquire(string clientId = "") | |||
{ | |||
try | |||
{ | |||
string url = ApiURL + "/api/Device/Query"; | |||
if (!string.IsNullOrEmpty(clientId)) url = ApiURL + "/api/Device/Query?clientId=" + clientId; | |||
string json = HttpRequestHelper.HttpGetRequest(url); | |||
JsonMsg<List<DeviceTable>> jsonMsg = Tools.JsonToObjectTools<JsonMsg<List<DeviceTable>>>(json); | |||
return jsonMsg.obj.data; | |||
} | |||
catch (Exception ex) | |||
{ | |||
return null; | |||
} | |||
} | |||
/// <summary> | |||
/// 修改 | |||
/// </summary> | |||
/// <returns></returns> | |||
public bool Update() | |||
{ | |||
try | |||
{ | |||
string url = ApiURL + "/api/Device/Modify"; | |||
string json = HttpRequestHelper.HttpPostRequest(url, Tools.JsonConvertTools(device)); | |||
Refresh(); | |||
return true; | |||
} | |||
catch (Exception ex) | |||
{ | |||
return false; | |||
} | |||
} | |||
/// <summary> | |||
/// 增加 | |||
/// </summary> | |||
/// <returns></returns> | |||
public bool Add() | |||
{ | |||
try | |||
{ | |||
string url = ApiURL + "/api/Device/Create"; | |||
string json = HttpRequestHelper.HttpPostRequest(url, Tools.JsonConvertTools(device)); | |||
Refresh(); | |||
return true; | |||
} | |||
catch (Exception ex) | |||
{ | |||
return false; | |||
} | |||
} | |||
public bool Add(DeviceTable deviceTable) | |||
{ | |||
try | |||
{ | |||
string url = ApiURL + "/api/Device/Create"; | |||
string json = HttpRequestHelper.HttpPostRequest(url, Tools.JsonConvertTools(deviceTable)); | |||
Refresh(); | |||
return true; | |||
} | |||
catch (Exception ex) | |||
{ | |||
return false; | |||
} | |||
} | |||
/// <summary> | |||
/// 删除 | |||
/// </summary> | |||
/// <returns></returns> | |||
public bool Delete() | |||
{ | |||
try | |||
{ | |||
string url = ApiURL + "/api/Device/DeleteDate?id=" + device.Id; | |||
string json = HttpRequestHelper.HttpGetRequest(url); | |||
Refresh(); | |||
return true; | |||
} | |||
catch (Exception ex) | |||
{ | |||
return false; | |||
} | |||
} | |||
#endregion | |||
} | |||
} |
@@ -128,13 +128,11 @@ namespace BPASmartClient.ViewModel | |||
LogDataGrid = new ObservableCollection<LogModel>(); | |||
DateTimeStr = DateTime.Now; | |||
BookExs.Add(new BookEx(new Book() { Name = "一般日志条件", Tag = "Info" }) { IsChecked = true }); | |||
BookExs.Add(new BookEx(new Book() { Name = "设备日志条件", Tag = "DeviceLog" })); | |||
BookExs.Add(new BookEx(new Book() { Name = "错误日志条件", Tag = "Error" })); | |||
BookExs.Add(new BookEx(new Book() { Name = "设备告警条件", Tag = "DeviceAlarm" })); | |||
SelectedText = "一般日志条件"; | |||
BookExs.Add(new BookEx(new Book() { Name = "设备日志条件", Tag = "DeviceLog" }) { IsChecked = true }); | |||
BookExs.Add(new BookEx(new Book() { Name = "错误日志条件", Tag = "Error" }) { IsChecked = true }); | |||
BookExs.Add(new BookEx(new Book() { Name = "设备告警条件", Tag = "DeviceAlarm" }) { IsChecked = true }); | |||
SelectBookExs = new ObservableCollection<BookEx>(); | |||
SelectBookExs.Add(new BookEx(new Book() { Name = "一般日志条件", Tag = "Info" }) { IsChecked = true }); | |||
ItemPropertyChanged(new BookEx(new Book()) { IsChecked = true },new PropertyChangedEventArgs("IsChecked")); | |||
//查询 | |||
QueryCommand = new RelayCommand(() => | |||
{ | |||
@@ -158,8 +156,8 @@ namespace BPASmartClient.ViewModel | |||
LogDataGrid.Clear(); | |||
//2.根据选中查询日志 | |||
DataTable dataTable = ReadFile(path); | |||
DataRow[] datas = dataTable.Select(sql); | |||
if (datas.Count() <= 0) | |||
List<DataRow> datas = dataTable.Select($"({sql})").OrderByDescending(o => o["TIME"])?.ToList(); | |||
if (datas==null || datas.Count() <= 0) | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Info, MainViewModel.GetInstance().window, "提示", $"查询结果为空!"); | |||
return; | |||
@@ -170,8 +168,8 @@ namespace BPASmartClient.ViewModel | |||
{ | |||
time = item["TIME"].ToString(), | |||
type = item["LOGGER"].ToString(), | |||
message = item["MESSAGE"].ToString(), | |||
foreground = (item["LOGGER"].ToString() == "Error" || item["LOGGER"].ToString() == "DeviceAlarm") ? new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#ed0032")) : new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#21bb2e")) | |||
message = item["MESSAGE"].ToString() | |||
// foreground = (item["LOGGER"].ToString() == "ERROR" || item["LOGGER"].ToString() == "DEVICEALARM") ? new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#ed0032")) : new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#21bb2e")) | |||
}); | |||
} | |||
} | |||
@@ -1,12 +1,14 @@ | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.IoT; | |||
using BPASmartClient.Message; | |||
using BPASmartClient.Model; | |||
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.ComponentModel; | |||
using System.Diagnostics; | |||
using System.IO; | |||
using System.Linq; | |||
@@ -26,6 +28,7 @@ namespace BPASmartClient.ViewModel | |||
#region 变量 | |||
public DispatcherTimer dispatcherTimer; | |||
public string ClientId = System.Configuration.ConfigurationManager.AppSettings["ClientId"].ToString(); | |||
public ObservableCollection<LogModel> LogDataGridData { get; set; } | |||
private ObservableCollection<LogModel> _LogModels;public ObservableCollection<LogModel> LogDataGrid | |||
{ | |||
get | |||
@@ -68,6 +71,54 @@ namespace BPASmartClient.ViewModel | |||
OnPropertyChanged("TimedClear"); | |||
} | |||
} | |||
private string _SelectedText = ""; | |||
public string SelectedText | |||
{ | |||
get | |||
{ | |||
return _SelectedText; | |||
} | |||
set | |||
{ | |||
if (_SelectedText == value) | |||
return; | |||
_SelectedText = value; | |||
OnPropertyChanged("SelectedText"); | |||
} | |||
} | |||
public ObservableCollection<BookEx> SelectBookExs { set; get; } | |||
private ObservableCollection<BookEx> _books; | |||
public ObservableCollection<BookEx> BookExs | |||
{ | |||
get | |||
{ | |||
if (_books == null) | |||
{ | |||
_books = new ObservableCollection<BookEx>(); | |||
_books.CollectionChanged += (sender, e) => | |||
{ | |||
if (e.OldItems != null) | |||
{ | |||
foreach (BookEx bookEx in e.OldItems) | |||
{ | |||
bookEx.PropertyChanged -= ItemPropertyChanged; | |||
} | |||
} | |||
if (e.NewItems != null) | |||
{ | |||
foreach (BookEx bookEx in e.NewItems) | |||
{ | |||
bookEx.PropertyChanged += ItemPropertyChanged; | |||
} | |||
} | |||
}; | |||
} | |||
return _books; | |||
} | |||
} | |||
#endregion | |||
#region 单一 | |||
@@ -85,14 +136,23 @@ namespace BPASmartClient.ViewModel | |||
/// </summary> | |||
public void Init() | |||
{ | |||
if (LogDataGrid == null) LogDataGrid = new ObservableCollection<LogModel>(); | |||
logHelper.Fun_InitLog(System.AppDomain.CurrentDomain.BaseDirectory); | |||
if (LogDataGrid == null) LogDataGrid = new ObservableCollection<LogModel>(); | |||
if (LogDataGridData == null) LogDataGridData = new ObservableCollection<LogModel>(); | |||
BookExs.Add(new BookEx(new Book() { Name = "一般日志", Tag = "Info" }) { IsChecked = true }); | |||
BookExs.Add(new BookEx(new Book() { Name = "设备日志", Tag = "DeviceLog" }) { IsChecked = true }); | |||
BookExs.Add(new BookEx(new Book() { Name = "错误日志", Tag = "Error" }) { IsChecked = true }); | |||
BookExs.Add(new BookEx(new Book() { Name = "告警日志", Tag = "DeviceAlarm" }) { IsChecked = true }); | |||
SelectBookExs = new ObservableCollection<BookEx>(); | |||
ItemPropertyChanged(new BookEx(new Book()) { IsChecked = true }, new PropertyChangedEventArgs("IsChecked")); | |||
//一般日志 | |||
MessageLog.GetInstance.InfoNotify = new Action<string>((s) => | |||
{ | |||
System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() => | |||
{ | |||
LogDataGrid.Insert(0, new LogModel { message = s, type = "Info" }); | |||
LogModel logModel = new LogModel { message = s, type = "Info" }; | |||
LogDataGridData.Insert(0, logModel); | |||
AddLog(logModel); | |||
logHelper.GetLogConfigInstance().WriteLog(LogLevel.INFO, s); | |||
})); | |||
}); | |||
@@ -101,7 +161,9 @@ namespace BPASmartClient.ViewModel | |||
{ | |||
System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() => | |||
{ | |||
LogDataGrid.Insert(0, new LogModel { message = s, type = "DeviceLog" }); | |||
LogModel logModel = new LogModel { message = s, type = "DeviceLog" }; | |||
LogDataGridData.Insert(0, logModel); | |||
AddLog(logModel); | |||
logHelper.GetLogConfigInstance().WriteLog(LogLevel.DEBUG, s); | |||
})); | |||
}); | |||
@@ -110,7 +172,9 @@ namespace BPASmartClient.ViewModel | |||
{ | |||
System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() => | |||
{ | |||
LogDataGrid.Insert(0, new LogModel { message = id, type = "DeviceAlarm" }); | |||
LogModel logModel = new LogModel { message = id, type = "DeviceAlarm" }; | |||
LogDataGridData.Insert(0, logModel); | |||
AddLog(logModel); | |||
logHelper.GetLogConfigInstance().WriteLog(LogLevel.WARN, id); | |||
})); | |||
}); | |||
@@ -119,7 +183,9 @@ namespace BPASmartClient.ViewModel | |||
{ | |||
System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() => | |||
{ | |||
LogDataGrid.Insert(0, new LogModel { message = s, type = "Error" }); | |||
LogModel logModel = new LogModel { message = s, type = "Error" }; | |||
LogDataGridData.Insert(0, logModel); | |||
AddLog(logModel); | |||
logHelper.GetLogConfigInstance().WriteLog(LogLevel.ERROR, s); | |||
DataVClient.GetInstance().HttpAddLog(new LogTable | |||
{ | |||
@@ -154,9 +220,11 @@ namespace BPASmartClient.ViewModel | |||
{ | |||
System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() => | |||
{ | |||
if (LogDataGrid.Count > 100) | |||
if (LogDataGridData.Count > 200) | |||
{ | |||
LogDataGrid.RemoveAt(LogDataGrid.Count - 1); | |||
LogModel logModel= LogDataGridData.Last(); | |||
DeleteLog(logModel); | |||
LogDataGridData.Remove(logModel); | |||
} | |||
})); | |||
@@ -164,6 +232,43 @@ namespace BPASmartClient.ViewModel | |||
dispatcherTimer.Interval = TimeSpan.FromSeconds(10); | |||
dispatcherTimer.Start(); | |||
} | |||
/// <summary> | |||
/// 增加日志 | |||
/// </summary> | |||
public void AddLog(LogModel logModel) | |||
{ | |||
BookEx book= SelectBookExs?.ToList().Find(par => par.IsChecked && par.BookN.Tag == logModel.type); | |||
if (book != null) | |||
{ | |||
LogDataGrid.Insert(0, logModel); | |||
} | |||
} | |||
/// <summary> | |||
/// 刷新日志 | |||
/// </summary> | |||
/// <param name="logModel"></param> | |||
public void RefreshLog() | |||
{ | |||
LogDataGrid.Clear(); | |||
LogDataGridData?.ToList().ForEach(b => { | |||
BookEx book = SelectBookExs?.ToList().Find(par => par.IsChecked && par.BookN.Tag == b.type); | |||
if (book != null) | |||
{ | |||
LogDataGrid.Add(b); | |||
} | |||
}); | |||
} | |||
/// <summary> | |||
/// 删除日志 | |||
/// </summary> | |||
public void DeleteLog(LogModel logModel) | |||
{ | |||
LogModel log= LogDataGrid?.ToList().Find(par => par == logModel); | |||
if(log!=null) LogDataGrid.Remove(log); | |||
} | |||
/// <summary> | |||
/// 导出数据 | |||
/// </summary> | |||
@@ -210,6 +315,33 @@ namespace BPASmartClient.ViewModel | |||
System.Windows.MessageBox.Show("无数据!"); | |||
} | |||
/// <summary> | |||
/// 选中改变 | |||
/// </summary> | |||
/// <param name="sender"></param> | |||
/// <param name="e"></param> | |||
private void ItemPropertyChanged(object sender, PropertyChangedEventArgs e) | |||
{ | |||
if (e.PropertyName == "IsChecked") | |||
{ | |||
BookEx bookEx = sender as BookEx; | |||
if (bookEx != null) | |||
{ | |||
IEnumerable<BookEx> bookExs = BookExs.Where(b => b.IsChecked == true); | |||
StringBuilder builder = new StringBuilder(); | |||
SelectBookExs.Clear(); | |||
foreach (BookEx item in bookExs) | |||
{ | |||
builder.Append(item.BookN.Name.Replace("日志","") + ","); | |||
SelectBookExs.Add((BookEx)item); | |||
} | |||
SelectedText = builder == null ? string.Empty : builder.ToString(); | |||
RefreshLog(); | |||
} | |||
} | |||
} | |||
#endregion | |||
#region Command | |||
@@ -233,7 +365,7 @@ namespace BPASmartClient.ViewModel | |||
if (_type == value) | |||
return; | |||
_type = value; | |||
if (_type == "Error") foreground = new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#ed0032")); | |||
if (_type == "Error" || _type == "Error".ToUpper() || _type == "DeviceAlarm".ToUpper() || _type == "DeviceAlarm") foreground = new SolidColorBrush((System.Windows.Media.Color)System.Windows.Media.ColorConverter.ConvertFromString("#ed0032")); | |||
OnPropertyChanged("type"); | |||
OnPropertyChanged("foreground"); | |||
@@ -3,7 +3,7 @@ | |||
<appSettings> | |||
<!--通用配置--> | |||
<!--1:且时且多冰淇淋咖啡机,2:且时且多煮面机,3:海科煮面机测试店铺--> | |||
<add key="ClientId" value="46"/> | |||
<add key="ClientId" value="46232"/> | |||
<!--<add key="ApolloUri" value="http://10.2.1.21:28080"/> | |||
<add key="OrderServiceUri" value="http://10.2.1.26:21527/order/"/> | |||
<add key="StockServiceUri" value="http://10.2.1.26:21527/stock/"/>--> | |||
@@ -48,9 +48,10 @@ | |||
<add key="ProductKey" value="grgpECHSL7q"/> | |||
<add key="DeviceName" value="qsqd"/> | |||
<add key="DeviceSecret" value="3c0f2390943bff4fece523af22655196"/> | |||
<add key="PasswordBox" value="6WrKhYmTIhLV7g24jIH/lg=="/> | |||
<!--外设配置--> | |||
<!--外设配置--> | |||
<add key="COM_Coffee" value="COM3"/> | |||
<add key="BAUD_Coffee" value="115200"/> | |||
<add key="COM_IceCream" value="COM12"/> | |||
@@ -0,0 +1,163 @@ | |||
<UserControl x:Class="BPASmartClient.Control.DataVView" | |||
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="550" 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.ColumnDefinitions> | |||
<ColumnDefinition Width="0.8*"></ColumnDefinition> | |||
<ColumnDefinition Width="2*"></ColumnDefinition> | |||
</Grid.ColumnDefinitions> | |||
<StackPanel Grid.Column="0" Margin="10"> | |||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0"> | |||
<TextBlock Width="80" FontSize="12">API查询地址:</TextBlock> | |||
<TextBox x:Name="apiurl" Margin="10,0,0,0" Width="200" Text="{Binding ApiURL}"/> | |||
<Button Tag="SetUrl" Margin="10,0,0,0" Click="Button_Click" Style="{DynamicResource CommonBtn_返回}" Width="45">设置</Button> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0"> | |||
<TextBlock Width="80" FontSize="12">客户端ID:</TextBlock> | |||
<TextBox x:Name="chen" Margin="10,0,0,0" Width="200" >1</TextBox> | |||
<Button Tag="Inquire" Margin="10,0,0,0" Click="Button_Click" Style="{DynamicResource CommonBtn_返回}" Width="45">查询</Button> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0"> | |||
<TextBlock Width="80" HorizontalAlignment="Right" FontSize="12">客户端ID:</TextBlock> | |||
<TextBox x:Name="clientId" Margin="10,0,0,0" Width="200" Text="{Binding device.ClientId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"></TextBox> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0"> | |||
<TextBlock Width="80" FontSize="12">devicename:</TextBlock> | |||
<TextBox x:Name="devicename" Margin="10,0,0,0" Width="200" Text="{Binding device.devicename, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"></TextBox> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0"> | |||
<TextBlock Width="80" FontSize="12">productkey:</TextBlock> | |||
<TextBox x:Name="productkey" Margin="10,0,0,0" Width="200" Text="{Binding device.productkey, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"></TextBox> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0"> | |||
<TextBlock Width="80" FontSize="12">devicesecret:</TextBlock> | |||
<TextBox x:Name="devicesecret" Margin="10,0,0,0" Width="200" Text="{Binding device.devicesecret, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"></TextBox> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0"> | |||
<TextBlock Width="80" FontSize="12">设备类型:</TextBlock> | |||
<TextBox x:Name="devtype" Margin="10,0,0,0" Width="200" Text="{Binding device.devtype, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"></TextBox> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0"> | |||
<TextBlock Width="80" FontSize="12">经度:</TextBlock> | |||
<TextBox x:Name="jd" Margin="10,0,0,0" Width="200" Text="{Binding device.jd, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"></TextBox> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0"> | |||
<TextBlock Width="80" FontSize="12">纬度:</TextBlock> | |||
<TextBox x:Name="wd" Margin="10,0,0,0" Width="200" Text="{Binding device.wd, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"></TextBox> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0"> | |||
<TextBlock Width="80" FontSize="12">备注:</TextBlock> | |||
<TextBox x:Name="remark" Margin="10,0,0,0" Width="200" Text="{Binding device.remark, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"></TextBox> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal" Margin="0,10,0,0" > | |||
<Button Margin="80,0,0,0" Tag="Add" Click="Button_Click" Style="{DynamicResource CommonBtn_返回}" Width="45">增加</Button> | |||
<Button Margin="20,0,0,0" Tag="Update" Click="Button_Click" Style="{DynamicResource CommonBtn_返回}" Width="45">修改</Button> | |||
<Button Margin="20,0,0,0" Tag="Delete" Click="Button_Click" Style="{DynamicResource CommonBtn_返回}" Width="45">删除</Button> | |||
</StackPanel> | |||
<StackPanel Orientation="Horizontal" Margin="0,20,0,0" > | |||
<Button Margin="80,0,0,0" Tag="Save" Click="Button_Click" Style="{DynamicResource CommonBtn_返回}" Width="73">保存text</Button> | |||
<Button Margin="20,0,0,0" Tag="Insert" Click="Button_Click" Style="{DynamicResource CommonBtn_返回}" Width="73" Cursor="Hand">导入text</Button> | |||
</StackPanel> | |||
</StackPanel> | |||
<Grid Grid.Column="1" Margin="10"> | |||
<DataGrid HorizontalScrollBarVisibility="Visible" Margin="10" SelectedItem="{Binding deviceTableSelectedItem, UpdateSourceTrigger=PropertyChanged}" ItemsSource="{Binding deviceTable, UpdateSourceTrigger=PropertyChanged}" Grid.Row="1" MouseDoubleClick="DataGrid_MouseDoubleClick"> | |||
<DataGrid.Columns> | |||
<DataGridTemplateColumn Header="客户端ID" Width="2*"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBlock HorizontalAlignment="Center" Text="{Binding ClientId, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="12" /> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="云名称" Width="5*"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBlock HorizontalAlignment="Center" Text="{Binding devicename, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="12" /> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="云key" Width="6*"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBlock HorizontalAlignment="Center" Text="{Binding productkey, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="12" /> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="云secret" Width="12*"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBlock HorizontalAlignment="Center" Text="{Binding devicesecret, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="12" /> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="类型" Width="4*"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBlock HorizontalAlignment="Center" Text="{Binding devtype, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="12" /> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="经度" Width="4.4*"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBlock HorizontalAlignment="Center" Text="{Binding jd, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="12" /> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="纬度" Width="4.4*"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBlock HorizontalAlignment="Center" Text="{Binding wd, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="12" /> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
<DataGridTemplateColumn Header="备注" Width="5.4*"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBlock HorizontalAlignment="Center" Text="{Binding remark, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="12" /> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
</DataGrid.Columns> | |||
</DataGrid> | |||
</Grid> | |||
<Grid x:Name="Pass" Grid.ColumnSpan="2" Background="#99020202"> | |||
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center"> | |||
<TextBlock Width="80" FontSize="16" Margin="0,0,0,5">密码解锁:</TextBlock> | |||
<PasswordBox x:Name="passbox" Width="180" Height="22" ></PasswordBox> | |||
<Button HorizontalAlignment="Right" Margin="0,5,0,0" Tag="OkPass" Click="Button_Click" Style="{DynamicResource CommonBtn_返回}" Width="45" IsDefault="True">确定</Button> | |||
</StackPanel> | |||
</Grid> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,147 @@ | |||
using BPASmartClient.CustomResource.UserControls; | |||
using BPASmartClient.CustomResource.UserControls.MessageShow; | |||
using BPASmartClient.Helper; | |||
using BPASmartClient.IoT; | |||
using BPASmartClient.ViewModel; | |||
using DataVAPI.Tool.IOT; | |||
using System; | |||
using System.Collections.Generic; | |||
using System.IO; | |||
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; | |||
using System.Windows.Threading; | |||
namespace BPASmartClient.Control | |||
{ | |||
/// <summary> | |||
/// DataVView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class DataVView : UserControl | |||
{ | |||
string OnPass=string.Empty; | |||
public DispatcherTimer dispatcherTimer; | |||
public DataVView() | |||
{ | |||
InitializeComponent(); | |||
OnPass = AESHelper.Decrypt(System.Configuration.ConfigurationManager.AppSettings["PasswordBox"].ToString()); | |||
this.DataContext = DataVViewModel.GetInstance(); | |||
dispatcherTimer = new DispatcherTimer(); | |||
dispatcherTimer.Tick += delegate | |||
{ | |||
System.Windows.Application.Current?.Dispatcher.Invoke((Action)(() => | |||
{ | |||
Pass.Visibility = Visibility.Visible; | |||
dispatcherTimer.Stop(); | |||
})); | |||
}; | |||
dispatcherTimer.Interval = TimeSpan.FromSeconds(20); | |||
} | |||
private void Button_Click(object sender, RoutedEventArgs e) | |||
{ | |||
if (sender is Button) | |||
{ | |||
bool istrue = false; | |||
Button button = sender as Button; | |||
if (button.Tag != null) | |||
{ | |||
switch (button.Tag.ToString()) | |||
{ | |||
case "Add": | |||
istrue = DataVViewModel.GetInstance().Add(); | |||
if (istrue) NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, MainViewModel.GetInstance().window, "提示", $"增加成功!"); | |||
else NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, MainViewModel.GetInstance().window, "提示", $"增加失败!"); | |||
break; | |||
case "Update": | |||
if (string.IsNullOrEmpty(DataVViewModel.GetInstance().device.Id)) | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Info, MainViewModel.GetInstance().window, "提示", $"请先“查询”或者“双击右侧表格行”,修改之后在点击“修改”!"); | |||
return; | |||
} | |||
istrue = DataVViewModel.GetInstance().Update(); | |||
if (istrue) NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, MainViewModel.GetInstance().window, "提示", $"修改成功!"); | |||
else NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, MainViewModel.GetInstance().window, "提示", $"修改失败!"); | |||
break; | |||
case "Delete": | |||
if (string.IsNullOrEmpty(DataVViewModel.GetInstance().device.Id)) | |||
{ | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Info, MainViewModel.GetInstance().window, "提示", $"请先“查询”或者“双击右侧表格行”,修改之后在点击“删除”!"); | |||
return; | |||
} | |||
istrue = DataVViewModel.GetInstance().Delete(); | |||
if (istrue) NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, MainViewModel.GetInstance().window, "提示", $"删除成功!"); | |||
else NoticeDemoViewModel.OpenMsg(EnumPromptType.Error, MainViewModel.GetInstance().window, "提示", $"删除失败!"); | |||
break; | |||
case "SetUrl": | |||
DataVViewModel.GetInstance().ApiURL = apiurl.Text; | |||
DataVViewModel.GetInstance().Refresh(); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, MainViewModel.GetInstance().window, "提示", $"设置成功!"); | |||
//MessageBox.Show("设置成功"); | |||
break; | |||
case "Inquire": | |||
DataVViewModel.GetInstance().device = DataVViewModel.GetInstance().Inquire(chen.Text)?.FirstOrDefault(); | |||
break; | |||
case "Save": | |||
System.Windows.Forms.SaveFileDialog saveFileDialog = new System.Windows.Forms.SaveFileDialog(); | |||
saveFileDialog.Filter = "txt文件(*.txt)|*.txt"; | |||
if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) | |||
{ | |||
StreamWriter sw = File.CreateText(saveFileDialog.FileName); | |||
sw.Write(Tools.JsonConvertTools(DataVViewModel.GetInstance().deviceTable)); //写入文件中 | |||
sw.Flush();//清理缓冲区 | |||
sw.Close();//关闭文件 | |||
} | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, MainViewModel.GetInstance().window, "提示", $"导出设备成功,条数: {DataVViewModel.GetInstance().deviceTable.Count}!"); | |||
break; | |||
case "Insert": | |||
System.Windows.Forms.OpenFileDialog file = new System.Windows.Forms.OpenFileDialog();//定义新的文件打开位置控件 | |||
file.Filter = "txt文件(*.txt)|*.txt";//设置文件后缀的过滤 | |||
if (file.ShowDialog() == System.Windows.Forms.DialogResult.OK)//如果有选择打开文件 | |||
{ | |||
DeviceTable device = null; | |||
FileStream fs = new FileStream(file.FileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite); | |||
StreamReader sr = new StreamReader(fs, System.Text.Encoding.UTF8); //选择编码方式 | |||
string str = sr.ReadToEnd(); | |||
if (!string.IsNullOrEmpty(str)) | |||
{ | |||
Tools.JsonToObjectTools<List<DeviceTable>>(str)?.ForEach(par => | |||
{ | |||
DataVViewModel.GetInstance().Add(par); | |||
}); | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Success, MainViewModel.GetInstance().window, "提示", $"插入设备成功,条数: {Tools.JsonToObjectTools<List<DeviceTable>>(str)?.Count}!"); | |||
DataVViewModel.GetInstance().Refresh(); | |||
} | |||
} | |||
break; | |||
case "OkPass": | |||
if (passbox.Password == OnPass) | |||
{ | |||
Pass.Visibility = Visibility.Collapsed; | |||
passbox.Password = ""; | |||
dispatcherTimer.Start(); | |||
} | |||
else | |||
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, MainViewModel.GetInstance().window, "提示", $"密码输入错误!"); | |||
break; | |||
} | |||
} | |||
} | |||
} | |||
private void DataGrid_MouseDoubleClick(object sender, MouseButtonEventArgs e) | |||
{ | |||
DataVViewModel.GetInstance().device = DataVViewModel.GetInstance().deviceTableSelectedItem; | |||
} | |||
} | |||
} |
@@ -0,0 +1,16 @@ | |||
<UserControl x:Class="BPASmartClient.Control.IOTView" | |||
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" | |||
xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf" | |||
mc:Ignorable="d" | |||
d:DesignHeight="450" d:DesignWidth="800"> | |||
<Grid> | |||
<wv2:WebView2 | |||
Name="webView" | |||
Width="{Binding RelativeSource={RelativeSource AncestorType=Grid}, Path=ActualWidth}" | |||
Height="{Binding RelativeSource={RelativeSource AncestorType=Grid}, Path=ActualHeight}" /> | |||
</Grid> | |||
</UserControl> |
@@ -0,0 +1,29 @@ | |||
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> | |||
/// IOTView.xaml 的交互逻辑 | |||
/// </summary> | |||
public partial class IOTView : UserControl | |||
{ | |||
public IOTView() | |||
{ | |||
InitializeComponent(); | |||
webView.Source = new Uri("http://iot.black-pa.com"); | |||
} | |||
} | |||
} |
@@ -26,12 +26,10 @@ | |||
<!-- 查询按钮栏 --> | |||
<StackPanel Margin="10,0,10,0" Orientation="Horizontal"> | |||
<ComboBox Width="120" Text="{Binding SelectedText}" IsEditable="True" ItemsSource="{Binding Path=BookExs}"> | |||
<ComboBox Width="120" Text="{Binding SelectedText}" IsEditable="True" ItemsSource="{Binding Path=BookExs}"> | |||
<ComboBox.ItemTemplate> | |||
<DataTemplate DataType="{x:Type k:BookEx}"> | |||
<StackPanel Orientation="Horizontal"> | |||
<CheckBox IsChecked="{Binding IsChecked}" Margin="2,0,3,0" Background="Red" Content="{Binding BookN.Name}" /> | |||
</StackPanel> | |||
<CheckBox Width="110" IsChecked="{Binding IsChecked}" Content="{Binding BookN.Name}" /> | |||
</DataTemplate> | |||
</ComboBox.ItemTemplate> | |||
</ComboBox> | |||
@@ -3,6 +3,7 @@ | |||
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:k="clr-namespace:BPASmartClient.Model;assembly=BPASmartClient.Model" | |||
xmlns:vm="clr-namespace:BPASmartClient.ViewModel;assembly=BPASmartClient.ViewModel" | |||
xmlns:local="clr-namespace:BPASmartClient.Control" | |||
mc:Ignorable="d" | |||
@@ -25,8 +26,13 @@ | |||
<!--查询按钮栏--> | |||
<StackPanel Orientation="Horizontal" Margin="10,0,10,0"> | |||
<!--<CheckBox Margin="10,0,0,0" IsChecked="{Binding RealTimeModel, UpdateSourceTrigger=PropertyChanged}" >实时模式</CheckBox> | |||
<CheckBox Margin="10,0,0,0" IsChecked="{Binding TimedClear, UpdateSourceTrigger=PropertyChanged}">定时清除</CheckBox>--> | |||
<ComboBox Width="100" Text="{Binding SelectedText}" IsEditable="True" ItemsSource="{Binding Path=BookExs}"> | |||
<ComboBox.ItemTemplate> | |||
<DataTemplate DataType="{x:Type k:BookEx}"> | |||
<CheckBox Width="95" IsChecked="{Binding IsChecked}" Content="{Binding BookN.Name}" /> | |||
</DataTemplate> | |||
</ComboBox.ItemTemplate> | |||
</ComboBox> | |||
<Button Margin="10,0,0,0" Cursor="Hand" Command="{Binding ExcelCommand}" Style="{DynamicResource CommonBtn_返回}" Width="75">导出日志</Button> | |||
<Button Margin="10,0,0,0" Cursor="Hand" Command="{Binding OpenCommand}" Style="{DynamicResource CommonBtn_返回}" Width="75">打开文件</Button> | |||
</StackPanel> | |||
@@ -54,7 +60,7 @@ | |||
<DataGridTemplateColumn Header="日志类型" Width="300"> | |||
<DataGridTemplateColumn.CellTemplate> | |||
<DataTemplate> | |||
<TextBlock HorizontalAlignment="Center" Text="{Binding type, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="14" Foreground="{Binding foreground, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/> | |||
<TextBlock HorizontalAlignment="Center" Text="{Binding type, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" FontSize="14" Foreground="{Binding foreground, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/> | |||
</DataTemplate> | |||
</DataGridTemplateColumn.CellTemplate> | |||
</DataGridTemplateColumn> | |||
@@ -76,6 +76,12 @@ | |||
FontSize="12" | |||
Header="店铺设备配置" | |||
Tag="ShopDeviceConfigView" /> | |||
<Separator /> | |||
<MenuItem | |||
Click="MenuItem_Click" | |||
FontSize="12" | |||
Header="阿里连接维护" | |||
Tag="DataVView" /> | |||
</MenuItem> | |||
<MenuItem Header="状态监视"> | |||
<MenuItem | |||
@@ -96,17 +102,12 @@ | |||
Header="设备监视" | |||
Tag="DeviceMonitorView" /> | |||
<Separator /> | |||
<MenuItem | |||
Click="MenuItem_Click" | |||
FontSize="12" | |||
Header="告警监视" | |||
Tag="LogView" /> | |||
<Separator /> | |||
<MenuItem | |||
Click="MenuItem_Click" | |||
FontSize="12" | |||
Header="IOT监视" | |||
Tag="LogView" /> | |||
Tag="IOTView" /> | |||
<Separator /> | |||
</MenuItem> | |||
<MenuItem Header="综合查询"> | |||
<MenuItem | |||