Esempio n. 1
0
 public Form1()
 {
     InitializeComponent();
     DeviceFoundDelegate       = new DeviceFound(deviceFound);
     NewSMSDelegate            = new NewSMS(newSMS);
     PhoneStateChangedDelegate = new PhoneStateChanged(phoneStateChanged);
 }
Esempio n. 2
0
 public Form1()
 {
     InitializeComponent();
     DeviceFoundDelegate = new DeviceFound(deviceFound);
     NewSMSDelegate = new NewSMS(newSMS);
     PhoneStateChangedDelegate = new PhoneStateChanged(phoneStateChanged);
 }
Esempio n. 3
0
        /// <summary>
        /// Sends a new SMS message.
        /// </summary>
        /// <param name="sender">Sender must be one of the allowed senders from <see cref="GetAllowedSendersAsync"/></param>
        /// <param name="recipient">Recipient number in format 00xxxx, for example 00420 123 456 789</param>
        /// <param name="message">Text of message</param>
        /// <returns>Returns remaining credit.</returns>
        /// <exception cref="OdorikException">Throws when Odorik.cz refuses to send SMS. See <see cref="OdorikException.MessageCode" /> for details.</exception>
        public async Task <double> SendSmsAsync(string sender, string recipient, string message)
        {
            var sms = new NewSMS
            {
                Message   = message,
                Recipient = recipient,
                Sender    = sender
            };

            using (var client = new OdorikClient(Credentials))
            {
                var result = await client.PostAsync(sms, SendSMS);

                if (result.Contains(SmsSuccessfullySendFlag))
                {
                    var value = result.Replace(SmsSuccessfullySendFlag, string.Empty);
                    return(double.Parse(value, NumberStyles.Float, CultureInfo.InvariantCulture));
                }

                throw new OdorikException(result);
            }
        }
Esempio n. 4
0
 private static extern Int32 init(DeviceFound deviceFound, NewSMS newSMS, PhoneStateChanged phoneStateChanged, IntPtr param);
Esempio n. 5
0
 private static extern Int32 init(DeviceFound deviceFound, NewSMS newSMS, PhoneStateChanged phoneStateChanged, IntPtr param);