private void sendButton_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(this.toTextBox.Text) && !string.IsNullOrEmpty(this.msgTextBox.Text)) { var sms = new SMSClient(); try { this.Enabled = false; this.Cursor = Cursors.WaitCursor; if (!sms.Send(this.toTextBox.Text, this.msgTextBox.Text)) { FormManager.Alert("Wystapił bład w trakcie wysyłania SMSa"); } } catch (Exception ex) { throw ex; } finally { this.Cursor = Cursors.Default; this.Enabled = true; } } }
protected bool SendSMS(string number, string message) { SMSServiceConfiguration config = new SMSServiceDAO().GetSMSConfig(); SMSClientConfiguration clientConfig = new SMSClientConfiguration() { Username = config.Username , Password = config.Password , TestOnly = config.IsTest , Sender = config.Sender }; SMSClient client = new SMSClient(clientConfig); return(client.Send(number, message, config.IsFlash)); }