コード例 #1
0
        public Monitor(string comName, string comName2, bool english, bool showingLog, bool calibrationEnabled, decimal timerDelay, bool timerToggle, int timerTime)
        {
            InitializeComponent();
            this.DataHandler    = new PPG_Data_Handler(this, calibrationEnabled, timerDelay);
            this.timerEnabled   = timerToggle;
            this.timerTotalTime = timerTime;
            this.english        = english;
            chartTimer.Interval = (int)(timerDelay);

            PPG1.PortName = comName;
            PPG2.PortName = comName2;

            initialize_chart_manager();
            initialize_English(english);

            initialize_buttons();
            initialize_timer(timerToggle);
            update_ComboBox();
            resize();

            if (showingLog)
            {
                PPGLogger.setOutputTextBox(ref debuggingTextBox);
                PPGLogger.log("PPGLogger to textbox enabled.");
            }

            try
            {
                initialize_com_ports();
            }
            catch (Exception e1)
            {
                MessageBox.Show("Could not connect with glove, please try again. If the problem stays, please reset the device.", "Connection error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                PPGLogger.log("Opening port error " + e1.StackTrace);
                this.Dispose();
                return;
            }
            if (!showingLog)
            {
                disable_debug_textbox();
            }
        }