public Form1(TMP100Sensor temperatureSensor)
        {
            if (temperatureSensor == null)
            {
                throw new ArgumentNullException("temperatureSensor");
            }
            this.temperatureSensor = temperatureSensor;

            InitializeComponent();

            this.temperatureTrackBar.Value = (int)(this.temperatureSensor.Temperature * 1000.0);
            temperatureTrackBar_Scroll(null, null);
        }
Example #2
0
        public override void InitializeComponent()
        {
            base.InitializeComponent();

            //check for required components of the configuration file
            this.temperatorSensor = this.FindComponentById("TMP100") as TMP100Sensor;
            if (this.temperatorSensor == null)
            {
                throw new Exception("The component 'TMP100' is required by the emulator.");
            }

            // Start the UI in its own thread.
            Thread uiThread = new Thread(StartForm);

            uiThread.Start();
        }