private IWhatsAppNETAPI _wa; // deklarasi objek WhatsApp NET Client public FrmMain() { InitializeComponent(); _wa = new WhatsAppNETAPI.WhatsAppNETAPI(); _currentVersion = string.Format("v{0}", GetCurrentVersion()); this.Text = string.Format("WhatsApp Bot - Online Test {0}", _currentVersion); }
public FrmScanQRCode(IWhatsAppNETAPI whatsAppApi) { InitializeComponent(); this.BackColor = Color.FromArgb(0, 189, 164); _whatsAppApi = whatsAppApi; picQRCode.Image = _whatsAppApi.GetQRCode(); }
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(); } } }
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)) { while (!_whatsAppApi.OnReady()) { Thread.Sleep(1000); } btnStart.Enabled = false; btnStop.Enabled = true; btnKirim.Enabled = true; chkSubscribe.Enabled = true; } } }