/// <summary> /// 重置 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnRestar_Click(object sender, EventArgs e) { tSumSecond.Stop(); _TimerPara = new TimerParameter(0, 20, 0, true, false, "NULL"); _Second = 0; txtPickMinute.Text = _TimerPara.PickMinute.ToString(); btnStar.Enabled = true; btnPause.Enabled = false; ShowTime(); }
private void applyParameters() { NetworkParameter networkParameter = this.parameters.GetNetworkParameter(); SerialPortParameter serialPortParameter = this.parameters.GetSerialPortParameter(); TimerParameter timerParameter = this.parameters.GetTimerParameter(); PersistencyParameter persistencyParameter = this.parameters.GetPersistencyParameter(); ModuleConfiguration.Default_LocalAddress = networkParameter.LocalAddress; ModuleConfiguration.Default_LocalPort = networkParameter.LocalPort; ModuleConfiguration.Default_MulticastAddress = networkParameter.RemoteAddress; //networkParameter.MulticastAddress; ModuleConfiguration.Default_MulticastPort = networkParameter.RemotePort; //networkParameter.MulticastPort; ModuleConfiguration.Default_TimeToLive = networkParameter.TimeToLive; ModuleConfiguration.Default_CommunicationType = networkParameter.CommunicationType; ModuleConfiguration.Default_PipeName = networkParameter.PipeName; ModuleConfiguration.Default_TimerInterval = timerParameter.TimerInterval; ModuleConfiguration.Default_SerialPortBaudRate = serialPortParameter.SerialPortBaudRate; ModuleConfiguration.Default_SerialPortDataBits = serialPortParameter.SerialPortDataBits; ModuleConfiguration.Default_SerialPortEncodingCodePage = serialPortParameter.SerialPortEncodingCodePage; ModuleConfiguration.Default_SerialPortHandShake = serialPortParameter.SerialPortHandShake; ModuleConfiguration.Default_SerialPortName = serialPortParameter.SerialPortName; ModuleConfiguration.Default_SerialPortParity = serialPortParameter.SerialPortParity; ModuleConfiguration.Default_SerialPortReadBufferSize = serialPortParameter.SerialPortReadBufferSize; ModuleConfiguration.Default_SerialPortReadTimeout = serialPortParameter.SerialPortReadTimeout; ModuleConfiguration.Default_SerialPortRtsEnable = serialPortParameter.SerialPortRtsEnable; ModuleConfiguration.Default_SerialPortStopBits = serialPortParameter.SerialPortStopBits; ModuleConfiguration.Default_SerialPortWriteBufferSize = serialPortParameter.SerialPortWriteBufferSize; ModuleConfiguration.Default_SerialPortWriteTimeout = serialPortParameter.SerialPortWriteTimeout; ModuleConfiguration.Default_SerialPortDtrEnable = serialPortParameter.SerialPortDtrEnable; ModuleConfiguration.Default_SerialPortMode = serialPortParameter.SerialPortMode; ModuleConfiguration.Default_SerialPortExpectedDataValue = serialPortParameter.SerialPortExpectedDataValue; ModuleConfiguration.Default_SequenceMask = serialPortParameter.SequenceMask; ModuleConfiguration.Default_SequenceSeparator = serialPortParameter.SequenceSeparator; ModuleConfiguration.Default_SerialPortIsReadingByLine = serialPortParameter.IsReadingByLine; ModuleConfiguration.Default_SerialPortIsBroadcasting = serialPortParameter.IsBroadcasting; }
/// <summary> /// 配置检查 /// </summary> /// <returns></returns> private bool CheckConfig() { string K3_Url, K3_ZTID, K3_User, K3_PWD, SQL_IP, SQL_Port, SQL_Catalog, SQL_User, SQL_PWD, T_PickSeconds; try { #region 配置信息 //K3Inf K3_Url = ConfigurationManager.AppSettings["K3_URL"]; K3_ZTID = ConfigurationManager.AppSettings["K3_ZTID"]; K3_User = ConfigurationManager.AppSettings["K3_USERNAME"]; K3_PWD = ConfigurationManager.AppSettings["K3_PWD"]; //SQLInf SQL_IP = ConfigurationManager.AppSettings["SQL_IP"]; SQL_Port = ConfigurationManager.AppSettings["SQL_Port"]; SQL_Catalog = ConfigurationManager.AppSettings["SQL_Catalog"]; SQL_User = ConfigurationManager.AppSettings["SQL_User"]; SQL_PWD = ConfigurationManager.AppSettings["SQL_PWD"]; T_PickSeconds = ConfigurationManager.AppSettings["T_PickSeconds"]; #endregion } catch (Exception ex) { MessageBox.Show("配置信息有误:" + ex.Message); return(false); } #region 设置信息 //全局参数 new GlobalParameter(new K3Setting(K3_Url, K3_ZTID, K3_User, K3_PWD), new SQLConfig(SQL_IP, SQL_Port, SQL_User, SQL_PWD, SQL_Catalog)); #endregion #region 调用服务方法验证用户登录 string log = DalCreator.CommFunction.Userlog(K3_Url, K3_ZTID, K3_User, K3_PWD); if (log != "") { MessageBox.Show(log); return(false); } #endregion #region 数据库连接检验 string strDBStatus = DalCreator.CommFunction.CheckedConnection(GlobalParameter.SQLInf.ConnectionString); if (strDBStatus != "连接成功") { MessageBox.Show(strDBStatus); return(false); } #endregion _TimerPara = new TimerParameter(0, int.Parse(T_PickSeconds), 0, false, true, ""); #region 判断程序是否启用 #endregion #region 判断MAC是否已注册使用 #endregion #region 批处理脚本 DalCreator.CommFunction.SetSql(); #endregion return(true); }
/// <summary> /// 构造函数 /// </summary> /// <param name="pTimerPara"></param> public frmTool_Timer(TimerParameter pTimerPara) { InitializeComponent(); _TimerPara = new TimerParameter(pTimerPara.ExeTimes, pTimerPara.PickMinute, pTimerPara.RunSeconds, pTimerPara.PauseStatus, pTimerPara.IsRunning, pTimerPara.FuncID); }