/// <summary> /// Shows message status notification. /// </summary> public static void ShowNotification(OutboundMessage message, MessageDeliveryStatus status) { Argument.ExpectNotNull(() => message); string notificationHeader; if (message is SmsMessage) { notificationHeader = ResourcesHelper.GetString("SMS"); } else if (message is MmsMessage) { notificationHeader = ResourcesHelper.GetString("MMS"); } else { throw new NotSupportedException(String.Format(CultureInfo.InvariantCulture, "Message type {0} is not supported", message.GetType().Name)); } XmlDocument toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText01); XmlNodeList textElements = toastXml.GetElementsByTagName("text"); var builder = new StringBuilder(); builder.Append(notificationHeader); builder.Append(" "); builder.Append(ResourcesHelper.GetString("MessageSentTo")); builder.Append(" "); string phones = String.Join(", ", message.PhoneNumbers.Select(n => n.Number)); builder.Append(phones); builder.Append(" "); switch (status) { case MessageDeliveryStatus.DeliveredToNetwork: builder.Append(ResourcesHelper.GetString("SuccessfullySent")); break; case MessageDeliveryStatus.DeliveredToTerminal: builder.Append(ResourcesHelper.GetString("SuccessfullyDelivered")); break; case MessageDeliveryStatus.DeliveryImpossible: builder.Append(ResourcesHelper.GetString("NotDelivered")); break; case MessageDeliveryStatus.Error: builder.Append(ResourcesHelper.GetString("Error")); break; } textElements[0].InnerText = builder.ToString(); var toast = new ToastNotification(toastXml); ToastNotificationManager.CreateToastNotifier().Show(toast); }