コード例 #1
0
 /// <summary>
 /// Occurs when the value of the IsNotificationVisible property is changed.
 /// </summary>
 /// <param name="e">
 /// The event argument
 /// </param>
 private void OnIsNotificationVisibleChanged(AdvancedPropertyChangedEventArgs e)
 {
     if ((bool)e.NewValue)
     {
         if (_notificationBarViewModel == null)
         {
             var typeFactory = TypeFactory.Default;
             _notificationBarViewModel = typeFactory.CreateInstance <NotificationBarViewModel>();
             _uiCompositionService.Activate(_notificationBarViewModel, "NotificationRegion");
         }
         else
         {
             _uiCompositionService.Activate(_notificationBarViewModel);
         }
     }
     else
     {
         _uiCompositionService.Deactivate(_notificationBarViewModel);
     }
 }
コード例 #2
0
 /// <summary>
 /// Tries to activate an existing view model in the specified region name. If there is no view model alive, it will create one
 /// and navigate to that view model.
 /// </summary>
 /// <typeparam name="TViewModel">The type of the view model.</typeparam>
 /// <param name="uiCompositionService">The UI composition service.</param>
 /// <param name="regionName">Name of the region.</param>
 public static void Activate <TViewModel>(this IUICompositionService uiCompositionService, string regionName)
     where TViewModel : IViewModel
 {
     uiCompositionService.Activate(typeof(TViewModel), regionName);
 }