private void OnSimpleTextToastButtonTapped(object sender, GestureEventArgs e) { SimpleToastNotification simpleToastNotification = new SimpleToastNotification(); simpleToastNotification.Content = "Bonjour " + DateTime.UtcNow.ToString("T"); _notificationManager.Enqueue(simpleToastNotification); }
public async Task ToastNotificationManagerTest_Enqueue_ExistingNotification_ShouldUpdateExistingNotification() { await Deployment.Current.Dispatcher.InvokeAsync(() => { // Arrange Grid rootGrid = new Grid(); ToastNotificationManager manager = new ToastNotificationManager(rootGrid); ToastNotificationBase notification1 = new SimpleToastNotification(); ToastNotificationBase notification2 = new SimpleToastNotification(); notification2.Id = "test"; manager.Enqueue(notification1); manager.Enqueue(notification2); SimpleToastNotification notification2updated = new SimpleToastNotification(); notification2updated.Id = "test"; notification2updated.Title = "Updated content"; // Act manager.Enqueue(notification2updated); // Assert Assert.AreEqual(2, manager.QueuedNotifications.Count); Assert.IsInstanceOfType(manager.QueuedNotifications.Last(), typeof(SimpleToastNotification)); SimpleToastNotification resultNotification = manager.QueuedNotifications.Last() as SimpleToastNotification; Assert.AreSame(notification2updated.Title, resultNotification.Title); return(null); }); }
public async Task ToastNotificationManagerTest_GetToastById_KnowId_ShouldReturnNotifcation() { await Deployment.Current.Dispatcher.InvokeAsync(() => { // Arrange Grid rootGrid = new Grid(); ToastNotificationManager manager = new ToastNotificationManager(rootGrid); ToastNotificationBase notification1 = new SimpleToastNotification(); manager.Enqueue(notification1); manager.Enqueue(new SimpleToastNotification() { Id = "TestId", Title = "success" }); // Act ToastNotificationBase toast = manager.GetToastById("TestId"); // Assert Assert.IsNotNull(toast); Assert.IsInstanceOfType(toast, typeof(SimpleToastNotification)); SimpleToastNotification notification = toast as SimpleToastNotification; Assert.AreSame("success", notification.Title); return(null); }); }
private async void OnSwipeNotificationStep2ButtonTapped(object sender, GestureEventArgs e) { SimpleToastNotification simpleToastNotification = new SimpleToastNotification(); simpleToastNotification.Title = "PRISM has been removed to favorites"; simpleToastNotification.Id = "album.favoritestatus.27493"; DismissStatus result = await simpleToastNotification.EnqueueAndShow(_notificationManager); }
private void OnToastResultButtonTapped(object sender, GestureEventArgs e) { SimpleToastNotification simpleToastNotification = new SimpleToastNotification(); simpleToastNotification.Title = "Do you want to tap me ?"; simpleToastNotification.Completed += OnSimpleToastResultTapped; _notificationManager.Enqueue(simpleToastNotification); }
private async void OnSimpleAsyncTextToastButtonTapped(object sender, GestureEventArgs e) { SimpleToastNotification simpleToastNotification = new SimpleToastNotification(); simpleToastNotification.Title = "Do you want to tap me async ?"; DismissStatus result = await simpleToastNotification.EnqueueAndShow(_notificationManager); MessageBox.Show("Toast has been dismissed: " + result); }
private void OnSimpleTitleToastButtonTapped(object sender, GestureEventArgs e) { SimpleToastNotification simpleToastNotification = new SimpleToastNotification(); simpleToastNotification.Title = "Toast"; simpleToastNotification.Content = "Bonjour " + DateTime.UtcNow.ToString("T"); simpleToastNotification.BackgroundBrush = new SolidColorBrush(Color.FromArgb(0xff, 0x34, 0x64, 0x91)); _notificationManager.Enqueue(simpleToastNotification); }
private void OnSimpleToastResultTapped(object sender, ToastCompletedEventArgs e) { SimpleToastNotification simpleToastNotification = sender as SimpleToastNotification; if (simpleToastNotification == null) { return; } simpleToastNotification.Completed -= OnSimpleToastResultTapped; MessageBox.Show("Toast has been dismissed: " + e.DismissStatus); }
public async Task ToastNotificationManagerTest_Enqueue_ShouldAddANotification() { await Deployment.Current.Dispatcher.InvokeAsync(() => { // Arrange Grid rootGrid = new Grid(); ToastNotificationManager manager = new ToastNotificationManager(rootGrid); ToastNotificationBase notification = new SimpleToastNotification(); // Act manager.Enqueue(notification); // Assert Assert.AreEqual(1, manager.QueuedNotifications.Count); return(null); }); }
public async Task ToastNotificationManagerTest_GetToastById_UnknownId_ShouldReturnNull() { await Deployment.Current.Dispatcher.InvokeAsync(() => { // Arrange Grid rootGrid = new Grid(); ToastNotificationManager manager = new ToastNotificationManager(rootGrid); ToastNotificationBase notification1 = new SimpleToastNotification(); manager.Enqueue(notification1); // Act ToastNotificationBase toast = manager.GetToastById("newTag"); // Assert Assert.IsNull(toast); return(null); }); }