示例#1
0
        public TempHumidPublishService()
        {
            m_MeasurementPublishers = new Dictionary <string, IPublisherCallback>();
            m_HumidityCallbacks     = new Dictionary <string, Dictionary <string, IMeasurementUserCallback> >();
            m_TemperatureCallbacks  = new Dictionary <string, Dictionary <string, IMeasurementUserCallback> >();
            //hm = new List<MyHumidityMeasurement>();
            //tm = new List<MyTemperatureMeasurement>();
            MyDbContext = new db1Entities1();

            //m_MyDbContext.

            List <TemperatureMeasurement> list  = m_MyDbContext.TemperatureMeasurements.ToList();
            List <HumidityMeasurement>    list1 = m_MyDbContext.HumidityMeasurements.ToList();
            List <Location> list3 = m_MyDbContext.Locations.ToList();
            List <RMUnit>   list2 = m_MyDbContext.RMUnits.ToList();


            MyLocations = GetLocations();
            Action <string> insert = (locationName) =>
            {
                m_MeasurementPublishers.Add(locationName, null);
            };

            MyLocations.ForEach(insert);
        }
        private void btnAddLocation2_Click(object sender, EventArgs e)
        {
            MyLocations oMyLocation = new MyLocations();

            oMyLocation.sMyLocationName    = lblSaveMyLocationName.Text;
            oMyLocation.sMyLocationAddress = lblSaveMyLocationAddress.Text;

            Crud oCrud = new Crud();

            oCrud.SaveNewLocation(oMyLocation);

            this.FormAddLocations.dataGridViewMyLocations.DataSource = oCrud.GetAllMyLocations();
            this.Hide();
        }