Ejemplo n.º 1
0
 private void backGroundWorker_DoWork(object sender, DoWorkEventArgs e)
 {
     System.ComponentModel.BackgroundWorker worker;
     worker = (System.ComponentModel.BackgroundWorker)sender;
     CarSens.Sensors.SensorList sList = (CarSens.Sensors.SensorList)e.Argument;
     sList.initialize(worker, e);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Constructor
        /// </summary>
        public SensorList()
        {
            InitializeComponent();

            panel1.Hide();
            bWorker.DoWork               += new DoWorkEventHandler(backGroundWorker_DoWork);
            bWorker.ProgressChanged      += new ProgressChangedEventHandler(backGroundWorker_ProgressChanged);
            bWorker.RunWorkerCompleted   += new RunWorkerCompletedEventHandler(backGroundWorker_Completed);
            bWorker.WorkerReportsProgress = true;
            btnClose.Hide();

            DataColumn type   = new DataColumn();
            DataColumn name   = new DataColumn();
            DataColumn sensor = new DataColumn();


            type.DataType   = Type.GetType("CarSens.Sensors.SensorType");
            sensor.DataType = Type.GetType("CarSens.Sensors.Sensor");


            termo = new DataTable("Thermo");
            termo.Columns.Add(type);
            termo.Columns.Add(name);
            termo.Columns.Add(sensor);

            therms = new SensorListThermo(termo);

            System.IO.MemoryStream stream = new System.IO.MemoryStream();
            termo.WriteXmlSchema(stream, true);


            gps             = new DataTable();
            stream.Position = 0;
            gps.ReadXmlSchema(stream);
            gps.TableName = "GPS";

            gpss = new SensorListGPS(gps);
            bWorker.RunWorkerAsync(gpss);

            volts           = new DataTable();
            stream.Position = 0;
            volts.ReadXmlSchema(stream);
            volts.TableName = "VOLTS";

            voltslist = new SensorListVolt(volts);

            //Sensor[] senses = SensorManager.getAllSensors();
            //assigned = new DataTable();
            //assigned.TableName = "AssignedSensors";
            //assigned.Columns.Add(name2);
            //assigned.Columns.Add(connected);
            //assigned.Columns.Add(sensor2);
            //set.Tables.Add(assigned);
            //assigned.PrimaryKey = new DataColumn[] {name2};
            //foreach (Sensor s in senses)
            //{
            //    assigned.Rows.Add(new Object[] { s.getIdentifier(), false, s });
            //}

            //loadList.Interval = 4000;
            //loadList.Enabled = true;
            this.updateSensorTables();
        }