예제 #1
0
 private void TimerChecker_Tick(object sender, EventArgs e)
 {
     if (periksaStatusOtomatisToolStripMenuItem.Checked &&
         !string.IsNullOrEmpty(TbxToken.Text.Trim()))
     {
         if (!BwChecker.IsBusy)
         {
             BwChecker.RunWorkerAsync();
         }
     }
 }
예제 #2
0
        private void BgCleaner_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e)
        {
            sWebhook.Token      = TbxToken.Text.Trim();
            sWebhook.UriClean   = TbxUri.Text.Trim();
            sWebhook.UriCurrent = TbxUriDefault.Text.Trim();

            if (!string.IsNullOrEmpty(sWebhook.Token) &&
                !string.IsNullOrEmpty(sWebhook.UriClean))
            {
                int count = sWebhook.GetWebhookInfo().PendingUpdateCount;
                tsProgBar.GetCurrentParent().Invoke((MethodInvoker) delegate
                {
                    tsProgBar.Maximum = count;
                });

                for (int x = 0; x <= count; count--)
                {
                    sWebhook.HapusWebhook();
                    sWebhook.GetUpdates();
                    sWebhook.SetWebhook();
                    count    = sWebhook.GetWebhookInfo().PendingUpdateCount;
                    e.Result = count;
                    tsProgBar.GetCurrentParent().Invoke((MethodInvoker) delegate
                    {
                        tsProgBar.Value = tsProgBar.Maximum - count;
                    });

                    //HControls.InvokeIfRequired(this, LblResult => LblResult.Text = "Sisa pendings : " + count);
                    LblResult.Invoke((MethodInvoker) delegate { LblResult.Text = "Sisa pending : " + count; });
                }

                if (!string.IsNullOrEmpty(sWebhook.UriCurrent) &&
                    SetURIHookSetBersihkanToolStripMenuItem.Checked)
                {
                    sWebhook.SetWebhookDefault();
                }

                if (!BwChecker.IsBusy)
                {
                    BwChecker.RunWorkerAsync();
                }
            }
            else
            {
                MessageBox.Show("Token & URI Clear Hook dibutuhkan!", Application.ProductName,
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #3
0
        private void BtnCek_Click(object sender, EventArgs e)
        {
            sWebhook.Token      = TbxToken.Text.Trim();
            sWebhook.UriClean   = TbxUri.Text.Trim();
            sWebhook.UriCurrent = TbxUriDefault.Text.Trim();

            try
            {
                sWebhook.SetWebhookDefault();
                tsLStatus.Text = "Webhook berhasil di set";
                BwChecker.RunWorkerAsync();
            }
            catch (Exception)
            {
                MessageBox.Show("Silakan tunggu hingga proses check selesai", Application.ProductName,
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }