void Scenario5DisplayToastWithCallbacks_Click(object sender, RoutedEventArgs e) { IToastText02 toastContent = ToastContentFactory.CreateToastText02(); // Set the launch activation context parameter on the toast. // The context can be recovered through the app Activation event toastContent.Launch = "Context123"; toastContent.TextHeading.Text = "Tap toast"; toastContent.TextBodyWrap.Text = "Or swipe to dismiss"; // You can listen for the "Activated" event provided on the toast object // or listen to the "OnLaunched" event off the Windows.UI.Xaml.Application // object to tell when the user clicks the toast. // // The difference is that the OnLaunched event will // be raised by local, scheduled and cloud toasts, while the event provided by the // toast object will only be raised by local toasts. // // In this example, we'll use the event off the CoreApplication object. scenario5Toast = toastContent.CreateNotification(); scenario5Toast.Dismissed += toast_Dismissed; scenario5Toast.Failed += toast_Failed; ToastNotificationManager.CreateToastNotifier().Show(scenario5Toast); }
private async void reminder_button_Click(object sender, RoutedEventArgs e) { MessageDialog showDialog = new MessageDialog("wenst u een reminder een half uur voor de afspraak ?"); showDialog.Commands.Add(new UICommand("Ok") { Id = 0 }); showDialog.Commands.Add(new UICommand("Cancel") { Id = 1 }); showDialog.DefaultCommandIndex = 1; var result = await showDialog.ShowAsync(); if ((int)result.Id == 1) { Frame.Navigate(typeof(Newsfeed)); } if ((int)result.Id == 0) { String[] datumFormat = datum.Text.Split('/'); String[] tijdformat = tijd.Text.Split(':'); DateTime datumNotification = new DateTime(Int32.Parse(datumFormat[2]), Int32.Parse(datumFormat[0]), Int32.Parse(datumFormat[1]), Int32.Parse(tijdformat[0]), Int32.Parse(tijdformat[1]), Int32.Parse(tijdformat[2])); datumNotification.AddMinutes(-30); IToastText02 toast = ToastContentFactory.CreateToastText02(); toast.TextHeading.Text = newsitem.Titel;; toast.TextBodyWrap.Text = newsitem.Inhoud; ScheduledToastNotification toastNotification = new ScheduledToastNotification(toast.GetXml(), datumNotification); toastNotification.Id = "id"; ToastNotificationManager.CreateToastNotifier().AddToSchedule(toastNotification); Frame.Navigate(typeof(Newsfeed)); } }
private void AttachNotifications(BackgroundUploader uploader, IUpload upload) { var successToast = ToastContentFactory.CreateToastText02(); successToast.Audio.Content = ToastAudioContent.SMS; successToast.TextHeading.Text = _locService["Toast_Uploads_SuccessReturn_Text"]; successToast.TextBodyWrap.Text = upload.Uploadable.Name; var successXml = successToast.GetXml(); ToastAudioHelper.SetSuccessAudio(successXml); var successNotification = new ToastNotification(successXml); var failToast = ToastContentFactory.CreateToastText02(); failToast.Audio.Content = ToastAudioContent.IM; failToast.TextHeading.Text = _locService["Toast_Uploads_Fail_Text"]; failToast.TextBodyWrap.Text = upload.Uploadable.Name; var failXml = failToast.GetXml(); ToastAudioHelper.SetFailAudio(failXml); var failNotification = new ToastNotification(failXml); uploader.SuccessToastNotification = successNotification; uploader.FailureToastNotification = failNotification; }
/// <summary> /// Post弹出消息对话框系统APP图片 /// </summary> /// <param name="title">主题</param> /// <param name="description">内容</param> public static void DisplayTextTost(string title, string description, ToastAudioContent toastAudioContent = ToastAudioContent.Default) { //var toastXml = ToastNotificationManager.GetTemplateContent(ToastTemplateType.ToastText02); //var textElements = toastXml.GetElementsByTagName("text"); //for (uint i = 0; i < textElements.Length; i++) //{ // string text = null; // if (i == 0) text = title; // else if (i == 1) text = description; // if (text != null) // textElements.Item(i).AppendChild(toastXml.CreateTextNode(text)); //} //var toast = new ToastNotification(toastXml); //ToastNotificationManager.CreateToastNotifier().Show(toast); IToastText02 toastContent = ToastContentFactory.CreateToastText02(); toastContent.TextHeading.Text = title; toastContent.TextBodyWrap.Text = description; toastContent.Audio.Content = toastAudioContent; ToastNotification toast = toastContent.CreateNotification(); ToastNotificationManager.CreateToastNotifier().Show(toast); }
void DisplayLongToast(bool loopAudio) { IToastText02 toastContent = ToastContentFactory.CreateToastText02(); // Toasts can optionally be set to long duration toastContent.Duration = ToastDuration.Long; toastContent.TextHeading.Text = "Long Duration Toast"; if (loopAudio) { toastContent.Audio.Loop = true; toastContent.Audio.Content = ToastAudioContent.LoopingAlarm; toastContent.TextBodyWrap.Text = "Looping audio"; } else { toastContent.Audio.Content = ToastAudioContent.IM; } scenario6Toast = toastContent.CreateNotification(); ToastNotificationManager.CreateToastNotifier().Show(scenario6Toast); rootPage.NotifyUser(toastContent.GetContent(), NotifyType.StatusMessage); }
void ScheduleToast(String updateString, DateTime dueTime, int idNumber) { // Scheduled toasts use the same toast templates as all other kinds of toasts. IToastText02 toastContent = ToastContentFactory.CreateToastText02(); toastContent.TextHeading.Text = updateString; toastContent.TextBodyWrap.Text = "Received: " + dueTime.ToLocalTime(); ScheduledToastNotification toast; if (RepeatBox.IsChecked != null && (bool)RepeatBox.IsChecked) { toast = new ScheduledToastNotification(toastContent.GetXml(), dueTime, TimeSpan.FromSeconds(60), 5); // You can specify an ID so that you can manage toasts later. // Make sure the ID is 15 characters or less. toast.Id = "Repeat" + idNumber; } else { toast = new ScheduledToastNotification(toastContent.GetXml(), dueTime); toast.Id = "Toast" + idNumber; } ToastNotificationManager.CreateToastNotifier().AddToSchedule(toast); rootPage.NotifyUser("Scheduled a toast with ID: " + toast.Id, NotifyType.StatusMessage); }
/// <summary> /// Permet d'enregistrer un toast à afficher à une date précise /// </summary> /// <param name="titre">le titre du Toast</param> /// <param name="phrase">La phrase du toast</param> /// <param name="activationTime">la date d'activation</param> /// <param name="idNotif">l'id du toast</param> /// <param name="minute">le nombre de minutes avant une répétition (0 pour aucun)</param> /// <param name="repeat">le nombre de répétition (0 pour aucun)</param> public static void LancerToast(string titre, string phrase, DateTime activationTime, int idNotif, int minute, uint repeat) { //création du toast var toastContent = ToastContentFactory.CreateToastText02(); toastContent.TextHeading.Text = titre; toastContent.TextBodyWrap.Text = phrase; ScheduledToastNotification toast; if (minute > 0 && repeat > 0) { toast = new ScheduledToastNotification(toastContent.GetXml(), activationTime, TimeSpan.FromMinutes(minute), repeat) { Id = idNotif.ToString() }; } else { toast = new ScheduledToastNotification(toastContent.GetXml(), activationTime) { Id = idNotif.ToString() }; } ToastNotificationManager.CreateToastNotifier().AddToSchedule(toast); }
public void SubmitNewTask() { String head = taskHeader; String cont = taskContent; DateTime output = taskDate; String valid = Validate(head, cont, output); if (valid.Equals("true")) { //UKRYJ TWORZENIE KARTECZKi isNewTaskVisible = Visibility.Collapsed; taskHeader = ""; taskContent = ""; //taskDate = ""; //STWORZ DATE ZE STRINGA //DateTime output; //DateTime.TryParseExact(dat, "dd.MM.yyyy", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out output); //UTWORZ KARTECZKE int lastId = GetLastID(); Note custom = new Note { id = lastId, parentid = 0, header = head, content = cont, date = output }; //ADD #1 custom.header = custom.header + " #1"; //UTWÓRZ NOW¥ LISTE var empty = new CollectionRepresentation { NoteCollection = new ObservableCollection <Note>() }; //DODAJ KARTECZKE DO LISTY empty.NoteCollection.Add(custom); //DODAJ LISTE DO GRIDVIEW NotesCollection.Add(empty); //WYSWIETL KOMUNIKAT SUKCESU IToastText02 notification = ToastContentFactory.CreateToastText02(); notification.TextHeading.Text = "Sukces"; notification.TextBodyWrap.Text = "Utworzono now¹ karteczkê!"; notification.Duration = ToastDuration.Short; ToastNotification not = new ToastNotification(notification.GetXml()); ToastNotificationManager.CreateToastNotifier().Show(not); } else { //WYSWIETL KOMUNIKAT BLEDU IToastText02 notification = ToastContentFactory.CreateToastText02(); notification.TextHeading.Text = "B³¹d"; notification.TextBodyWrap.Text = valid; notification.Duration = ToastDuration.Short; ToastNotification not = new ToastNotification(notification.GetXml()); ToastNotificationManager.CreateToastNotifier().Show(not); } }
public void ShowToast(string s) { var toast = ToastContentFactory.CreateToastImageAndText02(); toast.TextBodyWrap.Text = s; toast.TextHeading.Text = "Windows Toast"; ToastNotificationManager.CreateToastNotifier().Show(toast.CreateNotification()); }
private void sendToast(object sender, RoutedEventArgs e) { IToastImageAndText01 toastContent = ToastContentFactory.CreateToastImageAndText01(); toastContent.Launch = "this is launch string test"; toastContent.TextBodyWrap.Text = "破船,恭喜你,中500W!"; toastContent.Image.Src = "/Assets/98_avatar_big.jpg"; ToastNotificationManager.CreateToastNotifier().Show(toastContent.CreateNotification()); }
private static IToastNotificationContent PrepareNotification(string title, string text, int id, string notificationProfile) { IToastText02 toastContent = ToastContentFactory.CreateToastText02(); toastContent.TextHeading.Text = title; toastContent.TextBodyWrap.Text = text; toastContent.Launch = "-notification=" + id.ToString(); return(toastContent); }
private async void SendClick(object sender, RoutedEventArgs e) { VisualStateManager.GoToElementState(Content as Grid, "Sending", true); //await Task.Yield(); await Task.Delay(500); var uri = TB_ChannelURL.Text; var secret = TB_ClientSecret.Text; var sid = TB_PackageSID.Text; var result = await Task.Run(() => { try { var notificationType = "wns/toast"; var contentType = "text/xml"; var accessToken = GetAccessToken(secret, sid); var request = HttpWebRequest.Create(uri) as HttpWebRequest; request.Method = "POST"; request.Headers.Add("X-WNS-Type", notificationType); request.ContentType = contentType; request.Headers.Add("Authorization", String.Format("Bearer {0}", accessToken.AccessToken)); var tileContent = ToastContentFactory.CreateToastText01(); tileContent.TextBodyWrap.Text = "123 Test!"; byte[] contentInBytes = Encoding.UTF8.GetBytes(tileContent.ToString()); using (Stream requestStream = request.GetRequestStream()) requestStream.Write(contentInBytes, 0, contentInBytes.Length); using (HttpWebResponse webResponse = (HttpWebResponse)request.GetResponse()) { var txt = webResponse.StatusCode.ToString(); return(txt); } } catch (Exception ex) { return(ex.Message); } }); MessageBox.Show($"Response '{result}", "Sending..."); VisualStateManager.GoToElementState(Content as Grid, "NotSending", true); }
public void NotificateAboutUpcomingTask() { if (Notificate == true && NotesCollection.Count > 0) { DateTime early = new DateTime(9999, 12, 30); String head = ""; DateTime today = DateTime.Now.Date; foreach (CollectionRepresentation collection in NotesCollection) { foreach (Note n in collection.NoteCollection) { if (n.date.CompareTo(early) < 0) { early = n.date; head = n.header; } } } //DISPLAY MSG TODAY if (early.Date.CompareTo(today) < 0) { IToastText02 notification = ToastContentFactory.CreateToastText02(); notification.TextHeading.Text = "Min¹³ termin zadania!"; notification.TextBodyWrap.Text = head; notification.Duration = ToastDuration.Short; ToastNotification not = new ToastNotification(notification.GetXml()); not.ExpirationTime = DateTimeOffset.Now.AddSeconds(5); ToastNotificationManager.CreateToastNotifier().Show(not); } else if (early.Date.CompareTo(today) == 0) { IToastText02 notification = ToastContentFactory.CreateToastText02(); notification.TextHeading.Text = "Dzisiaj mija termin zadania!"; notification.TextBodyWrap.Text = head; notification.Duration = ToastDuration.Short; ToastNotification not = new ToastNotification(notification.GetXml()); not.ExpirationTime = DateTimeOffset.Now.AddSeconds(5); ToastNotificationManager.CreateToastNotifier().Show(not); } else { IToastText02 notification = ToastContentFactory.CreateToastText02(); notification.TextHeading.Text = "Zbli¿a siê termin zadania!"; notification.TextBodyWrap.Text = head + " (" + early.Date.ToString("dd.MM.yyyy") + ")"; notification.Duration = ToastDuration.Short; ToastNotification not = new ToastNotification(notification.GetXml()); not.ExpirationTime = DateTimeOffset.Now.AddSeconds(5); ToastNotificationManager.CreateToastNotifier().Show(not); } } }
private void sendToast(object sender, RoutedEventArgs e) { IToastNotificationContent toastContent = null; IToastText01 templateContent = ToastContentFactory.CreateToastText01(); templateContent.TextBodyWrap.Text = "今天去游泳!(BeyondVincent|破船|)"; toastContent = templateContent; ToastNotification toast = toastContent.CreateNotification(); ToastNotificationManager.CreateToastNotifier().Show(toast); }
//toast notification function public static void CreateToast(string head, string body) { var toast = ToastContentFactory.CreateToastText02(); toast.TextHeading.Text = head; toast.TextBodyWrap.Text = body; ToastNotification t = toast.CreateNotification(); ToastNotificationManager.CreateToastNotifier().Show(t); }
private async void NotificationButton_Click_1(object sender, RoutedEventArgs e) { if (await ValidateUri()) { SetTitleAndText(); var notification = ToastContentFactory.CreateToastText02(); notification.TextHeading.Text = _title; notification.TextBodyWrap.Text = _text; await PostToCloud(notification.CreateNotification().Content, "wns/toast"); } }
private void SaveToast(string updatedString, DateTime dueTime, int id) { IToastText02 toastContent = ToastContentFactory.CreateToastText02(); toastContent.TextHeading.Text = updatedString; toastContent.TextBodyWrap.Text = "Notificare de la World Of Quizz!"; ScheduledToastNotification toast; toast = new ScheduledToastNotification(toastContent.GetXml(), dueTime); ToastNotificationManager.CreateToastNotifier().AddToSchedule(toast); }
private IToastImageAndText02 BuildToast(PlaybackNotificationOptions options) { var toast = ToastContentFactory.CreateToastImageAndText02(); toast.Image.Src = options.ImageUrl; toast.Image.Alt = "Cover Art"; toast.TextHeading.Text = options.Title; toast.TextBodyWrap.Text = options.Subtitle; toast.Audio.Content = UseSound ? ToastAudioContent.Default : ToastAudioContent.Silent; return(toast); }
public static void DisplaySingleLine(String _text) { IToastImageAndText01 templateContent = ToastContentFactory.CreateToastImageAndText01(); templateContent.TextBodyWrap.Text = _text; templateContent.Image.Src = "Icons/toastImageAndText.png"; IToastNotificationContent toastContent = templateContent; ToastNotification toast = toastContent.CreateNotification(); ToastNotificationManager.CreateToastNotifier().Show(toast); }
void DisplayWebImageToast(ToastTemplateType templateType) { IToastNotificationContent toastContent = null; string toastImageSrc = Scenario3ImageUrl.Text; if (templateType == ToastTemplateType.ToastImageAndText01) { IToastImageAndText01 templateContent = ToastContentFactory.CreateToastImageAndText01(); templateContent.TextBodyWrap.Text = "Body text that wraps"; templateContent.Image.Src = toastImageSrc; templateContent.Image.Alt = ALT_TEXT; toastContent = templateContent; } else if (templateType == ToastTemplateType.ToastImageAndText02) { IToastImageAndText02 templateContent = ToastContentFactory.CreateToastImageAndText02(); templateContent.TextHeading.Text = "Heading text"; templateContent.TextBodyWrap.Text = "Body text that wraps."; templateContent.Image.Src = toastImageSrc; templateContent.Image.Alt = ALT_TEXT; toastContent = templateContent; } else if (templateType == ToastTemplateType.ToastImageAndText03) { IToastImageAndText03 templateContent = ToastContentFactory.CreateToastImageAndText03(); templateContent.TextHeadingWrap.Text = "Heading text that wraps"; templateContent.TextBody.Text = "Body text"; templateContent.Image.Src = toastImageSrc; templateContent.Image.Alt = ALT_TEXT; toastContent = templateContent; } else if (templateType == ToastTemplateType.ToastImageAndText04) { IToastImageAndText04 templateContent = ToastContentFactory.CreateToastImageAndText04(); templateContent.TextHeading.Text = "Heading text"; templateContent.TextBody1.Text = "Body text"; templateContent.TextBody2.Text = "Another body text"; templateContent.Image.Src = toastImageSrc; templateContent.Image.Alt = ALT_TEXT; toastContent = templateContent; } rootPage.NotifyUser(toastContent.GetContent(), NotifyType.StatusMessage); // Create a toast from the Xml, then create a ToastNotifier object to show // the toast ToastNotification toast = toastContent.CreateNotification(); // If you have other applications in your package, you can specify the AppId of // the app to create a ToastNotifier for that application ToastNotificationManager.CreateToastNotifier().Show(toast); }
/// <summary> /// Initialises a new instance of the Skycap.Notifications.EmailToastNotification class. /// </summary> static EmailToastNotification() { // Initialise local variables if (_notification == null) { _notification = ToastContentFactory.CreateToastText04(); } if (_toastNotifier == null) { _toastNotifier = ToastNotificationManager.CreateToastNotifier(); } }
private ToastNotification CreateToastText02(string title, string content) { IToastText02 toastContent = ToastContentFactory.CreateToastText02(); // Set the launch activation context parameter on the toast. // The context can be recovered through the app Activation event toastContent.Launch = "Context123"; toastContent.TextHeading.Text = title; toastContent.TextBodyWrap.Text = content; return(toastContent.CreateNotification()); }
public static void Display(string heading, string body) { IToastText02 templateContent = ToastContentFactory.CreateToastText02(); templateContent.TextHeading.Text = heading; templateContent.TextBodyWrap.Text = body; IToastNotificationContent toastContent = templateContent; toastContent.Duration = ToastDuration.Short; ToastNotification toast = toastContent.CreateNotification(); ToastNotificationManager.CreateToastNotifier().Show(toast); }
public static void Show(string text) { IToastNotificationContent toastContent = null; IToastText01 templateContent = ToastContentFactory.CreateToastText01(); templateContent.TextBodyWrap.Text = text; toastContent = templateContent; ToastNotification toast = toastContent.CreateNotification(); toast.ExpirationTime = DateTimeOffset.UtcNow.AddSeconds(1); ToastNotificationManager.CreateToastNotifier().Show(toast); }
public MainPage() { this.InitializeComponent(); this.DataContext = new SampleViewModel(); IToastImageAndText02 trying_toast = ToastContentFactory.CreateToastImageAndText02(); trying_toast.TextHeading.Text = "Toast notification Example"; trying_toast.TextBodyWrap.Text = "Animu Quiz app"; ScheduledToastNotification giveittime; giveittime = new ScheduledToastNotification(trying_toast.GetXml(), DateTime.Now.AddSeconds(2)); giveittime.Id = "Any_ID"; ToastNotificationManager.CreateToastNotifier().AddToSchedule(giveittime); }
private ToastNotification getToastNotification(string title, string describe) { var toastContent = ToastContentFactory.CreateToastText02(); toastContent.TextHeading.Text = title; toastContent.TextBodyWrap.Text = describe; toastContent.Audio.Content = ToastAudioContent.LoopingAlarm; toastContent.Audio.Loop = true; toastContent.Duration = ToastDuration.Long; var toast = toastContent.CreateNotification(); toast.ExpirationTime = null; return(toast); }
public static void DisplayTwoLines(String _text1, String _text2, String _picture) { IToastImageAndText02 templateContent = ToastContentFactory.CreateToastImageAndText02(); templateContent.TextHeading.Text = _text1; templateContent.TextBodyWrap.Text = _text2; templateContent.Image.Src = _picture; IToastNotificationContent toastContent = templateContent; ToastNotification toast = toastContent.CreateNotification(); ToastNotificationManager.CreateToastNotifier().Show(toast); }
void ScheduleToast(String updateString, DateTime dueTime, int idNumber) { IToastText02 toastContent = ToastContentFactory.CreateToastText02(); toastContent.TextHeading.Text = updateString; toastContent.TextBodyWrap.Text = "Received: " + dueTime.ToLocalTime(); ScheduledToastNotification toast; toast = new ScheduledToastNotification(toastContent.GetXml(), dueTime); toast.Id = "Toast" + idNumber; ToastNotificationManager.CreateToastNotifier().AddToSchedule(toast); noti.Text = "Toast ID: " + toast.Id; }
private void ToashNotification(string message) { // Create a toast, then create a ToastNotifier object to show // the toast IToastNotificationContent toastContent = null; IToastText01 templateContent = ToastContentFactory.CreateToastText01(); templateContent.TextBodyWrap.Text = message; toastContent = templateContent; ToastNotification toast = toastContent.CreateNotification(); // If you have other applications in your package, you can specify the AppId of // the app to create a ToastNotifier for that application ToastNotificationManager.CreateToastNotifier().Show(toast); }
private void OnShowToast(object sender, Windows.UI.Xaml.RoutedEventArgs e) { var toastManager = ToastNotificationManager.CreateToastNotifier(); if (toastManager.Setting == NotificationSetting.Enabled) { var content = ToastContentFactory.CreateToastImageAndText04(); content.Image.Src = content.FromPackage("Assets/WideLogo.png"); content.TextHeading.Text = "Toast heading"; content.TextBody1.Text = "Toast Subheading #1"; content.TextBody2.Text = "Toast Subheading #1"; content.Launch = "Hello from the Toast!"; toastManager.AddToSchedule(new ScheduledToastNotification(content.GetXml(), DateTimeOffset.Now.AddSeconds(5))); } }