Esempio n. 1
0
 /// <summary>
 ///     Creates a new editing context layer.  Editing context layers can be used to
 ///     create editing modes.  For example, you may create a layer before starting a
 ///     drag operation on the designer.  Any new context items you add to the layer
 ///     hide context items underneath it.  When the layer is removed, all context
 ///     items under the layer are re-surfaced.  This allows you to create a layer
 ///     and set overrides for context items during operations such as drag and drop.
 /// </summary>
 internal override ContextLayer CreateLayer()
 {
     _currentLayer = new DefaultContextLayer(this, _currentLayer);
     return(_currentLayer);
 }
Esempio n. 2
0
 internal DefaultContextLayer(DefaultContextItemCollection collection, DefaultContextLayer parentLayer)
 {
     _collection  = collection;
     _parentLayer = parentLayer; // can be null
 }
Esempio n. 3
0
 internal override void Remove()
 {
     // Only remove the layer if we have a parent layer.
     // Also, once we remove the layer make sure we don't
     // try to remove it if someone else calls Remove.
     if (_parentLayer != null)
     {
         _collection.OnLayerRemoved(this);
         _parentLayer = null;
     }
 }
Esempio n. 4
0
 internal DefaultContextItemCollection(EditingContext context)
 {
     _context      = context;
     _currentLayer = new DefaultContextLayer(this, null);
 }
Esempio n. 5
0
            /// <summary>
            ///     Called when the user removes a layer.
            /// </summary>
            private void OnLayerRemoved(DefaultContextLayer layer)
            {
                if (_currentLayer == layer)
                {
                    _currentLayer = layer.ParentLayer;
                }
                else
                {
                    var childLayer = FindChildLayer(layer);
                    childLayer.ParentLayer = layer.ParentLayer;
                }

                Debug.Assert(_currentLayer != null, "DefaultContextLayer should not call OnLayerRemoved for top most layer");

                // For each item that was in the layer, raise a changed event for it
                if (_subscriptions != null)
                {
                    foreach (var oldItem in layer.Items.Values)
                    {
                        OnItemChanged(GetValue(oldItem.ItemType));
                    }
                }
            }
Esempio n. 6
0
 internal DefaultContextLayer(DefaultContextItemCollection collection, DefaultContextLayer parentLayer)
 {
     _collection = collection;
     _parentLayer = parentLayer; // can be null
 }
Esempio n. 7
0
 /// <summary>
 ///     This helper function returns the childLayer for the layer that is passed in.
 ///     This function is used in the OnLayerRemoved to link the layers when
 ///     a layer (in the middle) is removed.
 /// </summary>
 /// <param name="layer"></param>
 /// <returns></returns>
 private DefaultContextLayer FindChildLayer(DefaultContextLayer layer)
 {
     var startLayer = _currentLayer;
     while (startLayer.ParentLayer != layer)
     {
         startLayer = startLayer.ParentLayer;
     }
     return startLayer;
 }
Esempio n. 8
0
 /// <summary>
 ///     Creates a new editing context layer.  Editing context layers can be used to
 ///     create editing modes.  For example, you may create a layer before starting a
 ///     drag operation on the designer.  Any new context items you add to the layer
 ///     hide context items underneath it.  When the layer is removed, all context
 ///     items under the layer are re-surfaced.  This allows you to create a layer
 ///     and set overrides for context items during operations such as drag and drop.
 /// </summary>
 internal override ContextLayer CreateLayer()
 {
     _currentLayer = new DefaultContextLayer(this, _currentLayer);
     return _currentLayer;
 }
 internal DefaultContextLayer(DefaultContextLayer parentLayer) 
 {
     _parentLayer = parentLayer; // can be null
 }
Esempio n. 10
0
 internal DefaultContextItemCollection(EditingContext context)
 {
     _context = context;
     _currentLayer = new DefaultContextLayer(this, null);
 }
 internal DefaultContextItemManager(EditingContext context) 
 {
     _context = context;
     _currentLayer = new DefaultContextLayer(null);
 }
Esempio n. 12
0
 public override void Remove(bool disposing = false)
 {
     // Only remove the layer if we have a parent layer or if being disposed.
     // Also, once we remove the layer make sure we don't
     // try to remove it if someone else calls Remove.
     if (_parentLayer != null || disposing)
     {
         foreach (var item in _items.Values)
         {
             var d = item as IDisposable;
             if (d != null)
             {
                 d.Dispose();
             }
         }
         _items.Clear();
         _collection.OnLayerRemoved(this);
         _parentLayer = null;
     }
 }
Esempio n. 13
0
 /// <summary>
 ///     Called when the user removes a layer.
 /// </summary>
 /// <param name="layer"></param>
 private void OnLayerRemoved(DefaultContextLayer layer)
 {
     if (_currentLayer == layer)
     {
         _currentLayer = layer.ParentLayer;
     }
     else
     {
         var childLayer = FindChildLayer(layer);
         if (childLayer != null)
         {
             childLayer.ParentLayer = layer.ParentLayer;
         }
     }
 }
Esempio n. 14
0
 internal DefaultContextLayer(DefaultContextLayer parentLayer)
 {
     _parentLayer = parentLayer; // can be null
 }
Esempio n. 15
0
 internal DefaultContextItemManager(EditingContext context)
 {
     _context      = context;
     _currentLayer = new DefaultContextLayer(null);
 }