public void BatchSendTest()
        {
            var sms = new SMSWSS10 {
                USER = "******", PASS = "******"
            };
            var numbers = new List <string> {
                "9999188636", "99992564186"
            };
            var message = "Buenos dias, amor :)";

            sms.SetBatchMessage(numbers, message);

            var response = service.BatchSend(sms);

            Debug.WriteLine(response);
        }
Esempio n. 2
0
        private void Send_Click(object sender, RoutedEventArgs e)
        {
            var worker = new BackgroundWorker();

            worker.DoWork += (o, ea) =>
            {
                try
                {
                    var selected = Contacts.Where(contact => contact.Selected).ToList();
                    var numbers  = selected.Select(contacto =>
                    {
                        if (contacto.ValidCellphone())
                        {
                            return(contacto.Cellphone);
                        }

                        throw new Exception("Número invalido para contacto " + contacto.Name);
                    }).ToList();

                    var username = Properties.Settings.Default.Username;
                    var password = Properties.Settings.Default.Password;

                    var sms = new SMSWSS10 {
                        USER = username, PASS = password
                    };
                    sms.SetBatchMessage(numbers, Message);

                    _service.BatchSend(sms);
                }
                catch (Exception error)
                {
                    Dispatcher.Invoke((Action)(() => MessageBox.Show(error.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error)));
                }
            };
            worker.RunWorkerCompleted += (o, ea) =>
            {
                BusyIndicator.IsBusy = false;
                Init();
            };

            BusyIndicator.IsBusy      = true;
            BusyIndicator.BusyContent = "Enviando mensaje...";
            worker.RunWorkerAsync();
        }