private async void btnEmail_Click(object sender, System.Windows.Input.GestureEventArgs e) { try { StackPanel oSPName = (StackPanel)sender; EmailComposeTask emailcomposer = new EmailComposeTask(); if (this.IsGroup) { GroupTableEntity oData = (GroupTableEntity)oSPName.DataContext; emailcomposer.To = oData.Email; } else if (this.IsLocateBuddy) { LocateBuddyTableEntity oData = (LocateBuddyTableEntity)oSPName.DataContext; emailcomposer.To = oData.Email; } else { BuddyTableEntity oData = (BuddyTableEntity)oSPName.DataContext; emailcomposer.To = oData.Email; } string strMessage = Constants.MessageTemplateText; if (Globals.CurrentProfile.MessageTemplate.Trim() != string.Empty) { strMessage = Globals.CurrentProfile.MessageTemplate; } if (this.IsLocateBuddy) { strMessage = "I'm reaching to help you"; } emailcomposer.Subject = strMessage; emailcomposer.Body = this.IsLocateBuddy ? Constants.LocateBuddyMessageText : await Utility.GetDistressMessage(); emailcomposer.Show(); } catch (Exception) { CallErrorHandler(); } }
private async void btnSMSBuddy_click(object sender, System.Windows.Input.GestureEventArgs e) { try { StackPanel oSPName = (StackPanel)sender; string message = this.IsLocateBuddy ? Constants.LocateBuddyMessageText : await Utility.GetDistressMessage(); if (this.IsGroup) { GroupTableEntity oData = (GroupTableEntity)oSPName.DataContext; Utility.SendSMS(new SMSMessage() { PhoneNumbers = oData.PhoneNumber, Message = message }); } else if (this.IsLocateBuddy) { LocateBuddyTableEntity oData = (LocateBuddyTableEntity)oSPName.DataContext; Utility.SendSMS(new SMSMessage() { PhoneNumbers = oData.PhoneNumber, Message = message }); } else { BuddyTableEntity oData = (BuddyTableEntity)oSPName.DataContext; Utility.SendSMS(new SMSMessage() { PhoneNumbers = oData.PhoneNumber, Message = message }); } } catch (Exception ex) { CallErrorHandler(); } }