Beispiel #1
0
        public override void InitializeComponent()
        {
            base.InitializeComponent();

            //check for required components of the configuration file
            this.adc = this.FindComponentById("ADC") as ADC124S101;
            if (this.adc == null)
                throw new Exception("The component 'ADC' is required by the emulator.");

            // Start the UI in its own thread.
            Thread uiThread = new Thread(StartForm);
            uiThread.Start();
        }
Beispiel #2
0
        public Form1(ADC124S101 adc)
        {
            if (adc == null)
                throw new ArgumentNullException("adc");
            this.adc = adc;

            InitializeComponent();

            float supplyVoltageVolt = adc.SupplyVoltage / 1000.0f;
            this.maxVoltageLabel.Text = supplyVoltageVolt.ToString("F3") + " Volt";
            this.voltageTrackBar.Maximum = (int)(adc.SupplyVoltage - 1);
            this.voltageTrackBar.Value = (int)(this.voltageTrackBar.Maximum / 2.0 + 0.5);
            voltageTrackBar_Scroll(null, null);
        }