示例#1
0
        private void processData()
        {
            /*int cO = 0;
            *  int cI = 0;*/
            ArrayList dataC = (ArrayList)dataIn.Clone();

            for (int i = 0; i < dataC.Count; i++)
            {
                string data = (string)dataC[i];

                var      regex = new Regex(@"\[([0-9]+)\]");
                string[] splt  = regex.Split(data);
                if (splt.Length == 3)
                {
                    DHTSensor s  = null;
                    int       ID = Int32.Parse(splt[1]);
                    try
                    {
                        s = (DHTSensor)DHTSensors[ID];
                    }
                    catch (Exception e)
                    {
                    }

                    if (s != null)
                    {
                        s.updateData(s.ParseInputData(splt[2]));
                    }
                }
                dataIn.RemoveAt(i);
                //cO++;
            }
        }
示例#2
0
        private void addSensor(string data)
        {
            var regex = new Regex(@"\[([0-9]+)\]");

            if (regex.IsMatch(data))
            {
                string[] spl = regex.Split(data);

                if (spl.Length == 3)
                {
                    if (spl[2].Contains("DHT"))
                    {
                        int ID = Int32.Parse(spl[1]);

                        string[] sensData = spl[2].Split(';');
                        Console.WriteLine("SENS CREATE:" + spl[2]);

                        DHTSensor s = new DHTSensor(ID, Int32.Parse(sensData[1]), Int32.Parse(sensData[2]), Int32.Parse(sensData[3]));

                        s.form.UpdateRefreshTime(sensData[3]);
                        //s.form.Dock = DockStyle.Fill;
                        TabPage myTabPage = new TabPage();//Create new tabpage
                        myTabPage.Text = s.tabName;

                        myTabPage.Controls.Add(s.form);

                        s.tab = myTabPage;


                        DHTSensors.Add(ID, s);


                        SensorListControl.Instance.addSensorTab(myTabPage);
                    }
                }
            }
        }
示例#3
0
 public DHTControlls(int id, DHTSensor inst)
 {
     InitializeComponent();
     sensorID    = id;
     dhtInstance = inst;
 }