Пример #1
0
        void SaveConfig()
        {
            //Output Timer
            GlobalVars.config_celsius = radioCelsius.Checked;
            GlobalVars.config_fahrenheit = radioFahrenheit.Checked;
            GlobalVars.config_list = checkboxlist.Checked;
            GlobalVars.config_listitems = Convert.ToInt32(numericUpDownlistItems.Value);
            GlobalVars.config_timer = checkboxtimer.Checked;
            GlobalVars.config_timercount = Convert.ToInt32(timercount.Value);

            //Graph
            GlobalVars.config_graph = checkboxgraph.Checked;
            GlobalVars.config_graph_auto = checkBoxAutoSizeGraph.Checked;
            GlobalVars.config_graph_max = Convert.ToDouble(numericUpDownGraphScaleMax.Value);
            GlobalVars.config_graph_min = Convert.ToDouble(numericUpDownGraphScaleMin.Value);

            GlobalVars.config_devicename1 = textBoxDeviceName1.Text;
            GlobalVars.config_devicename2 = textBoxDeviceName2.Text;
            GlobalVars.config_devicename3 = textBoxDeviceName3.Text;
            GlobalVars.config_devicename4 = textBoxDeviceName4.Text;

            //File Recording
            GlobalVars.config_recordtofile = checkboxrecordtofile.Checked;
            GlobalVars.config_dailyfiles = checkboxdailyfiles.Checked;
            GlobalVars.config_csv = radioCSV.Checked;
            GlobalVars.config_txt = radioTXT.Checked;
            GlobalVars.config_filepath = textboxpath.Text;

            //FTP Upload
            GlobalVars.config_ftpactive = checkBoxftp.Checked;
            GlobalVars.config_ftpserver = textBox_ftpserver.Text;
            GlobalVars.config_ftpport = textBox_ftpport.Text;
            GlobalVars.config_ftpuser = textBox_ftpuser.Text;
            GlobalVars.config_ftppass = textBox_ftppass.Text;
            GlobalVars.config_ftpuploaddir = textBox_ftpuploaddir.Text;
            GlobalVars.config_ftpuploadgraph = checkBoxFTPUploadGraph.Checked;

            //E-Mail
            GlobalVars.config_mail_server = textBoxEmailServer.Text;
            GlobalVars.config_mail_server_port = textBoxEmailPort.Text;
            GlobalVars.config_mail_user = textBoxEmailUsername.Text;
            GlobalVars.config_mail_password = textBoxEmailPassword.Text;
            GlobalVars.config_mail_from = textBoxEmailFromAddress.Text;
            GlobalVars.config_mail_to = textBoxEmailReceipientAddress.Text;

            //Web URL Grabber
            GlobalVars.config_url = textBoxURL.Text;
            GlobalVars.wugid = WUG_ID.Text;
            GlobalVars.wugpw = WUG_PW.Text;
            GlobalVars.config_urlactive = checkBoxURLactivated.Checked;
            GlobalVars.wugactive = WUG_Active.Checked;

            //BuiltIn Webserver
            GlobalVars.config_BIWActivated = checkBoxBIWActivated.Checked;
            GlobalVars.config_BIWPort = Convert.ToInt32(updownBIWPort.Value);
            GlobalVars.config_BIWRefresh = checkBoxBIWEnableRefresh.Checked;

            GlobalVars.config_BIWXMLActivated = checkBoxBIWXMLActivated.Checked;
            GlobalVars.config_BIWXMLPort = Convert.ToInt32(updownBIWXMLPort.Value);
            GlobalVars.config_BIWXMLRefreshOnAccess = checkBoxBIWXMLRefresh.Checked;
            GlobalVars.config_BIWTitle = textBoxBIW.Text;

            //Proxy DEBUG
            GlobalVars.config_proxyactivated = checkBoxproxy.Checked;
            GlobalVars.config_proxyuseauthetification = checkBoxuseauth.Checked;
            GlobalVars.config_proxyhost = textBoxproxyserver.Text;
            GlobalVars.config_proxyport = textBoxproxyport.Text;
            GlobalVars.config_proxyuser = textBoxproxyusername.Text;
            GlobalVars.config_proxypass = textBoxproxypassword.Text;
            GlobalVars.config_debug = checkBoxdebug.Checked;
            GlobalVars.config_faketemper = checkBoxfaketemper.Checked;
            GlobalVars.config_log = checkBoxLog.Checked;
            GlobalVars.config_rebootonerror = checkBoxrebootonerror.Checked;

            //TEMPer
            GlobalVars.config_temperautodetect = checkBoxTEMPerAutoDetect.Checked;
            if (comboBoxCOMPorts.SelectedIndex > -1)
            {
                GlobalVars.config_comport = comboBoxCOMPorts.Items[comboBoxCOMPorts.SelectedIndex].ToString();
            }

            GlobalVars.config_calibration_temp = Convert.ToDouble(numericUpDownTempCorrection.Value);
            GlobalVars.config_calibration_humidity = Convert.ToDouble(numericUpDownHumidityCorrection.Value);

            GlobalVars.config_tempcalo1 = Convert.ToDouble(textBoxTempCalO1.Text);
            GlobalVars.config_tempcalo2 = Convert.ToDouble(textBoxTempCalO2.Text);
            GlobalVars.config_tempcalo3 = Convert.ToDouble(textBoxTempCalO3.Text);
            GlobalVars.config_tempcalo4 = Convert.ToDouble(textBoxTempCalO4.Text);

            GlobalVars.config_tempcals1 = Convert.ToDouble(textBoxTempCalS1.Text);
            GlobalVars.config_tempcals2 = Convert.ToDouble(textBoxTempCalS2.Text);
            GlobalVars.config_tempcals3 = Convert.ToDouble(textBoxTempCalS3.Text);
            GlobalVars.config_tempcals4 = Convert.ToDouble(textBoxTempCalS4.Text);

            GlobalVars.config_humcalo1 = Convert.ToDouble(textBoxHumCalO1.Text);
            GlobalVars.config_humcalo2 = Convert.ToDouble(textBoxHumCalO2.Text);
            GlobalVars.config_humcalo3 = Convert.ToDouble(textBoxHumCalO3.Text);
            GlobalVars.config_humcalo4 = Convert.ToDouble(textBoxHumCalO4.Text);

            GlobalVars.config_humcals1 = Convert.ToDouble(textBoxHumCalS1.Text);
            GlobalVars.config_humcals2 = Convert.ToDouble(textBoxHumCalS2.Text);
            GlobalVars.config_humcals3 = Convert.ToDouble(textBoxHumCalS3.Text);
            GlobalVars.config_humcals4 = Convert.ToDouble(textBoxHumCalS4.Text);

            //LangFile
            GlobalVars.config_langfile = listBoxLangFile.Items[listBoxLangFile.SelectedIndex].ToString();

            //General
            GlobalVars.config_autostart = checkBoxAutoStart.Checked;
            GlobalVars.config_startminimized = checkBoxStartMinimized.Checked;

            //Alert System
            GlobalVars.config_alert_tempmax1 = Convert.ToDouble(numericUpDownTempMax1.Value);
            GlobalVars.config_alert_tempmin1 = Convert.ToDouble(numericUpDownTempMin1.Value);
            GlobalVars.config_alert_hummax1 = Convert.ToDouble(numericUpDownHumMax1.Value);
            GlobalVars.config_alert_hummin1 = Convert.ToDouble(numericUpDownHumMin1.Value);
            GlobalVars.config_alert_humemail1 = checkBoxHumAlertEMailNotify1.Checked;
            GlobalVars.config_alert_humonscreen1 = checkBoxHumAlertOnscreenNotify1.Checked;
            GlobalVars.config_alert_tempemail1 = checkBoxTempAlertEMailNotify1.Checked;
            GlobalVars.config_alert_temponscreen1 = checkBoxTempAlertOnscreenNotify1.Checked;

            GlobalVars.config_alert_tempmax2 = Convert.ToDouble(numericUpDownTempMax2.Value);
            GlobalVars.config_alert_tempmin2 = Convert.ToDouble(numericUpDownTempMin2.Value);
            GlobalVars.config_alert_hummax2 = Convert.ToDouble(numericUpDownHumMax2.Value);
            GlobalVars.config_alert_hummin2 = Convert.ToDouble(numericUpDownHumMin2.Value);
            GlobalVars.config_alert_humemail2 = checkBoxHumAlertEMailNotify2.Checked;
            GlobalVars.config_alert_humonscreen2 = checkBoxHumAlertOnscreenNotify2.Checked;
            GlobalVars.config_alert_tempemail2 = checkBoxTempAlertEMailNotify2.Checked;
            GlobalVars.config_alert_temponscreen2 = checkBoxTempAlertOnscreenNotify2.Checked;

            GlobalVars.config_alert_tempmax3 = Convert.ToDouble(numericUpDownTempMax3.Value);
            GlobalVars.config_alert_tempmin3 = Convert.ToDouble(numericUpDownTempMin3.Value);
            GlobalVars.config_alert_hummax3 = Convert.ToDouble(numericUpDownHumMax3.Value);
            GlobalVars.config_alert_hummin3 = Convert.ToDouble(numericUpDownHumMin3.Value);
            GlobalVars.config_alert_humemail3 = checkBoxHumAlertEMailNotify3.Checked;
            GlobalVars.config_alert_humonscreen3 = checkBoxHumAlertOnscreenNotify3.Checked;
            GlobalVars.config_alert_tempemail3 = checkBoxTempAlertEMailNotify3.Checked;
            GlobalVars.config_alert_temponscreen3 = checkBoxTempAlertOnscreenNotify3.Checked;

            GlobalVars.config_alert_tempmax4 = Convert.ToDouble(numericUpDownTempMax4.Value);
            GlobalVars.config_alert_tempmin4 = Convert.ToDouble(numericUpDownTempMin4.Value);
            GlobalVars.config_alert_hummax4 = Convert.ToDouble(numericUpDownHumMax4.Value);
            GlobalVars.config_alert_hummin4 = Convert.ToDouble(numericUpDownHumMin4.Value);
            GlobalVars.config_alert_humemail4 = checkBoxHumAlertEMailNotify4.Checked;
            GlobalVars.config_alert_humonscreen4 = checkBoxHumAlertOnscreenNotify4.Checked;
            GlobalVars.config_alert_tempemail4 = checkBoxTempAlertEMailNotify4.Checked;
            GlobalVars.config_alert_temponscreen4 = checkBoxTempAlertOnscreenNotify4.Checked;

            Config myconfig = new Config();
            myconfig.SaveConfig();
        }
Пример #2
0
        public void progEnd()
        {
            Alert.Hide();

            try
            {
                if (myWebServer != null) myWebServer.Stop();
                if (myXMLWebServer != null) myXMLWebServer.Stop();
            }
            catch { }

            DateTime timeout = DateTime.Now.AddSeconds(15);

            while ((GlobalVars.refreshIsActive || GlobalVars.uploadIsActive || GlobalVars.threadIsActive
                || GlobalVars.urlthreadIsActive || GlobalVars.ftpthreadIsActive) && timeout > DateTime.Now) Thread.Sleep(0);

            Thread.Sleep(500);

            Config myconfig = new Config();
            myconfig.SaveConfig();
        }