From d05801a802aae8305a0138ae8735b8b18aa52a09 Mon Sep 17 00:00:00 2001 From: maqiao <625215135@qq.com> Date: Fri, 3 Jan 2025 11:49:40 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B3=A8=E9=87=8A=E6=8E=89=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DM_Weight/ViewModels/HomeWindowViewModel.cs | 90 ++++++++++----------- DM_Weight/Views/HomeWindow.xaml.cs | 14 ++-- 2 files changed, 52 insertions(+), 52 deletions(-) diff --git a/DM_Weight/ViewModels/HomeWindowViewModel.cs b/DM_Weight/ViewModels/HomeWindowViewModel.cs index 0450837..184c726 100644 --- a/DM_Weight/ViewModels/HomeWindowViewModel.cs +++ b/DM_Weight/ViewModels/HomeWindowViewModel.cs @@ -464,21 +464,21 @@ namespace DM_Weight.ViewModels } } - public void FindDrawerCount() - { - int count = 0; - if (ConfigurationManager.AppSettings["MultiBatch"].ToString().Equals("1")) - { - count = SqlSugarHelper.Db.Queryable().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(); - } - else - { - count = SqlSugarHelper.Db.Queryable().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(); - } - Is16Drawer = count == 16; - } + //public void FindDrawerCount() + //{ + // int count = 0; + // if (ConfigurationManager.AppSettings["MultiBatch"].ToString().Equals("1")) + // { + // count = SqlSugarHelper.Db.Queryable().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(); + // } + // else + // { + // count = SqlSugarHelper.Db.Queryable().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(); + // } + // Is16Drawer = count == 16; + //} /// /// 获取温度信息 /// @@ -586,7 +586,7 @@ namespace DM_Weight.ViewModels //接收导航传过来的参数 public void OnNavigatedTo(NavigationContext navigationContext) { - _eventAggregator.GetEvent().Subscribe(SetLoginOut); + //_eventAggregator.GetEvent().Subscribe(SetLoginOut); //_portUtil.dateTime = DateTime.Now; //取出user UserList = navigationContext.Parameters.GetValue("operator"); @@ -623,7 +623,7 @@ namespace DM_Weight.ViewModels SelectedMenu = premissions[0]; SelectedChildMenu = premissions[0].Children[0]; _regionManager.RequestNavigate("ContentRegion", premissions[0].Children[0].PremissionPath); - FindDrawerCount(); + //FindDrawerCount(); #region 温度查询定时 //int interval = Convert.ToInt32(ConfigurationManager.AppSettings["Interval"]); @@ -721,37 +721,37 @@ namespace DM_Weight.ViewModels public void OnNavigatedFrom(NavigationContext navigationContext) { //退了登录 - _eventAggregator.GetEvent().Unsubscribe(SetLoginOut); + //_eventAggregator.GetEvent().Unsubscribe(SetLoginOut); } - private void SetLoginOut() - { - //_chkFunction.HIKStopDVRRecord(); - Operator = null; - Reviewer = null; - try - { - //if (_socketHelper.IsMultiThread) - //{ - // Application.Current.Dispatcher.BeginInvoke(() => - // { - // _regionManager.RequestNavigate("MainRegion", "LoginWindow"); - // }); - //} - //else - { + //private void SetLoginOut() + //{ + // //_chkFunction.HIKStopDVRRecord(); + // Operator = null; + // Reviewer = null; + // try + // { + // //if (_socketHelper.IsMultiThread) + // //{ + // // Application.Current.Dispatcher.BeginInvoke(() => + // // { + // // _regionManager.RequestNavigate("MainRegion", "LoginWindow"); + // // }); + // //} + // //else + // { - Application.Current.Dispatcher.Invoke(() => - { - _regionManager.RequestNavigate("MainRegion", "LoginWindow"); - }); - } - } - catch (Exception ex) - { - logger.Info($"自动退出异常:{ex.Message}"); - } - } + // Application.Current.Dispatcher.Invoke(() => + // { + // _regionManager.RequestNavigate("MainRegion", "LoginWindow"); + // }); + // } + // } + // catch (Exception ex) + // { + // logger.Info($"自动退出异常:{ex.Message}"); + // } + //} } } diff --git a/DM_Weight/Views/HomeWindow.xaml.cs b/DM_Weight/Views/HomeWindow.xaml.cs index 1f2f420..8bffcad 100644 --- a/DM_Weight/Views/HomeWindow.xaml.cs +++ b/DM_Weight/Views/HomeWindow.xaml.cs @@ -30,12 +30,12 @@ namespace DM_Weight.Views /// public partial class HomeWindow : UserControl { - private readonly ILog logger = LogManager.GetLogger(typeof(HomeWindow)); - int autoExit = Convert.ToInt32(ConfigurationManager.AppSettings["autoExit"] ?? "0"); - //public static System.Timers.Timer idleTimer;//= new System.Timers.Timer(60000); - IEventAggregator _eventAggregator; - SocketHelper _socketHelper; - public HomeWindow(IEventAggregator eventAggregator, SocketHelper socketHelper) + //private readonly ILog logger = LogManager.GetLogger(typeof(HomeWindow)); + //int autoExit = Convert.ToInt32(ConfigurationManager.AppSettings["autoExit"] ?? "0"); + ////public static System.Timers.Timer idleTimer;//= new System.Timers.Timer(60000); + //IEventAggregator _eventAggregator; + //SocketHelper _socketHelper; + public HomeWindow() { InitializeComponent(); //if (autoExit > 0) @@ -50,7 +50,7 @@ namespace DM_Weight.Views // idleTimer.Start(); // _eventAggregator = eventAggregator; //} - _socketHelper = socketHelper; + //_socketHelper = socketHelper; } //private void OnUserActivity(object sender, EventArgs e) //{