public async override Task OnShare(string text, string imageFilePath) { ShareService mailService = null; lock (Core.Globals.GeneralOptions.ShareServices) mailService = Core.Globals.GeneralOptions.ShareServices.FirstOrDefault(s => s.GetType().Name == "Mail" && s.Name == Email); if (mailService == null) { LogAndPrint(typeof(Custom.Resource), "ShareTextMessageUnknownEmailService", new[] { Email }, Cbi.LogLevel.Error); return; } string address = string.Empty; if (!string.IsNullOrEmpty(SmsAddress) && string.IsNullOrEmpty(MmsAddress)) { address = PhoneNumber.ToString(CultureInfo.InvariantCulture) + SmsAddress; } else if (string.IsNullOrEmpty(SmsAddress) && !string.IsNullOrEmpty(MmsAddress)) { address = PhoneNumber.ToString(CultureInfo.InvariantCulture) + MmsAddress; } else if (!string.IsNullOrEmpty(SmsAddress) && !string.IsNullOrEmpty(MmsAddress)) { if (string.IsNullOrEmpty(imageFilePath)) { address = PhoneNumber.ToString(CultureInfo.InvariantCulture) + SmsAddress; } else { address = PhoneNumber.ToString(CultureInfo.InvariantCulture) + MmsAddress; } } ShareService liveClone = mailService.Clone() as ShareService; try { if (liveClone != null) { liveClone.SetState(State.Active); await liveClone.OnShare(text, imageFilePath, new[] { address, string.Empty }); LogAndPrint(typeof(Custom.Resource), "ShareTextMessageSentSuccessfully", new[] { Name }, Cbi.LogLevel.Information); } } catch (Exception exp) { LogAndPrint(typeof(Custom.Resource), "ShareTextMessageErrorOnShare", new [] { liveClone.Name, exp.Message }, Cbi.LogLevel.Error); } finally { if (liveClone != null) { liveClone.SetState(State.Finalized); } } }