public string Send(string targetNumber, string message)
        {
            var result = string.Empty;

            try
            {
                var sms = new com.payamak_panel.api.Send();

                result = sms.SendSimpleSMS2(
                    _config.Username,
                    _config.Password,
                    targetNumber,
                    _config.Number,
                    message,
                    false);

                sms.Dispose();

                return(result);
            }
            catch
            {
                return(result);
            }
        }
        public Task <string> SendAsync(string targetNumber, string message, System.Threading.CancellationToken cancellation)
        {
            var tcs = new TaskCompletionSource <string>();

            try
            {
                var sms = new com.payamak_panel.api.Send();

                sms.SendSimpleSMS2Completed += new SendSimpleSMS2CompletedEventHandler((sender, args) =>
                {
                    if (args.Error != null)
                    {
                        tcs.TrySetException(args.Error);
                    }
                    else
                    if (!args.Cancelled)
                    {
                        tcs.SetResult(args.Result);
                    }
                    else
                    {
                        tcs.SetCanceled();
                    }

                    sms.Dispose();
                });

                cancellation.Register(() => sms.CancelAsync(_config.Number));

                sms.SendSimpleSMS2Async(_config.Username,
                                        _config.Password,
                                        targetNumber,
                                        _config.Number,
                                        message,
                                        false, _config.Number);
            }
            catch (Exception e)
            {
                tcs.SetException(e);
            }

            return(tcs.Task);
        }