Ejemplo n.º 1
0
 void Layers_CollectionChanging(object sender, NotifyCollectionChangedEventArgs e)
 {
     if (CollectionChanging != null)
     {
         CollectionChanging(sender, e);
     }
 }
Ejemplo n.º 2
0
 private void ConnectedBranches_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     //don't update on child lists..like the list of YZValues in a crossection
     if (sender is IList<IBranch>)
     {
         IsBoundaryNode = IncomingBranches.Count == 0 || OutgoingBranches.Count == 0;     
     }
 }
Ejemplo n.º 3
0
 protected virtual void Layers_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     switch (e.Action)
     {
         case NotifyCollectionChangedAction.Add: //set map property for layers being added
             ((ILayer) e.Item).Map = Map;
             ((ILayer) e.Item).RenderRequired = true;
             ((ILayer) e.Item).LayerGroup = this;
             break;
         case NotifyCollectionChangedAction.Remove:
             ((ILayer) e.Item).LayerGroup = null;
             RenderRequired = true;//render the group if a layer got removed.
             break;
         case NotifyCollectionChangedAction.Replace:
             throw new NotImplementedException();
     }
     
     if(CollectionChanged != null)
     {
         CollectionChanged(sender, e);
     }
 }
Ejemplo n.º 4
0
 public override void OnMapCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     switch (e.Action)
     {
         case NotifyCollectionChangedAction.Remove:
             {
                 if (sender is Map)
                 {
                     ILayer layer = (ILayer)e.Item;
                     if (layer is LayerGroup)
                     {
                         LayerGroup layerGroup = (LayerGroup)layer;
                         foreach (ILayer layerGroupLayer in layerGroup.Layers)
                         {
                             HandleLayerStatusChanged(layerGroupLayer);
                         }
                     }
                     else
                     {
                         HandleLayerStatusChanged(layer);
                     }
                 }
                 break;
             }
         case NotifyCollectionChangedAction.Replace:
             throw new NotImplementedException();
     }
 }
Ejemplo n.º 5
0
        private void nodeFeatures_CollectionChanging(object sender, NotifyCollectionChangedEventArgs e)
        {
            var nodeFeature = (INodeFeature) e.Item;
            if (nodeFeature == null) return;

            switch (e.Action)
            {
                case NotifyCollectionChangedAction.Replace:
                    throw new NotImplementedException();

                case NotifyCollectionChangedAction.Remove:
                    log.DebugFormat("Removed {0} from the node {1}", nodeFeature, this);
                    nodeFeature.Node = null;
                    break;

                case NotifyCollectionChangedAction.Add:
                    nodeFeature.Node = this;

                    log.DebugFormat("Added {0} to the node {1}", nodeFeature, this);
                    break;
            }
        }
Ejemplo n.º 6
0
 private void Branches_CollectionChanging(object sender, NotifyCollectionChangedEventArgs e)
 {
     switch (e.Action)
     {
         case NotifyCollectionChangedAction.Add:
             if (sender == Branches)
             {
                 if (e.Item is TestBranch)
                 {
                     var branch = (TestBranch)e.Item;
                     if (branch.Network != this)
                     {
                         branch.Network = this;
                     }
                 }
             }
             break;
     }
 }
Ejemplo n.º 7
0
 /// <summary>
 /// Listens for changes in reduce array and throws exception if reduction is 
 /// not possible for the given dimension
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void Reduce_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     //check whether reduced dimensions are bound by offsets
     for (int i = 0; i < parent.Rank; i++)
     {
         if (Reduce[i])
         {
             bool isLimitedToOneIndex = OffsetEnd[i] == OffsetStart[i] || (SelectedIndexes[i] != null && SelectedIndexes[i].Length == 1);
             if (!isLimitedToOneIndex)
                 throw new InvalidOperationException("Reduction not possible because dimension " + i +
                                                     " is not bound to a single index");
         }
     }
 }
Ejemplo n.º 8
0
 public virtual void OnMapCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
 }
Ejemplo n.º 9
0
        private void _Layers_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            if (e.Item is ILayer)
            {
                ILayer layer = (ILayer) e.Item;

                switch (e.Action)
                {
                    case NotifyCollectionChangedAction.Replace:
                        throw new NotImplementedException();

                    case NotifyCollectionChangedAction.Add:
                        layer.Map = this;
                        layer.RenderRequired = true;
                        break;
                }
            }
            if (CollectionChanged != null)
            {
                if (sender == Layers)
                {
                    CollectionChanged(this, e);
                }
                else
                {
                    CollectionChanged(sender, e);
                }
            }
        }
 private void argument_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     OnCollectionChanged(sender, e);
 }
 public void OnCollectionChanging(object sender, NotifyCollectionChangedEventArgs e)
 {
     if (CollectionChanging != null)
     {
         if (logging)
         {
             //log.DebugFormat("Forwarding '{0}' property changes: '{1}' > '{2}, {3}'", e.PropertyName, sender,
             //                instance.GetType().Name, intanceCredentials);
         }
         lock (sender)
         {
             CollectionChanging(sender, e);
         }
     }
 }
Ejemplo n.º 12
0
 private void Nodes_CollectionChanging(object sender, NotifyCollectionChangedEventArgs e)
 {
     switch (e.Action)
     {
         case NotifyCollectionChangedAction.Add:
             if (sender == Nodes)
             {
                 var node = (INode)e.Item;
                 if (node.Network != this)
                 {
                     node.Network = this;
                 }
             }
             break;
     }
 }
Ejemplo n.º 13
0
        private void Branches_CollectionChanging(object sender, NotifyCollectionChangedEventArgs e)
        {
            switch (e.Action)
            {
                case NotifyCollectionChangedAction.Add:
                    if (sender == Branches)
                    {
                        var branch = (IBranch)e.Item;
                        if (branch.Network != this)
                        {
                            branch.Network = this;
                        }
                    }
                    break;

                case NotifyCollectionChangedAction.Remove:
                    if (sender == Branches)
                    {
                        var branch = (IBranch)e.Item;
                        if (branch.Network != this)
                        {
                            branch.Network = null;
                        }

                        // clean-up nodes
                        var nodes1 = nodes.Where(n => n.IncomingBranches.Contains(branch));
                        foreach (var node in nodes1)
                        {
                            node.IncomingBranches.Remove(branch);
                        }
                        var nodes2 = nodes.Where(n => n.OutgoingBranches.Contains(branch));
                        foreach (var node in nodes2)
                        {
                            node.OutgoingBranches.Remove(branch);
                        }
                    }
                    break;
            }
        }
Ejemplo n.º 14
0
 private void CollectionCollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
 {
     base.RenderRequired = true;
 }