diff --git a/DM_Weight/App.xaml.cs b/DM_Weight/App.xaml.cs index 7bfc8a8..817e5a2 100644 --- a/DM_Weight/App.xaml.cs +++ b/DM_Weight/App.xaml.cs @@ -103,7 +103,7 @@ namespace DM_Weight // 组态屏工具 //containerRegistry.RegisterSingleton(); // 录像机 - containerRegistry.RegisterSingleton(); + //containerRegistry.RegisterSingleton(); containerRegistry.Register(); diff --git a/DM_Weight/Port/PortUtil.cs b/DM_Weight/Port/PortUtil.cs index d055ab9..ae49cb0 100644 --- a/DM_Weight/Port/PortUtil.cs +++ b/DM_Weight/Port/PortUtil.cs @@ -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; } diff --git a/DM_Weight/ViewModels/HomeWindowViewModel.cs b/DM_Weight/ViewModels/HomeWindowViewModel.cs index 6cd7175..d6e0d65 100644 --- a/DM_Weight/ViewModels/HomeWindowViewModel.cs +++ b/DM_Weight/ViewModels/HomeWindowViewModel.cs @@ -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 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"); - }); + //}); } } diff --git a/DM_Weight/ViewModels/LoginWindowViewModel.cs b/DM_Weight/ViewModels/LoginWindowViewModel.cs index d42cdf5..37b9864 100644 --- a/DM_Weight/ViewModels/LoginWindowViewModel.cs +++ b/DM_Weight/ViewModels/LoginWindowViewModel.cs @@ -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); } diff --git a/DM_Weight/ViewModels/MainWindowViewModel.cs b/DM_Weight/ViewModels/MainWindowViewModel.cs index 22ce93a..48150fb 100644 --- a/DM_Weight/ViewModels/MainWindowViewModel.cs +++ b/DM_Weight/ViewModels/MainWindowViewModel.cs @@ -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("LoginWindow"); - _regionManager.RequestNavigate("MainRegion", "LoginWindow"); + _regionManager.RegisterViewWithRegion("MainRegion", "LoginWindow"); - })); + //})); }