Example #1
0
        private void MobileAccount_MessageEvent(object sender, SmsEventArgs smsEventArgs)
        {
            var receiverMobileAccount = _mobileAccounts.First(i => i.Value.Number == smsEventArgs.Number);
            var senderMobileAccount   = (MobileAccount)sender;

            receiverMobileAccount.Value.ReceiveMessage(senderMobileAccount.Number, smsEventArgs.Message);
            Log.Add(new Log(senderMobileAccount, receiverMobileAccount.Value, _messageRate));
        }
        private void MobileAccount_MessageEvent(object sender, SmsEventArgs smsEventArgs)
        {
            var doc               = XDocument.Load("contacts.xml");
            var XElement          = doc.Descendants("mobileAccount");
            var uniqCheckXElement = XElement.FirstOrDefault(x => x.Attribute("number").Value == smsEventArgs.Number.Number.ToString()).Attribute("number");

            if (uniqCheckXElement != null)
            {
                var mobileAccountReceiver = _mobileAccounts.FirstOrDefault(x => x.Key.Number == long.Parse(uniqCheckXElement.Value));
                var mobileAccountSender   = (MobileAccount)sender;
                mobileAccountReceiver.Value.ReceiveMessage(mobileAccountSender.Number, smsEventArgs.Message);
                Log.Add(new Log(mobileAccountSender, mobileAccountReceiver.Value, _messageRate));
            }
        }