示例#1
0
        private void Disconnect()
        {
            btnStart.Enabled = true;
            btnStop.Enabled  = false;

            using (new StCursor(Cursors.WaitCursor, new TimeSpan(0, 0, 0, 0)))
            {
                // unsubscribe event
                _wa.OnStartup         -= OnStartupHandler;
                _wa.OnReceiveMessage  -= OnReceiveMessageHandler;
                _wa.OnClientConnected -= OnClientConnectedHandler;

                _wa.Disconnect();
            }
        }
示例#2
0
        private void btnStop_Click(object sender, EventArgs e)
        {
            _whatsAppApi.Disconnect();

            btnStart.Enabled = true;
            btnStop.Enabled  = false;
            btnKirim.Enabled = false;

            chkSubscribe.Checked = false;
            chkSubscribe.Enabled = false;

            chkAutoReplay.Checked = false;
            chkAutoReplay.Enabled = false;

            lstPesanMasuk.Items.Clear();
        }
示例#3
0
        private void btnStop_Click(object sender, EventArgs e)
        {
            using (new StCursor(Cursors.WaitCursor, new TimeSpan(0, 0, 0, 0)))
            {
                _whatsAppApi.Disconnect();

                btnStart.Enabled        = true;
                btnStop.Enabled         = false;
                btnGrabContacts.Enabled = false;
                btnKirim.Enabled        = false;

                chkSubscribe.Checked = false;
                chkSubscribe.Enabled = false;

                chkAutoReplay.Checked = false;
                chkAutoReplay.Enabled = false;

                lstPesanMasuk.Items.Clear();
            }
        }
示例#4
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            _whatsAppApi = new WhatsAppNETAPI.WhatsAppNETAPI();

            var url = "https://web.whatsapp.com";

            using (new StCursor(Cursors.WaitCursor, new TimeSpan(0, 0, 0, 0)))
            {
                if (_whatsAppApi.Connect(url, chkHeadless.Checked))
                {
                    while (!_whatsAppApi.OnReady())
                    {
                        if (chkHeadless.Checked)
                        {
                            if (_whatsAppApi.IsScanMe())
                            {
                                var frmScanQRCode = new FrmScanQRCode(_whatsAppApi);
                                frmScanQRCode.ShowDialog();
                            }
                        }

                        Thread.Sleep(1000);
                    }

                    btnStart.Enabled        = false;
                    btnStop.Enabled         = true;
                    btnGrabContacts.Enabled = true;
                    btnKirim.Enabled        = true;

                    chkSubscribe.Enabled            = true;
                    chkMessageSentSubscribe.Enabled = true;
                }
                else
                {
                    _whatsAppApi.Disconnect();
                }
            }
        }