private void btnLink_Click(object sender, EventArgs e) { if (this.tbIp.Text.Trim().Length == 0 || this.tbIp.Text.Trim().Length == 0) { MessageBox.Show("IP and Port is required!"); return; } int port = 0; if (!int.TryParse(this.tbPort.Text.Trim(), out port)) { MessageBox.Show("Port must be number!"); return; } ServiceAgent.SetParas(this.tbIp.Text.Trim(), port); if (int.TryParse(this.tbFilePort.Text.Trim(), out port)) { FileAgent.SetParas(this.tbIp.Text.Trim(), port); } GlobalStaticObj_Server.Instance.StationID = this.tbSendMsg.Text.Split('$')[0]; if (ServiceAgent.ServiceTest() || FileAgent.ServiceTest()) { if (this.startFlag) { this.startFlag = false; AutoTask.StartTest(this.dateTimePicker1.Value.Ticks); } else { AutoTask.Continue(); } this.btnLink.Text = "已连接"; this.btnLink.Enabled = false; this.btnClose.Enabled = true; } }
/// <summary> 停止或者启动 /// </summary> private void btnStartOrStop_Click(object sender, EventArgs e) { DataSources.EnumTaskStatus status = AutoTask.GetStatus(); if (status == DataSources.EnumTaskStatus.Not_Started) { AutoTask.Start(); picCloadPlat.Image = HXCServerWinForm.Properties.Resources.runing; this.btnStartOrStop.Text = "挂起"; } else if (status == DataSources.EnumTaskStatus.Runing) { AutoTask.Stop(); picCloadPlat.Image = HXCServerWinForm.Properties.Resources.runing; this.btnStartOrStop.Text = "挂起"; } else if (status == DataSources.EnumTaskStatus.Suspend) { AutoTask.Continue(); picCloadPlat.Image = HXCServerWinForm.Properties.Resources.stop; this.btnStartOrStop.Text = "启动"; } }
/// <summary> 停止或者启动 /// </summary> private void btnStartOrStop_Click(object sender, EventArgs e) { try { DataSources.EnumTaskStatus status = AutoTask.GetStatus(); if (status == DataSources.EnumTaskStatus.Not_Started) { AutoTask.Start(); picCloadPlat.Image = HXCServerWinForm.Properties.Resources.runing; this.btnStartOrStop.Text = "挂起"; this.btnStartOrStop.Enabled = false; } else if (status == DataSources.EnumTaskStatus.Runing) { AutoTask.Stop(); picCloadPlat.Image = HXCServerWinForm.Properties.Resources.runing; this.btnStartOrStop.Text = "挂起"; this.btnStartOrStop.Enabled = false; } else if (status == DataSources.EnumTaskStatus.Suspend) { AutoTask.Continue(); picCloadPlat.Image = HXCServerWinForm.Properties.Resources.stop; this.btnStartOrStop.Text = "启动"; this.btnStartOrStop.Enabled = true; } } catch (Exception ex) { GlobalStaticObj_Server.GlobalLogService.WriteLog("UCHomePage", ex); if (sender == null) { MessageBoxEx.ShowWarning("慧联云平台链接启用失败"); } } }