/// <summary> /// Initialize Toast collection from other collection /// </summary> /// <param name="other"></param> public ToastCollection(ToastCollection other) { if (other != null) { _privateList = other._privateList; } }
/// <summary> /// Initialize Toast collection from other collection /// </summary> /// <param name="other"></param> public ToastCollection(ToastCollection other) { if (other != null) { _privateList = new List <Toast>(other._privateList); _privateList.Capacity = ToastManager.MAX_TOASTS_ALLOWED; } }
private async void CreateToastCollection(User user) { try { var displayName = user.GetFullName(); var launchArg = $"session={_sessionService.Id}&user_id={user.Id}"; var icon = new Uri("ms-appx:///Assets/Logos/Square44x44Logo/Square44x44Logo.png"); #if DEBUG displayName += " BETA"; #endif var collection = new ToastCollection($"{_sessionService.Id}", displayName, launchArg, icon); await ToastNotificationManager.GetDefault().GetToastCollectionManager().SaveToastCollectionAsync(collection); } catch { } }
private async void ShowNotification_OnClick(object sender, RoutedEventArgs e) { Task.Run(async() => { var uri = new Uri("ms-appx:///Assets/StoreSolo.png"); var toastCollection = new ToastCollection(ToastCollectionId, "ContosoInc", "Args", uri); await ToastNotificationManager.GetDefault().GetToastCollectionManager().SaveToastCollectionAsync(toastCollection); _toastNotifierManager = await ToastNotificationManager.GetDefault().GetToastNotifierForToastCollectionIdAsync(ToastCollectionId); var toastsHistory = ToastNotificationManager.History.GetHistory().ToList(); foreach (var toast in toastsHistory) { lock (_toastNotifierManager) { _toastNotifierManager.Hide(toast); } } await ShowDownloadNotification("status", 2, "tag"); }); }