public void AutoRun_SetFilePath_Test() { var autoRun = new AutoRun(); autoRun.SetFilePath(System.Reflection.Assembly.GetExecutingAssembly().Location); Assert.AreEqual(true, autoRun.IsEnabled()); autoRun.SetFilePath(String.Empty); Assert.AreEqual(false, autoRun.IsEnabled()); }
private void SetAutorunState() { bool?autoRun = AutoRun.IsEnabled(); autoStartCheckbox.Enabled = autoRun.HasValue; autoStartCheckbox.Checked = autoRun ?? false; }
private async void FormMailTriggerLogic_Load(object sender, EventArgs e) { this.notifyIcon.Icon = new Icon(Application.StartupPath + "\\" + "MTP-beta-icon.ico"); this.notifyIcon.Text = "Mail Trigger Parser"; if (GLogin.Glogin == null) { GLogin.Init(); await GLogin.Glogin.CreateCredential(); GLogin.Glogin.CreateGmailService(); } gMessage = new GMessage(GLogin.Glogin.GmailService); calculate = new Calculate(GLogin.Glogin.GmailService); calculate.callbackFileName += Calculate_callbackFileName; calculate.callbackProgressBar += Calculate_callbackProgressBar; calculate.callbackAlert += Calculate_callbackAlert; this.Deactivate += FormMailTriggerLogic_Deactivate; if (AutoRun.IsEnabled()) { btn_start.Enabled = false; btn_stop.Enabled = true; thread = new Thread(new ThreadStart(calculate.Run)); thread.Start(); cb_autorun.Checked = true; this.WindowState = FormWindowState.Minimized; this.ShowInTaskbar = false; } else { btn_stop.Enabled = false; cb_autorun.Checked = false; } dataGridView.Rows.Clear(); l_version.Text = /* "Version : " + */ "beta " + Application.ProductVersion.ToString(); var data = await GLogin.Glogin.GmailService.Users.GetProfile("me").ExecuteAsync(); l_mail.Text = data.EmailAddress; l_status.Text = "tap start"; l_processedMessages.Text = "0"; foreach (string str in GRule.GetFiles()) { RowAdd(FileParser.Reads <GRule>(str)); } GRule.SetChange(false); this.Select(); }
private void cb_autorun_CheckedChanged(object sender, EventArgs e) { if (cb_autorun.Checked) { if (!AutoRun.IsEnabled()) { AutoRun.Enabled(); } } else if (AutoRun.IsEnabled()) { AutoRun.Disabled(); } }