public frmMain() { InitializeComponent(); try { // init form basic info. this.Text = "Simple Task Scheduler- v" + Application.ProductVersion; this.Left = (Screen.GetWorkingArea(this).Width - this.Width) / 2; this.Top = (Screen.GetWorkingArea(this).Height - this.Height) / 2; // init logging myLog = new Log(Application.StartupPath + "\\Log"); // read ini lsINIPath = Application.StartupPath + "\\" + _INI_FILE; if (System.IO.File.Exists(lsINIPath) == false) { MessageBox.Show("INI " + lsINIPath + " NOT EXIST!", this.Text, MessageBoxButtons.OK); return; } else { lsConfig = new APConfig(lsINIPath); } // get task info from ini lsTaskList = lsConfig.getConfig(); loadTaskInfoIntoGrid(dgrTaskList); tmrTaskExecutor.Interval = 30000; lsToken = true; if (lsConfig.AutoStart) { btnStart_Click(null, null); myLog.WriteLog("autostart set to true. auto enable tmrTaskExecutor"); } myLog.WriteLog("timer interval set to " + tmrTaskExecutor.Interval.ToString()); myLog.WriteLog("loading config file OK - " + lsINIPath); myLog.WriteLog("ap started successfully"); return; } catch (Exception ex) { showErrorMessage(ex); } }
public frmMain() { InitializeComponent(); try { // init form basic info. this.Text = "Simple Task Scheduler- v" + Application.ProductVersion; this.Left = (Screen.GetWorkingArea(this).Width - this.Width) / 2; this.Top = (Screen.GetWorkingArea(this).Height - this.Height) / 2; // init logging myLog = new Log(Application.StartupPath + "\\Log"); // read ini lsINIPath = Application.StartupPath + "\\" + _INI_FILE; if (System.IO.File.Exists(lsINIPath) == false) { MessageBox.Show("INI " + lsINIPath + " NOT EXIST!", this.Text, MessageBoxButtons.OK); return; } else { lsConfig = new APConfig(lsINIPath); } // get task info from ini lsTaskList = lsConfig.getConfig(); loadTaskInfoIntoGrid(dgrTaskList); tmrTaskExecutor.Interval = 30000; lsToken = true; if (lsConfig.AutoStart) { btnStart_Click(null, null); myLog.WriteLog("autostart set to true. auto enable tmrTaskExecutor"); } myLog.WriteLog("timer interval set to " + tmrTaskExecutor.Interval.ToString()); myLog.WriteLog("loading config file OK - " + lsINIPath); myLog.WriteLog("ap started successfully"); return; } catch (Exception ex) { showErrorMessage(ex); } }