private void btnLoadCSV_Click(object sender, EventArgs e) { try { btnLoadCSV.Enabled = false; string fileDirectry = string.Empty; OpenFileDialog openFiledlg = new OpenFileDialog(); openFiledlg.InitialDirectory = Application.StartupPath + "\\BURNIN"; openFiledlg.Filter = "csv files (*.csv)|*.csv"; if (openFiledlg.ShowDialog() != DialogResult.OK) { return; } txtCSV.Text = openFiledlg.FileName; CIniFile.WriteToIni("FrmYield", "CSVFile", txtCSV.Text, iniFile); LoadPLCCSV(txtCSV.Text); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "Tip", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } finally { btnLoadCSV.Enabled = true; } }
private void SaveIniPara() { CIniFile.WriteToIni("ToolDebug", "Socket_SerIP", txtSerIP.Text, iniFile); CIniFile.WriteToIni("ToolDebug", "Socket_SerPort", txtSerPort.Text, iniFile); CIniFile.WriteToIni("ToolDebug", "Socket_clientIP", txtClientIP.Text, iniFile); CIniFile.WriteToIni("ToolDebug", "Socket_clientPort", txtClientPort.Text, iniFile); }
private void BtnLoad_Click(object sender, EventArgs e) { try { BtnLoad.Enabled = false; OpenFileDialog openFiledlg = new OpenFileDialog(); openFiledlg.InitialDirectory = Application.StartupPath + "\\XML"; openFiledlg.Filter = "Para files (*.xml)|*.xml"; if (openFiledlg.ShowDialog() != DialogResult.OK) { return; } if (!LoadXmlPara(openFiledlg.FileName)) { return; } txtSerXML.Text = openFiledlg.FileName; xmlFile = openFiledlg.FileName; CIniFile.WriteToIni("ToolDebug", "Socket_Xml", xmlFile, iniFile); } catch (Exception) { throw; } finally { BtnLoad.Enabled = true; } }
private void SaveIniFile() { _ip = txtSerIP.Text; _port = System.Convert.ToInt32(txtSerPort.Text); CIniFile.WriteToIni("ToolDebug", "Telnet_IP", _ip, iniFile); CIniFile.WriteToIni("ToolDebug", "Telnet_Port", _port.ToString(), iniFile); }
private void btnListen_Click(object sender, EventArgs e) { try { btnListen.Enabled = false; string er = string.Empty; tcpPort = System.Convert.ToInt32(txtSerPort.Text); if (serTcp == null) { if (!LoadXmlPara(xmlFile)) { return; } serTcp = new CAPSocket(0, "TCP服务端", packages); serTcp.OnLogArgs.OnEvent += new COnEvent <CAPSocket.CLogArgs> .OnEventHandler(OnSerLog); serTcp.OnCmdArgs.OnEvent += new COnEvent <CAPSocket.CCmdArgs> .OnEventHandler(OnSerCmd); if (!serTcp.Listen(tcpPort, out er)) { labSerStatus.Text = er; labSerStatus.ForeColor = Color.Red; return; } btnListen.Text = "停止"; btnListen.ImageKey = "Connect"; } else { serTcp.Close(); serTcp.OnLogArgs.OnEvent -= new COnEvent <CAPSocket.CLogArgs> .OnEventHandler(OnSerLog); serTcp.OnCmdArgs.OnEvent -= new COnEvent <CAPSocket.CCmdArgs> .OnEventHandler(OnSerCmd); serTcp = null; btnListen.Text = "监听"; btnListen.ImageKey = "DisConnect"; } CIniFile.WriteToIni("ToolDebug", "Socket_SerTcpPort", tcpPort.ToString(), iniFile); } catch (Exception ex) { labSerStatus.Text = ex.ToString(); labSerStatus.ForeColor = Color.Red; } finally { btnListen.Enabled = true; } }
/// <summary> /// 保存INI文件 /// </summary> private void SaveIniFile() { CIniFile.WriteToIni("PsoC", "Protocol", ((int)para.Protocol).ToString(), IniFile); CIniFile.WriteToIni("PsoC", "Voltage", para.Voltage.ToString(), IniFile); CIniFile.WriteToIni("PsoC", "Freq", ((int)para.Freq).ToString(), IniFile); CIniFile.WriteToIni("PsoC", "Pin", ((int)para.Pin).ToString(), IniFile); CIniFile.WriteToIni("PsoC", "HexFile", para.HexFile, IniFile); }
private void btnSelect_Click(object sender, EventArgs e) { url = txtUrl.Text; sysDB = labSysDB.Text; CIniFile.WriteToIni("FrmSnQuery", "url", url, iniFile); CIniFile.WriteToIni("FrmSnQuery", "sysDB", sysDB, iniFile); }
private void SaveIniFile() { _ip = txtSerIP.Text; _port = System.Convert.ToInt32(txtSerPort.Text); _topic = txtTopic.Text; _message = txtMessage.Text; CIniFile.WriteToIni("ToolDebug", "MQTT_IP", _ip, iniFile); CIniFile.WriteToIni("ToolDebug", "MQTT_Port", _port.ToString(), iniFile); CIniFile.WriteToIni("ToolDebug", "MQTT_Topic", _topic, iniFile); CIniFile.WriteToIni("ToolDebug", "MQTT_Message", _message, iniFile); }
private void btnCon_Click(object sender, EventArgs e) { try { btnCon.Enabled = false; string er = string.Empty; clientIP = txtSerIP.Text; clientPort = txtSerPort.Text; if (clientTcp == null) { if (!OpenClientTcp(txtSerIP.Text, txtSerPort.Text, out er)) { labClientStatus.Text = er; labClientStatus.ForeColor = Color.Red; return; } labClientStatus.Text = er; labClientStatus.ForeColor = Color.Blue; btnSendCmd.Enabled = true; btnCon.Text = "断开"; btnCon.ImageKey = "Connect"; } else { CloseClientTcp(); labClientStatus.Text = "断开服务器连接"; labClientStatus.ForeColor = Color.Blue; btnSendCmd.Enabled = false; btnCon.Text = "连接"; btnCon.ImageKey = "DisConnect"; } CIniFile.WriteToIni("ToolDebug", "Socket_clientIP", clientIP, iniFile); CIniFile.WriteToIni("ToolDebug", "Socket_clientPortt", clientPort, iniFile); } catch (Exception ex) { labClientStatus.Text = ex.ToString(); labClientStatus.ForeColor = Color.Red; } finally { btnCon.Enabled = true; } }
private void btnCon_Click(object sender, EventArgs e) { try { btnCon.Enabled = false; if (btnCon.Text == "连接") { string er = string.Empty; string ulrWeb = txtUlrWeb.Text; string version = string.Empty; watcher.Restart(); if (!CGJWeb.CheckSystem(ulrWeb, out version, out er)) { watcher.Stop(); labStatus.Text = er; labStatus.ForeColor = Color.Red; return; } watcher.Stop(); rtbRtn.Text = version; labStatus.Text = "连接Web服务端正常."; labStatus.ForeColor = Color.Blue; btnCon.ImageKey = "Con"; btnCon.Text = "断开"; CIniFile.WriteToIni("ToolDebug", "ulrWeb", ulrWeb, iniFile); } else { labStatus.Text = "断开Web服务端连接."; labStatus.ForeColor = Color.Blue; btnCon.ImageKey = "Dis"; btnCon.Text = "连接"; } } catch (Exception) { throw; } finally { btnCon.Enabled = true; labTimes.Text = watcher.ElapsedMilliseconds.ToString(); } }
private void btnOK_Click(object sender, EventArgs e) { if (txtOrder.Text == "") { MessageBox.Show(CLanguage.Lan("请输入当前工单号"), "Tip", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } LogOrder = txtOrder.Text; CIniFile.WriteToIni("Parameter", "MES_Order", LogOrder, CGlobalPara.IniFile); LogOK = 1; this.Close(); }
private void btnBrowse_Click(object sender, EventArgs e) { try { FolderBrowserDialog dlg = new FolderBrowserDialog(); if (dlg.ShowDialog() == DialogResult.OK) { txtFolder.Text = dlg.SelectedPath; } dataFolder = txtFolder.Text; CIniFile.WriteToIni("FrmReport", "FolderPath", dataFolder, iniFile); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
private void btnSave_Click(object sender, EventArgs e) { url = txtUrl.Text; CIniFile.WriteToIni("FrmYield", "url", url, iniFile); }
private void saveIniFile() { CIniFile.WriteToIni("Device", "config", devXmlFile, devIniFile); }