Exemplo n.º 1
0
 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);
     });
 }
        /// <summary>
        /// Show notification using predefined DataTemplate from ItemTemplateSelector
        /// </summary>
        /// <param name="notificationType">Type of the notification</param>
        /// <param name="duration">Displayed duration of the notification in ms (less or equal 0 means infinite duration)</param>
        public void Show(InAppNotificationType notificationType, int duration = 0)
        {
            var template = ItemTemplateSelector.SelectTemplate(notificationType) ?? null;

            ContentTemplate = template;
            Content         = null;
            //TODO set datacontext if notification type would be recognized by appropriate ViewModel
            Show(duration);
        }
Exemplo n.º 3
0
 public void ShowNotification(InAppNotificationType notificationType, int duration = 0)
 {
     _ClientsLock.Wait();
     try
     {
         foreach (var cli in _Clients)
         {
             cli.ShowNotification(notificationType, duration);
         }
     }
     finally
     {
         _ClientsLock.Release();
     }
 }
 public ShowNotificationTypeEventArgs(InAppNotificationType notificationType, int duration = 0)
 {
     NotificationType = notificationType;
     Duration         = duration;
 }
Exemplo n.º 5
0
 public void ShowNotification(InAppNotificationType notificationType, int duration = 0)
 {
     _dispatcherHelper.RunAsync(() => {
         ShowNotificationTypeEventHandler?.Invoke(this, new ShowNotificationTypeEventArgs(notificationType, duration));
     });
 }