private void btnStopSvc_Click(object sender, EventArgs e) { DoService.Stop(); btnStartSvc.Enabled = true; btnStopSvc.Enabled = false; }
private void button7_Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Title = "請選擇 Station 檔案"; dialog.InitialDirectory = ".\\"; dialog.Filter = "csv files (*.*)|*.csv"; if (dialog.ShowDialog() == DialogResult.OK) { string[] csvList = { dialog.FileName }; richTextBox1.Text += DoService.ProcessCsvList(csvList, true); } }
private void timer1_Tick(object sender, EventArgs e) { if (richTextBox1.Lines.Length > 14) { richTextBox1.Clear(); } richTextBox1.Text += string.IsNullOrEmpty(richTextBox1.Text) ? "\r\n" : ""; string printResult = DoService.PrintResult(); //string res = string.IsNullOrEmpty(printResult) ? "沒有新資料" : printResult; richTextBox1.Text += $"{DateTime.Now.ToString("HH:mm:ss")}: {printResult}\r\n";; }
private void timerLog_Tick(object sender, EventArgs e) { if (txtMessage.Lines.Length > 14) { txtMessage.Clear(); } txtMessage.Text += string.IsNullOrEmpty(txtMessage.Text) ? "\r\n" : ""; //txtMessage.Text += $"{DateTime.Now.ToString("HH:mm:ss")}: 資料處理中,請稍後...\r\n"; string printResult = DoService.printResult(); string res = string.IsNullOrEmpty(printResult) ? "沒有新資料" : printResult; string test = $"{DateTime.Now.ToString("HH:mm:ss")}: {res}\r\n"; string msg = test; txtMessage.Text += msg; }
private void btnSave_Click(object sender, EventArgs e) { try { dtConfig.AcceptChanges(); string path = Application.ExecutablePath + ".config"; System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); if (File.Exists(path)) { doc.Load(path); foreach (DataRow row in dtConfig.Rows) { string configString = @"configuration/applicationSettings/" + DoService.pubService + ".Properties.Settings/setting[@name='" + row["ColumnTitle"].ToString() + "']/value"; System.Xml.XmlNode configNode = doc.SelectSingleNode(configString); if (configNode != null) { configNode.InnerText = row["ColumnValue"].ToString(); } } doc.Save(path); Properties.Settings.Default.Reload(); } DoService.WriteEventLog(DoService.pubService + " Save Config Success!"); this.DialogResult = DialogResult.OK; } catch (Exception ex) { DoService.WriteEventLog(DoService.pubService + " Save Config Failed!" + ex.Message); this.DialogResult = DialogResult.Cancel; } }