public string B() { string group = "HeatingByMotor"; string tagName = "SA"; string dryBulbTag = "FIX.SA_DBT.F_CV"; string absoluteHumidityTag= "FIX.SA_AH.F_CV"; double dryBulbValue = 0; double absoluteHumidityValue = 0; bool showTagName= false; string process = "HeatingByMotor"; RootObject root = new RootObject(); Tag t = new Tag(); t.group = group; t.tagName = tagName; t.dryBulbTag = dryBulbTag; t.dryBulbValue = dryBulbValue; t.absoluteHumidityTag = absoluteHumidityTag; t.absoluteHumidityValue = absoluteHumidityValue; t.showTagName = showTagName; List<Tag> tl = new List<Tag>(); tl.Add(t); Process p = new Process(); p.name = process; List<Process> pl = new List<Process>(); pl.Add(p); root.tags = tl; root.process = pl; string strJson = JsonConvert.SerializeObject(root, Formatting.Indented); System.IO.File.WriteAllText(@"C:\WriteText.json", strJson); return strJson; }
private void OnProcessAddButtonClick(object sender, EventArgs e) { if (this.processTextBox.Text.Equals("")) { return; } Process pp = this.processList.SingleOrDefault(T => T.name.Equals(this.processTextBox.Text)); if (pp != null) { MessageBox.Show("Process Name duplicate", "", MessageBoxButtons.OK, MessageBoxIcon.Information); this.processTextBox.Text = ""; return; } Process p = new Process(); p.name = this.processTextBox.Text; this.processList.Add(p); this.processListBox.Items.Add(p); this.processTextBox.Text = ""; }