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(); } }
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(); }
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(); } }
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(); } } }