private void Window_Loaded(object sender, RoutedEventArgs e) { if (m_DockNo <= 0) { MessageBox.Show("货架信息错误!"); return; } int count = DockInfoManager.Instance().Get(m_DockNo); }
private void LoadPumpList() { int pumpCount = DockInfoManager.Instance().Get(m_DockNo); int pumpCountPerRow = pumpCount / 5; //每行有几个机位 if (pumpCount <= 0) { Logger.Instance().Info("泵数量小于等于0,请重新设置。"); return; } int rowCount = pumpCount / 2; if (pumpCount % 2 > 0) { rowCount += 1; } for (int i = 0; i < rowCount; i++) { RowDefinition row = new RowDefinition(); row.Height = GridLength.Auto; pumplistGrid.RowDefinitions.Add(row); } int iRow = 0, iCol = 0; for (int i = 0, rowIndex = 1; i < pumpCount; i++) { //AgingSystem:SinglePump Grid.Row="1" Grid.Column="1" Margin="1" Cursor="Hand" Background="Blue"/> iRow = i / pumpCountPerRow + 1; iCol = (i + 1) % pumpCountPerRow; if (iCol == 0) { iCol = pumpCountPerRow; } SinglePump pump = new SinglePump(m_DockNo, i + 1, iRow, iCol); pump.Name = "pump" + (i + 1).ToString(); pump.Tag = i + 1; pump.Margin = new Thickness(1, 1, 1, 1); pump.Cursor = Cursors.Hand; pump.SetPump(i + 1, "", ""); pump.OnClickCheckBox += OnSinglePumpClickCheckBox; pump.OnSerialNoTypeIn += OnSerialNoInputComplete; pumplistGrid.Children.Add(pump); Grid.SetRow(pump, rowIndex); if (i % 2 == 1) { ++rowIndex; } Grid.SetColumn(pump, i % 2); pump.Background = new SolidColorBrush(m_PumpBackgroundColor[i / pumpCountPerRow]); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { StartCurrentTimer(); Logger.Instance().Info(""); Logger.Instance().Info(""); Logger.Instance().Info(""); Logger.Instance().Info(""); Logger.Instance().Info(""); Logger.Instance().Info("=====================应用程序启动==========================="); System.Configuration.Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); if (!(int.TryParse(config.AppSettings.Settings["DockCount"].Value, out m_DockCount))) { m_DockCount = 10; } if (!(int.TryParse(config.AppSettings.Settings["QueryInterval"].Value, out m_QueryInterval))) { m_QueryInterval = 60; } if (!(int.TryParse(config.AppSettings.Settings["TimeOut"].Value, out m_TimeOut))) { m_TimeOut = 60000; } if (!(int.TryParse(config.AppSettings.Settings["HeartBeat"].Value, out m_HeartBeatTimeOut))) { m_HeartBeatTimeOut = 240000; } if (!(int.TryParse(config.AppSettings.Settings["CheckPumpStatusMaxMunites"].Value, out m_CheckPumpStatusMaxMunites))) { m_CheckPumpStatusMaxMunites = 30 * 60; } if (!(int.TryParse(config.AppSettings.Settings["CheckPumpStopStatusMaxMunites"].Value, out m_CheckPumpStopStatusMaxMunites))) { m_CheckPumpStopStatusMaxMunites = 5 * 60;//5分钟 } if (!(int.TryParse(config.AppSettings.Settings["CheckDisChargeMaxMunites"].Value, out m_CheckDisChargeMaxMunites))) { m_CheckDisChargeMaxMunites = 30 * 60;//30分钟 } DockInfoManager.Instance().Init(); ControllerManager.Instance().Init(); LoadDockList(); ProtocolEngine.Instance().SetTimeOut(m_TimeOut); //设置命令解析超时时间 AsyncServer.Instance().SocketTimeOut = m_HeartBeatTimeOut; //心跳超时时间 ProtocolEngine.Instance().InitTcp(); ProtocolEngine.Instance().SocketConnectOrCloseResponse += OnSocketConnectOrClose; ProtocolEngine.Instance().SendPumpType2Wifi += OnSendPumpType2Wifi; ProtocolEngine.Instance().UploadAlarm += OnUploadAlarm; ProtocolEngine.Instance().Start(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { this.Title = string.Format("配置第{0}号货架", m_DockNo); System.Configuration.Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); if (!(int.TryParse(config.AppSettings.Settings["DockCount"].Value, out m_DockCount))) { m_DockCount = 12; } int pumpCount = DockInfoManager.Instance().Get(m_DockNo); if (pumpCount == 30) { this.Height = 600; } LoadDockList(); LoadPumpList(); InitParameter(); InitSelectedPumps(); }
private void Window_Loaded(object sender, RoutedEventArgs e) { StartCurrentTimer(); Logger.Instance().Info(""); Logger.Instance().Info(""); Logger.Instance().Info(""); Logger.Instance().Info(""); Logger.Instance().Info(""); Logger.Instance().Info("=====================应用程序启动==========================="); System.Configuration.Configuration config = System.Configuration.ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); if (config.AppSettings.Settings.AllKeys.Contains("DockNumber")) { //当架子只有一个时,这个变量才有效, add by 2018-09-01 if (!(int.TryParse(config.AppSettings.Settings["DockNumber"].Value, out m_DockNumber))) { m_DockNumber = 1; } } if (config.AppSettings.Settings.AllKeys.Contains("AgingResultDir")) { m_AgingResultDir = config.AppSettings.Settings["AgingResultDir"].Value; } if (config.AppSettings.Settings.AllKeys.Contains("AgingResultDirBackup")) { m_AgingResultDirBackup = config.AppSettings.Settings["AgingResultDirBackup"].Value; } if (!(int.TryParse(config.AppSettings.Settings["TcpListenPort"].Value, out m_TcpListenPort))) { m_TcpListenPort = 20160; } if (!(int.TryParse(config.AppSettings.Settings["DockCount"].Value, out m_DockCount))) { m_DockCount = 10; } if (!(int.TryParse(config.AppSettings.Settings["QueryInterval"].Value, out m_QueryInterval))) { m_QueryInterval = 60; } if (!(int.TryParse(config.AppSettings.Settings["TimeOut"].Value, out m_TimeOut))) { m_TimeOut = 60000; } if (!(int.TryParse(config.AppSettings.Settings["HeartBeat"].Value, out m_HeartBeatTimeOut))) { m_HeartBeatTimeOut = 240000; } if (!(int.TryParse(config.AppSettings.Settings["CheckPumpStatusMaxMunites"].Value, out m_CheckPumpStatusMaxMunites))) { m_CheckPumpStatusMaxMunites = 30 * 60; } if (!(int.TryParse(config.AppSettings.Settings["CheckPumpStopStatusMaxMunites"].Value, out m_CheckPumpStopStatusMaxMunites))) { m_CheckPumpStopStatusMaxMunites = 5 * 60;//5分钟 } if (!(int.TryParse(config.AppSettings.Settings["CheckDisChargeMaxMunites"].Value, out m_CheckDisChargeMaxMunites))) { m_CheckDisChargeMaxMunites = 30 * 60;//30分钟 } DockInfoManager.Instance().Init(); ControllerManager.Instance().Init(); LoadDockList(); ProtocolEngine.Instance().SetTimeOut(m_TimeOut); //设置命令解析超时时间 AsyncServer.Instance().TcpServerPort = m_TcpListenPort; AsyncServer.Instance().SocketTimeOut = m_HeartBeatTimeOut; //心跳超时时间 ProtocolEngine.Instance().InitTcp(); ProtocolEngine.Instance().SocketConnectOrCloseResponse += OnSocketConnectOrClose; ProtocolEngine.Instance().SendPumpType2Wifi += OnSendPumpType2Wifi; ProtocolEngine.Instance().UploadAlarm += OnUploadAlarm; ProtocolEngine.Instance().Start(); if (m_DockCount == 1) { this.Width = 270; this.Height = 330; } }