示例#1
0
        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();
        }
示例#2
0
 private void deleteAll_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show(null, "Are you sure?", "Attention", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         foreach (string str in GRule.GetFiles())
         {
             Act.FileParser.Delete(str);
         }
         dataGridView.Rows.Clear();
     }
 }