2023-11-13 11:52:43 +08:00
|
|
|
|
using log4net;
|
|
|
|
|
using Prism.Commands;
|
|
|
|
|
using Prism.Events;
|
|
|
|
|
using Prism.Mvvm;
|
|
|
|
|
using Prism.Regions;
|
|
|
|
|
using Prism.Services.Dialogs;
|
|
|
|
|
using SqlSugar;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Configuration;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
using DM_Weight.Models;
|
|
|
|
|
using DM_Weight.Port;
|
|
|
|
|
using DM_Weight.util;
|
|
|
|
|
using DM_Weight.Views;
|
|
|
|
|
using System.Timers;
|
|
|
|
|
using Unity;
|
|
|
|
|
using System.Windows.Threading;
|
|
|
|
|
using Newtonsoft.Json.Linq;
|
2023-11-27 15:13:42 +08:00
|
|
|
|
using DM_Weight.msg;
|
2024-04-18 11:09:21 +08:00
|
|
|
|
using DM_Weight.HIKVISION;
|
2024-06-24 17:30:26 +08:00
|
|
|
|
using System.Threading;
|
2023-11-13 11:52:43 +08:00
|
|
|
|
|
|
|
|
|
namespace DM_Weight.ViewModels
|
|
|
|
|
{
|
|
|
|
|
public class HomeWindowViewModel : BindableBase, IConfirmNavigationRequest, IRegionMemberLifetime
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
private readonly ILog logger = LogManager.GetLogger(typeof(HomeWindowViewModel));
|
|
|
|
|
private readonly IDialogService _dialogService;
|
|
|
|
|
private UserList? _userList;
|
|
|
|
|
private UserList? _userList2;
|
2024-06-24 17:30:26 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 冰箱温度
|
|
|
|
|
/// </summary>
|
|
|
|
|
private string _wd = "恒温冷藏抽屉当前温度2.8(非真实数据)";
|
|
|
|
|
public string WD { get => _wd; set => SetProperty(ref _wd, value); }
|
|
|
|
|
System.Timers.Timer WDTimer;
|
|
|
|
|
|
2023-11-13 11:52:43 +08:00
|
|
|
|
|
|
|
|
|
private int loginMode = Convert.ToInt32(ConfigurationManager.AppSettings["loginMode"]?.ToString() ?? "1");
|
|
|
|
|
public bool MultiLogin
|
|
|
|
|
{
|
|
|
|
|
get => loginMode == 2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private PremissionDm? _selectedMenu;
|
|
|
|
|
|
|
|
|
|
private PremissionDm? _selectedChildMenu;
|
|
|
|
|
|
|
|
|
|
private List<PremissionDm>? _premissionDmList;
|
|
|
|
|
|
|
|
|
|
public PremissionDm? SelectedChildMenu
|
|
|
|
|
{
|
|
|
|
|
get { return _selectedChildMenu; }
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (!_portUtil.Operate)
|
|
|
|
|
{
|
|
|
|
|
if (value != null)
|
|
|
|
|
{
|
|
|
|
|
if (value.PremissionPath.Equals("TakeRecordWindow"))
|
|
|
|
|
{
|
|
|
|
|
//定义传参变量
|
|
|
|
|
NavigationParameters keys = new NavigationParameters();
|
|
|
|
|
|
|
|
|
|
//添加参数,键值对格式
|
|
|
|
|
keys.Add("Type", 2);
|
|
|
|
|
_regionManager.RequestNavigate("ContentRegion", "MachineRecordWindow", keys);
|
|
|
|
|
}
|
|
|
|
|
else if (value.PremissionPath.Equals("AddRecordWindow"))
|
|
|
|
|
{
|
|
|
|
|
//定义传参变量
|
|
|
|
|
NavigationParameters keys = new NavigationParameters();
|
|
|
|
|
|
|
|
|
|
//添加参数,键值对格式
|
|
|
|
|
keys.Add("Type", 1);
|
|
|
|
|
_regionManager.RequestNavigate("ContentRegion", "MachineRecordWindow", keys);
|
|
|
|
|
}
|
|
|
|
|
else if (value.PremissionPath.Equals("ReturnRecordWindow"))
|
|
|
|
|
{
|
|
|
|
|
//定义传参变量
|
|
|
|
|
NavigationParameters keys = new NavigationParameters();
|
|
|
|
|
|
|
|
|
|
//添加参数,键值对格式
|
|
|
|
|
keys.Add("Type", 3);
|
|
|
|
|
_regionManager.RequestNavigate("ContentRegion", "MachineRecordWindow", keys);
|
|
|
|
|
}
|
|
|
|
|
else if (value.PremissionPath.Equals("RetrunEmptyRecordWindow"))
|
|
|
|
|
{
|
|
|
|
|
//定义传参变量
|
|
|
|
|
NavigationParameters keys = new NavigationParameters();
|
|
|
|
|
|
|
|
|
|
//添加参数,键值对格式
|
|
|
|
|
keys.Add("Type", 3);
|
|
|
|
|
_regionManager.RequestNavigate("ContentRegion", value.PremissionPath, keys);
|
|
|
|
|
}
|
|
|
|
|
else if (value.PremissionPath.Equals("CheckRecordWindow"))
|
|
|
|
|
{
|
|
|
|
|
//定义传参变量
|
|
|
|
|
NavigationParameters keys = new NavigationParameters();
|
|
|
|
|
|
|
|
|
|
//添加参数,键值对格式
|
|
|
|
|
keys.Add("Type", 4);
|
|
|
|
|
_regionManager.RequestNavigate("ContentRegion", "MachineRecordWindow", keys);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (value.PremissionPath.Equals("ReturnDrugWindow") || value.PremissionPath.Equals("ReturnDrugWindow2"))
|
|
|
|
|
{
|
|
|
|
|
if (ConfigurationManager.AppSettings["returnDrugMode"].ToString().Equals("1"))
|
|
|
|
|
{
|
|
|
|
|
_regionManager.RequestNavigate("ContentRegion", "ReturnDrugWindow2");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_regionManager.RequestNavigate("ContentRegion", "ReturnDrugWindow");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_regionManager.RequestNavigate("ContentRegion", value.PremissionPath);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
SetProperty(ref _selectedChildMenu, value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public PremissionDm? SelectedMenu
|
|
|
|
|
{
|
|
|
|
|
get { return _selectedMenu; }
|
|
|
|
|
set
|
|
|
|
|
{
|
2023-11-27 15:13:42 +08:00
|
|
|
|
//if (value != null)
|
|
|
|
|
//{
|
|
|
|
|
// if (value.PremissionName == "退出")
|
|
|
|
|
// {
|
|
|
|
|
// logger.Info($"用户【{Operator?.Nickname}】退出登录");
|
|
|
|
|
// Operator = null;
|
|
|
|
|
// Reviewer = null;
|
|
|
|
|
// _regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
|
|
|
|
// }
|
|
|
|
|
// else
|
|
|
|
|
// {
|
|
|
|
|
// SelectedChildMenu = value.Children[0];
|
|
|
|
|
// }
|
|
|
|
|
//}
|
2023-11-13 11:52:43 +08:00
|
|
|
|
SetProperty(ref _selectedMenu, value);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private DelegateCommand<ListBox> _selectionCommon;
|
|
|
|
|
public DelegateCommand<ListBox> SelectionCommon
|
|
|
|
|
{
|
|
|
|
|
get => _selectionCommon ?? (_selectionCommon = new DelegateCommand<ListBox>(SelectionMethod));
|
|
|
|
|
}
|
|
|
|
|
private void SelectionMethod(ListBox viewName)
|
|
|
|
|
{
|
|
|
|
|
SelectedMenu = viewName.SelectedItem as PremissionDm;
|
|
|
|
|
if (SelectedMenu.PremissionName == "退出")
|
|
|
|
|
{
|
2024-04-18 11:09:21 +08:00
|
|
|
|
|
|
|
|
|
_chkFunction.HIKStopDVRRecord();
|
2023-11-13 11:52:43 +08:00
|
|
|
|
logger.Info($"用户【{Operator?.Nickname}】退出登录");
|
|
|
|
|
Operator = null;
|
|
|
|
|
Reviewer = null;
|
|
|
|
|
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2023-11-27 15:13:42 +08:00
|
|
|
|
//SelectedMenu.Children = SelectedMenu.Children;
|
2023-11-13 11:52:43 +08:00
|
|
|
|
SelectedChildMenu = SelectedMenu.Children[0];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<PremissionDm> PremissionDmList { get { return _premissionDmList; } set { SetProperty(ref _premissionDmList, value); } }
|
|
|
|
|
|
|
|
|
|
public UserList UserList { get { return _userList; } set { SetProperty(ref _userList, value); } }
|
|
|
|
|
public UserList UserList2 { get { return _userList2; } set { SetProperty(ref _userList2, value); } }
|
|
|
|
|
|
|
|
|
|
public static UserList? Operator;
|
|
|
|
|
public static UserList? Reviewer;
|
|
|
|
|
|
|
|
|
|
IRegionManager _regionManager;
|
|
|
|
|
IUnityContainer _container;
|
|
|
|
|
|
|
|
|
|
private bool _is16Drawer;
|
|
|
|
|
public bool Is16Drawer { get => _is16Drawer; set => SetProperty(ref _is16Drawer, value); }
|
|
|
|
|
public bool KeepAlive => false;
|
|
|
|
|
private PortUtil _portUtil;
|
2024-04-18 11:09:21 +08:00
|
|
|
|
private CHKFunction _chkFunction;
|
2023-11-27 15:13:42 +08:00
|
|
|
|
IEventAggregator _eventAggregator;
|
2024-06-24 17:30:26 +08:00
|
|
|
|
public HomeWindowViewModel(IRegionManager iRegionManager, PortUtil portUtil, IDialogService dialogService, IUnityContainer container, IEventAggregator eventAggregator, CHKFunction cHKFunction)
|
2023-11-13 11:52:43 +08:00
|
|
|
|
{
|
|
|
|
|
_portUtil = portUtil;
|
|
|
|
|
_regionManager = iRegionManager;
|
|
|
|
|
_dialogService = dialogService;
|
|
|
|
|
_container = container;
|
2023-11-27 15:13:42 +08:00
|
|
|
|
this._eventAggregator = eventAggregator;
|
2024-06-24 17:30:26 +08:00
|
|
|
|
_chkFunction = cHKFunction;
|
2023-11-13 11:52:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DelegateCommand<string> OpenFingerDialog
|
|
|
|
|
{
|
|
|
|
|
get => new DelegateCommand<string>((string Type) =>
|
|
|
|
|
{
|
|
|
|
|
DialogParameters dialogParameters = new DialogParameters();
|
|
|
|
|
dialogParameters.Add("User", Type.Equals("Operator") ? Operator : Reviewer);
|
|
|
|
|
DialogServiceExtensions.ShowDialogHost(_dialogService, "FingerprintDialog", dialogParameters, DoDialogResult, "RootDialog");
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DelegateCommand OpenRecoverCommand
|
|
|
|
|
{
|
|
|
|
|
get => new DelegateCommand(async () =>
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
_portUtil.WindowName = "HomeWindow";
|
|
|
|
|
_portUtil.Operate = true;
|
|
|
|
|
await _portUtil.OpenStorage();
|
|
|
|
|
_portUtil.ResetData();
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
logger.Info($"OpenRecoverCommand异常{ex.Message}");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DelegateCommand<string> OpenEditPasswordDialog
|
|
|
|
|
{
|
|
|
|
|
get => new DelegateCommand<string>((string Type) =>
|
|
|
|
|
{
|
|
|
|
|
DialogParameters dialogParameters = new DialogParameters();
|
|
|
|
|
dialogParameters.Add("EditPass", true);
|
|
|
|
|
dialogParameters.Add("User", Type.Equals("Operator") ? Operator : Reviewer);
|
|
|
|
|
DialogServiceExtensions.ShowDialogHost(_dialogService, "EditUserDialog", dialogParameters, DoDialogResult, "RootDialog");
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
private void DoDialogResult(IDialogResult dialogResult)
|
|
|
|
|
{
|
|
|
|
|
// 委托 被动执行 被子窗口执行
|
|
|
|
|
// dialogResult 第一方面可以拿到任意参数 第二方面 可判断关闭状态
|
|
|
|
|
if (dialogResult.Result == ButtonResult.OK)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void FindDrawerCount()
|
|
|
|
|
{
|
2023-11-14 14:49:22 +08:00
|
|
|
|
int count = 0;
|
|
|
|
|
if (ConfigurationManager.AppSettings["MultiBatch"].ToString().Equals("1"))
|
|
|
|
|
{
|
|
|
|
|
count = SqlSugarHelper.Db.Queryable<ChannelList>().Where(cs => cs.DrawerType != 3)
|
2023-11-13 11:52:43 +08:00
|
|
|
|
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrawerNo).Select(cs => SqlFunc.AggregateCount(cs.DrawerNo)).Count();
|
2023-11-14 14:49:22 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
count = SqlSugarHelper.Db.Queryable<ChannelStock>().Where(cs => cs.DrawerType != 3)
|
|
|
|
|
.Where(cs => cs.MachineId.Equals(ConfigurationManager.AppSettings["machineId"] ?? "DM1")).GroupBy(cs => cs.DrawerNo).Select(cs => SqlFunc.AggregateCount(cs.DrawerNo)).Count();
|
|
|
|
|
}
|
2023-11-13 11:52:43 +08:00
|
|
|
|
Is16Drawer = count == 16;
|
|
|
|
|
}
|
2024-06-24 17:30:26 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取温度信息
|
|
|
|
|
/// </summary>
|
|
|
|
|
private async void GetWD(object sender, ElapsedEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!_portUtil.FridgeOperate)
|
|
|
|
|
{
|
|
|
|
|
string retStr = string.Empty;
|
|
|
|
|
byte[] data = null;
|
|
|
|
|
float retT = await _portUtil.GetFridgeTemperature();
|
|
|
|
|
Thread.Sleep(80);
|
|
|
|
|
WD = $"恒温冷藏抽屉当前温度:{Math.Round((retT - 1.5), 2)}℃";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private async void GetWD()
|
|
|
|
|
{
|
|
|
|
|
if (!_portUtil.FridgeOperate)
|
|
|
|
|
{
|
|
|
|
|
string retStr = string.Empty;
|
|
|
|
|
byte[] data = null;
|
|
|
|
|
float retT = await _portUtil.GetFridgeTemperature();
|
|
|
|
|
Thread.Sleep(80);
|
|
|
|
|
WD = $"恒温冷藏抽屉当前温度:{Math.Round((retT - 1.5), 2)}℃";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 将收到的返回转换成具体温度数值
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="receiveData"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public string GetResultWD(string receiveData)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//string newStrWD = receiveData.Substring(10, 4);
|
|
|
|
|
|
|
|
|
|
//logger.Info($"截取后数据newStrWD:{newStrWD}");
|
|
|
|
|
int iWD = Convert.ToInt32(receiveData, 16);
|
|
|
|
|
logger.Info($"截取后数据iWD:{iWD}");
|
|
|
|
|
float fWD = 0;
|
|
|
|
|
if (iWD != 0)
|
|
|
|
|
{
|
|
|
|
|
fWD = iWD * 1.0f / 10;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logger.Info($"截取后数据fWD:{fWD}");
|
|
|
|
|
string strRet = $"恒温冷藏抽屉当前温度:{fWD}℃;";
|
2023-11-13 11:52:43 +08:00
|
|
|
|
|
2024-06-24 17:30:26 +08:00
|
|
|
|
return strRet;
|
|
|
|
|
}
|
|
|
|
|
catch (Exception ex)
|
|
|
|
|
{
|
|
|
|
|
logger.Info("GetResultWD异常", new Exception($"{ex.ToString()}"));
|
|
|
|
|
}
|
|
|
|
|
return "数据异常";
|
|
|
|
|
}
|
2023-11-13 11:52:43 +08:00
|
|
|
|
//这个方法用于拦截请求,continuationCallback(true)就是不拦截,continuationCallback(false)拦截本次操作
|
|
|
|
|
public void ConfirmNavigationRequest(NavigationContext navigationContext, Action<bool> continuationCallback)
|
|
|
|
|
{
|
|
|
|
|
continuationCallback(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//接收导航传过来的参数
|
|
|
|
|
public void OnNavigatedTo(NavigationContext navigationContext)
|
|
|
|
|
{
|
2024-06-24 17:30:26 +08:00
|
|
|
|
_portUtil.dateTime = DateTime.Now;
|
2023-11-13 11:52:43 +08:00
|
|
|
|
//取出user
|
|
|
|
|
UserList = navigationContext.Parameters.GetValue<UserList>("operator");
|
|
|
|
|
Operator = UserList;
|
|
|
|
|
logger.Info($"发药人【{Operator.Nickname}】登录");
|
|
|
|
|
if (navigationContext.Parameters.ContainsKey("reviewer"))
|
|
|
|
|
{
|
|
|
|
|
UserList2 = navigationContext.Parameters.GetValue<UserList>("reviewer");
|
|
|
|
|
Reviewer = UserList2;
|
|
|
|
|
logger.Info($"审核人【{Reviewer.Nickname}】登录");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
List<PremissionDm> premissions = UserList.Role.Permissions;
|
2023-11-27 15:13:42 +08:00
|
|
|
|
if (premissions.Count <= 0)
|
|
|
|
|
{
|
|
|
|
|
Operator = null;
|
|
|
|
|
Reviewer = null;
|
|
|
|
|
Application.Current.Dispatcher.Invoke(() =>
|
|
|
|
|
{
|
|
|
|
|
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
|
|
|
|
});
|
|
|
|
|
AlertMsg alertMsg = new AlertMsg
|
|
|
|
|
{
|
|
|
|
|
Message = $"用户{UserList.Nickname}或还未设置权限,请联系管理员",
|
|
|
|
|
Type = MsgType.ERROR
|
|
|
|
|
};
|
|
|
|
|
_eventAggregator.GetEvent<SnackbarEvent>().Publish(alertMsg);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2023-11-13 11:52:43 +08:00
|
|
|
|
//SqlSugarHelper.Db.SqlQueryable<PremissionDm>(sql)
|
|
|
|
|
//.ToTree(pd => pd.Children, pd => pd.ParentId, 0);
|
|
|
|
|
PremissionDmList = premissions;
|
|
|
|
|
SelectedMenu = premissions[0];
|
2023-11-27 15:13:42 +08:00
|
|
|
|
SelectedChildMenu = premissions[0].Children[0];
|
2023-11-13 11:52:43 +08:00
|
|
|
|
FindDrawerCount();
|
|
|
|
|
|
|
|
|
|
int autoExit = Convert.ToInt32(ConfigurationManager.AppSettings["autoExit"] ?? "0");
|
2024-06-24 17:30:26 +08:00
|
|
|
|
int stopRecord = Convert.ToInt32(ConfigurationManager.AppSettings["stopRecord"] ?? "0");
|
2023-11-13 11:52:43 +08:00
|
|
|
|
if (autoExit > 0)
|
|
|
|
|
{
|
2024-06-24 17:30:26 +08:00
|
|
|
|
System.Timers.Timer timer = new System.Timers.Timer();
|
2023-11-13 11:52:43 +08:00
|
|
|
|
timer.Interval = 1000;
|
|
|
|
|
timer.Elapsed += (sender, e) =>
|
|
|
|
|
{
|
|
|
|
|
// 串口无人操作
|
|
|
|
|
if (!_portUtil.Operate)
|
|
|
|
|
{
|
|
|
|
|
// 30秒内无人操作鼠标键盘
|
|
|
|
|
if ((DateTime.Now - _portUtil.dateTime).TotalSeconds > autoExit && CheckComputerFreeState.GetLastInputTime() > autoExit)
|
|
|
|
|
{
|
|
|
|
|
logger.Info($"设备30秒内无人操作,用户【{Operator?.Nickname}】自动退出登录");
|
2024-04-18 11:09:21 +08:00
|
|
|
|
_chkFunction.HIKStopDVRRecord();
|
2023-11-13 11:52:43 +08:00
|
|
|
|
Operator = null;
|
|
|
|
|
Reviewer = null;
|
|
|
|
|
Application.Current.Dispatcher.Invoke(() =>
|
|
|
|
|
{
|
|
|
|
|
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
|
|
|
|
|
timer.Stop();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
timer.Start();
|
|
|
|
|
}
|
2024-06-24 17:30:26 +08:00
|
|
|
|
#region 温度查询定时
|
|
|
|
|
int interval = Convert.ToInt32(ConfigurationManager.AppSettings["Interval"]);
|
|
|
|
|
if (interval > 0)
|
|
|
|
|
{
|
|
|
|
|
WDTimer = new System.Timers.Timer();
|
|
|
|
|
|
|
|
|
|
WDTimer.Elapsed += new System.Timers.ElapsedEventHandler(GetWD);
|
|
|
|
|
WDTimer.Interval = interval;
|
|
|
|
|
//WDTimer.Start();
|
|
|
|
|
//WDTimer.AutoReset = true;
|
|
|
|
|
//WDTimer.Enabled = true;
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
GetWD();
|
|
|
|
|
if (stopRecord > 0)
|
|
|
|
|
{
|
|
|
|
|
System.Timers.Timer timer = new System.Timers.Timer();
|
|
|
|
|
timer.Interval = 1000;
|
|
|
|
|
timer.Elapsed += (sender, e) =>
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
//指定时间内无人操作鼠标键盘则停止录像
|
|
|
|
|
if (!_portUtil.Operate && CheckComputerFreeState.GetLastInputTime() > stopRecord)
|
|
|
|
|
{
|
|
|
|
|
_chkFunction.HIKStopDVRRecord();
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
timer.Start();
|
|
|
|
|
}
|
|
|
|
|
logger.Info($"当前时间:{DateTime.Now}\r\n获取录像机的时间");
|
|
|
|
|
//获取录像机的时间
|
|
|
|
|
_chkFunction.HIK_DVR_TIME();
|
2024-04-18 11:09:21 +08:00
|
|
|
|
_chkFunction.HIKStartDVRRecord();
|
2023-11-13 11:52:43 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//每次导航的时候,该实列用不用重新创建,true是不重新创建,false是重新创建
|
|
|
|
|
public bool IsNavigationTarget(NavigationContext navigationContext)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//这个方法用于拦截请求
|
|
|
|
|
public void OnNavigatedFrom(NavigationContext navigationContext)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|