去掉录像机相关内容

This commit is contained in:
maqiao 2024-11-26 17:09:37 +08:00
parent 9f918d8aeb
commit 2a495becbd
5 changed files with 53 additions and 54 deletions

View File

@ -103,7 +103,7 @@ namespace DM_Weight
// 组态屏工具
//containerRegistry.RegisterSingleton<ScreenUtil>();
// 录像机
containerRegistry.RegisterSingleton<CHKFunction>();
//containerRegistry.RegisterSingleton<CHKFunction>();
containerRegistry.Register<IDialogService, MaterialDialogService>();

View File

@ -230,7 +230,7 @@ namespace DM_Weight.Port
logger.Info($"进行抽屉操作抽屉号【{DrawerNo}】类型【{BoardType}】库位【{string.Join(",", ColNos)}】窗口【{WindowName}】");
Operate = true;
//开始录像
_chkFunction.HIKStartDVRRecord();
//_chkFunction.HIKStartDVRRecord();
logger.Info($"时间:{DateTime.Now}");
try
{
@ -683,8 +683,7 @@ namespace DM_Weight.Port
private readonly IEventAggregator _eventAggregator;
private CHKFunction _chkFunction;
public PortUtil(IEventAggregator eventAggregator, CHKFunction chkFunction)
public PortUtil(IEventAggregator eventAggregator)
{
_eventAggregator = eventAggregator;
//try
@ -761,7 +760,7 @@ namespace DM_Weight.Port
{
logger.Error("温湿度串口打开错误" + e.Message);
}
_chkFunction = chkFunction;
//_chkFunction = chkFunction;
}

View File

@ -344,16 +344,16 @@ namespace DM_Weight.ViewModels
public bool Is16Drawer { get => _is16Drawer; set => SetProperty(ref _is16Drawer, value); }
public bool KeepAlive => false;
private PortUtil _portUtil;
private CHKFunction _chkFunction;
//private CHKFunction _chkFunction;
IEventAggregator _eventAggregator;
public HomeWindowViewModel(IRegionManager iRegionManager, PortUtil portUtil, IDialogService dialogService, IUnityContainer container, IEventAggregator eventAggregator, CHKFunction cHKFunction)
public HomeWindowViewModel(IRegionManager iRegionManager, PortUtil portUtil, IDialogService dialogService, IUnityContainer container, IEventAggregator eventAggregator)
{
_portUtil = portUtil;
_regionManager = iRegionManager;
_dialogService = dialogService;
_container = container;
this._eventAggregator = eventAggregator;
_chkFunction = cHKFunction;
//_chkFunction = cHKFunction;
}
public DelegateCommand<string> OpenFingerDialog
@ -453,7 +453,7 @@ namespace DM_Weight.ViewModels
// }
//}
//保存温湿度信息
private async void GetWSD(object sender, ElapsedEventArgs e)
private void GetWSD(object sender, ElapsedEventArgs e)
{
TemperatureHumidityInfo temp = _portUtil.GetWSD();
if (temp != null)
@ -546,10 +546,10 @@ namespace DM_Weight.ViewModels
{
Operator = null;
Reviewer = null;
Application.Current.Dispatcher.Invoke(() =>
{
//Application.Current.Dispatcher.Invoke(() =>
//{
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
});
//});
AlertMsg alertMsg = new AlertMsg
{
Message = $"用户{UserList.Nickname}或还未设置权限,请联系管理员",
@ -623,25 +623,25 @@ namespace DM_Weight.ViewModels
//WDTimer.Enabled = true;
}
#endregion
if (stopRecord > 0)
{
System.Timers.Timer timer = new System.Timers.Timer();
timer.Interval = 1000;
timer.Elapsed += (sender, e) =>
{
//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();
_chkFunction.HIKStartDVRRecord();
// //指定时间内无人操作鼠标键盘则停止录像
// if (!_portUtil.Operate && CheckComputerFreeState.GetLastInputTime() > stopRecord)
// {
// _chkFunction.HIKStopDVRRecord();
// }
// };
// timer.Start();
//}
//logger.Info($"当前时间:{DateTime.Now}\r\n获取录像机的时间");
////获取录像机的时间
//_chkFunction.HIK_DVR_TIME();
//_chkFunction.HIKStartDVRRecord();
}
//每次导航的时候该实列用不用重新创建true是不重新创建,false是重新创建
@ -658,13 +658,13 @@ namespace DM_Weight.ViewModels
}
private void SetLoginOut()
{
_chkFunction.HIKStopDVRRecord();
//_chkFunction.HIKStopDVRRecord();
Operator = null;
Reviewer = null;
Application.Current.Dispatcher.Invoke(() =>
{
//Application.Current.Dispatcher.Invoke(() =>
//{
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
});
//});
}
}

View File

@ -65,7 +65,7 @@ namespace DM_Weight.ViewModels
private FingerprintUtil _fingerprintUtil;
private PortUtil _portUtil;
private CHKFunction _chkFunction;
//private CHKFunction _chkFunction;
public Boolean LoginBtnEnable { get { return _loginBtnEnable; } set { SetProperty(ref _loginBtnEnable, value); } }
public string Password { get { return password; } set { SetProperty(ref password, value); } }
@ -115,11 +115,11 @@ namespace DM_Weight.ViewModels
// _regionManager = regionManager;
// _eventAggregator = eventAggregator;
//}
public LoginWindowViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, PortUtil portUtil, CHKFunction chcFunction)
public LoginWindowViewModel(IRegionManager regionManager, IEventAggregator eventAggregator, PortUtil portUtil)
{
//_fingerprintUtil = fingerprintUtil;
_portUtil = portUtil;
_chkFunction= chcFunction;
//_chkFunction= chcFunction;
_regionManager = regionManager;
_eventAggregator = eventAggregator;
}
@ -259,10 +259,10 @@ _exitCommand ??= new DelegateCommand(Exit);
{
//添加参数,键值对格式
keys.Add("operator", user);
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
{
//System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
//{
_regionManager.RequestNavigate("MainRegion", "HomeWindow", keys);
}));
//}));
}
// 双人登录模式
else
@ -275,10 +275,10 @@ _exitCommand ??= new DelegateCommand(Exit);
keys.Add("reviewer", user);
Reviewer = user;
RaisePropertyChanged("Reviewer");
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
{
//System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
//{
_regionManager.RequestNavigate("MainRegion", "HomeWindow", keys);
}));
//}));
}
else
@ -299,10 +299,10 @@ _exitCommand ??= new DelegateCommand(Exit);
keys.Add("operator", user);
Operator = user;
RaisePropertyChanged("Operator");
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
{
//System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
//{
_regionManager.RequestNavigate("MainRegion", "HomeWindow", keys);
}));
//}));
}
else
@ -360,7 +360,7 @@ _exitCommand ??= new DelegateCommand(Exit);
void Exit()
{
_chkFunction.HIKLoginOut();
//_chkFunction.HIKLoginOut();
Process.GetCurrentProcess().Kill();
Environment.Exit(0);
}

View File

@ -65,9 +65,9 @@ namespace DM_Weight.ViewModels
private FingerprintUtil _fingerprintUtil;
IRegionManager _regionManager;
IUnityContainer _container;
private CHKFunction _cHKFunction;
//private CHKFunction _cHKFunction;
private readonly ILog logger = LogManager.GetLogger(typeof(PortUtil));
public MainWindowViewModel(IRegionManager regionManager, IUnityContainer container, IEventAggregator eventAggregator, FingerprintUtil fingerprintUtil, CHKFunction cHKFunction)
public MainWindowViewModel(IRegionManager regionManager, IUnityContainer container, IEventAggregator eventAggregator, FingerprintUtil fingerprintUtil)
{
//_portUtil = portUtil;
this.eventAggregator = eventAggregator;
@ -75,15 +75,15 @@ namespace DM_Weight.ViewModels
_fingerprintUtil = fingerprintUtil;
_regionManager = regionManager;
_container = container;
_cHKFunction = cHKFunction;
//_cHKFunction = cHKFunction;
System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
{
//System.Windows.Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Send, new Action(() =>
//{
_container.RegisterType<object, LoginWindow>("LoginWindow");
_regionManager.RequestNavigate("MainRegion", "LoginWindow");
_regionManager.RegisterViewWithRegion("MainRegion", "LoginWindow");
}));
//}));
}