Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
 private void OnTagAddButtonClick(object sender, EventArgs e)
 {
     if (this.tagNameTextBox.Text.Equals("") || this.dryBulbTagTextBox.Text.Equals("")
         || this.absoluteHumidityTagTextBox.Text.Equals("") || this.dryBulbValueTextBox.Text.Equals("") || this.absoluteHumidityValueTextBox.Equals(""))
     {
         return;
     }
     else
     {
         string s = this.showTagNameCheckBox.Checked ? "show" : "hide";
        // this.tagListBox.Items.Add(this.groupTextBox.Text + " - " + this.tagNameTextBox.Text + " "+s);
         Tag t = new Tag();
         t.group = SelectedGroup.name;
         t.tagName = this.tagNameTextBox.Text;
         t.dryBulbTag = this.dryBulbTagTextBox.Text;
         t.absoluteHumidityTag = this.absoluteHumidityTagTextBox.Text;
         t.dryBulbValue = double.Parse(this.dryBulbValueTextBox.Text);
         t.absoluteHumidityValue = double.Parse(this.absoluteHumidityValueTextBox.Text);
         t.showTagName = this.showTagNameCheckBox.Checked;
         this.tagList.Add(t);
         this.tagListBox.Items.Add(t);
         this.tagNameTextBox.Text = "";
         this.dryBulbTagTextBox.Text = "";
         this.absoluteHumidityTagTextBox.Text = "";
     }
 }