Ejemplo n.º 1
0
        private void LogShow_Load(object sender, EventArgs e)
        {
            Data2File.CheckDirs();

            string[] filenames = Directory.GetFiles(Data2File.GetOperFolder());
            foreach (string filename in filenames)
            {
                LstLogs.Items.Add(Name2Time(Path.GetFileNameWithoutExtension(filename)));
            }
        }
Ejemplo n.º 2
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            // Check and create folders for data saving
            Data2File.CheckDirs();

            #region Load configuration .ini file
            // If there is no config file, create one and write default value to it
            if (!File.Exists(configFilePath))
            {
                IniReadWrite.INIWriteValue(configFilePath, configSec, "COM", "COM1");
                IniReadWrite.INIWriteValue(configFilePath, configSec, "TempThr", "0.01");
                IniReadWrite.INIWriteValue(configFilePath, configSec, "FlucThr", "0.01");
                IniReadWrite.INIWriteValue(configFilePath, configSec, "ReadInterval", "1000");
            }

            // Get COM port and set it
            GlbVars.uartCom =
                new UartProtocol(IniReadWrite.INIGetStringValue(configFilePath, configSec, "COM", "COM1"));
            this.StaCom.Text = GlbVars.portName;

            // Get temperature and fluctuation threshold
            GlbVars.paraValues[(int)GlbVars.Paras_t.TempThr] =
                float.Parse(IniReadWrite.INIGetStringValue(configFilePath, configSec, "TempThr", "0.01"));

            GlbVars.paraValues[(int)GlbVars.Paras_t.FlucThr] =
                float.Parse(IniReadWrite.INIGetStringValue(configFilePath, configSec, "FlucThr", "0.01"));

            // Get read timer.interval
            GlbVars.readTempInterval =
                int.Parse(IniReadWrite.INIGetStringValue(configFilePath, configSec, "ReadInterval", "1000"));
            #endregion

            // Init check timer, use readTempTimer to replace
            GlbVars.tempReadTimer.Interval = GlbVars.readTempInterval;
            GlbVars.tempReadTimer.Elapsed += CheckTimer_Tick;

            // Init blink timer
            blinkTimer.Interval = 1000;
            blinkTimer.Elapsed += BlinkTimer_Elapsed;
        }