示例#1
0
        private void RunSensors(object climatControl)
        {
            ClimatControl climat = climatControl as ClimatControl;

            if (climat != null)
            {
                Random random = new Random();
                while (true)
                {
                    climat.SensorTemperat.CurrentTemperature =
                        random.Next(climat.Temperature - 3, climat.Temperature + 3);
                    climat.SensorHumid.CurrentHumidity =
                        random.Next(climat.Humidity - 3, climat.Humidity + 3);
                    Thread.Sleep(10000);
                }
            }
        }
示例#2
0
        public void Run()
        {
            if (Home.Remote != null)
            {
                ClimatControl climat = GetClimatContol("hall");
                if (climat != null)
                {
                    climat.State = StateOnOff.On;
                    Task.Factory.StartNew(RunSensors, climat);
                }

                do
                {
                    Home.Remote.Write();
                    Home.Remote.ReadCommand();
                    Home.Remote.PushButton();
                    Home.Remote.Write();
                    Home.Remote.ClearDataCommand();
                    SerDesHouse.Save(Home);
                } while (true);
            }
        }