Exemplo n.º 1
0
        public void ShowStorageLoadingNotification(CredentialsLoadNotificationViewModel viewModel)
        {
            Screen screen = GetCurrentScreen();

            var options = new NotificationOptions {
                CloseTimeout = TimeSpan.Zero,
            };

            CredentialsLoadNotification notification = new CredentialsLoadNotification(options)
            {
                DataContext = viewModel
            };

            if (notification.Options.IsReplace)
            {
                var matchingNotificationViews = GetNotifications().Where(n => (n.DataContext as CredentialsLoadNotificationViewModel)?.Device.Mac == viewModel.Device.Mac);
                // Displaying only one notification during connection is visually better. That's why we also close simple notifications
                // when displaying "Credentials Loading"
                var simpleNotificationViews = GetNotifications().Where(n => (n.DataContext as SimpleNotificationViewModel)?.ObservableId == viewModel.Device.Mac);
                matchingNotificationViews = matchingNotificationViews.Concat(simpleNotificationViews);
                foreach (var notificationView in matchingNotificationViews)
                {
                    notificationView.Close();
                }
            }
            AddNotification(screen, notification);
        }
Exemplo n.º 2
0
 private void Device_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (sender is Device device && e.PropertyName == nameof(Device.IsLoadingStorage) && device.IsLoadingStorage)
     {
         CredentialsLoadNotificationViewModel viewModal = new CredentialsLoadNotificationViewModel(device);
         _windowsManager.ShowCredentialsLoading(viewModal);
     }
 }
Exemplo n.º 3
0
 public void ShowCredentialsLoading(CredentialsLoadNotificationViewModel viewModel)
 {
     UIDispatcher.Invoke(() => _notificationsManager.ShowStorageLoadingNotification(viewModel));
 }