public async void ShowNotification(string text, int duration = 0) { var vm = new InAppNotificationViewModel(_NotificationManager, _DispatcherHelper); await _DispatcherHelper.RunAsync(async() => { NotificationCollection.Add((IInAppNotificationViewModel)vm); await Task.Delay(250); //stiupid workaround - we are waiting here until DataContext is set vm.ShowNotification(text, duration); }); }
public async void ShowNotification(InAppNotificationType notificationType, int duration = 0) { var vm = new InAppNotificationViewModel(_NotificationManager, _DispatcherHelper); await _DispatcherHelper.RunAsync(async() => { NotificationCollection.Add(vm); await Task.Delay(250); vm.ShowNotification(notificationType, duration); }); }