/// <summary>
 /// Called when deactivating.
 /// </summary>
 /// <param name="close">Inidicates whether this instance will be closed.</param>
 protected override void OnDeactivate(bool close)
 {
     if (close)
     {
         foreach (var x in _items.OfType <IDeactivate>())
         {
             x.Deactivate(true);
         }
         _items.Clear();
     }
     else
     {
         ScreenHelper.TryDeactivate(ActiveItem, false);
     }
 }
                private void CloseItemCore(T item)
                {
                    if (ReferenceEquals(item, ActiveItem))
                    {
                        var index = _items.IndexOf(item);
                        var next  = DetermineNextItemToActivate(_items, index);

                        ChangeActiveItem(next, true);
                    }
                    else
                    {
                        ScreenHelper.TryDeactivate(item, true);
                    }

                    _items.Remove(item);
                }
Пример #3
0
                /// <summary>
                /// Deactivates the specified item.
                /// </summary>
                /// <param name="item">The item to close.</param>
                /// <param name="close">Indicates whether or not to close the item after deactivating it.</param>
                public override async void DeactivateItem(T item, bool close)
                {
                    if (item == null)
                    {
                        return;
                    }

                    if (!close)
                    {
                        ScreenHelper.TryDeactivate(item, false);
                    }
                    else
                    {
                        var result = await CloseStrategy.ExecuteAsync(new[] { item });

                        if (result.CanClose)
                        {
                            CloseItemCore(item);
                        }
                    }
                }
Пример #4
0
 private void CloseItemCore(T item)
 {
     ScreenHelper.TryDeactivate(item, true);
     _items.Remove(item);
 }
Пример #5
0
 /// <summary>
 /// Called when deactivating.
 /// </summary>
 /// <param name="close">Inidicates whether this instance will be closed.</param>
 protected override void OnDeactivate(bool close)
 {
     ScreenHelper.TryDeactivate(ActiveItem, close);
 }