示例#1
0
        /// <summary>
        /// Raises the <see cref="OnEntityRemoved"/> event.
        /// </summary>
        /// <param name="e">The <see cref="T:Netron.Diagramming.Core.EntityEventArgs"/> instance containing the event data.</param>
        private void RaiseOnEntityRemoved(EntityEventArgs e)
        {
            EventHandler <EntityEventArgs> handler = OnEntityRemoved;

            if (handler != null)
            {
                handler(this, e);
            }
        }
示例#2
0
        /// <summary>
        /// Handles the OnEntityAdded event of the defaultLayer.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:Netron.Diagramming.Core.EntityEventArgs"/> instance containing the event data.</param>
        void defaultLayer_OnEntityAdded(object sender, EntityEventArgs e)
        {
            EventHandler <EntityEventArgs> handler = OnEntityAdded;

            if (handler != null)
            {
                handler(sender, e);
            }
        }
示例#3
0
 // ------------------------------------------------------------------
 /// <summary>
 /// Handles the OnEntityAdded event of the Page and adds the new
 /// entity to the Paintables.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The
 /// <see cref="T:Netron.Diagramming.Core.EntityEventArgs"/> instance
 /// containing the event data.</param>
 // ------------------------------------------------------------------
 void mDefaultPage_OnEntityAdded(object sender, EntityEventArgs e)
 {
     //don't add it if it's already there or if it's a group (unless you want to deploy something special to emphasize a group shape).
     if (!Paintables.Contains(e.Entity))
     {
         if ((e.Entity is IGroup) && !(e.Entity as IGroup).EmphasizeGroup)
         {
             return;
         }
         //set the new entity on top of the stack
         e.Entity.SceneIndex = Paintables.Count;
         Paintables.Add(e.Entity);
     }
     #region Addition callback
     IAdditionCallback callback = e.Entity.GetService(typeof(IAdditionCallback)) as IAdditionCallback;
     if (callback != null)
     {
         callback.OnAddition();
     }
     #endregion
     RaiseOnEntityAdded(e);
 }
示例#4
0
 // ------------------------------------------------------------------
 /// <summary>
 /// Handles the OnEntityRemoved event of the DefaultPage.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The
 /// <see cref="T:Netron.Diagramming.Core.EntityEventArgs"/> instance
 /// containing the event data.</param>
 // ------------------------------------------------------------------
 void mDefaultPage_OnEntityRemoved(object sender, EntityEventArgs e)
 {
     if (Paintables.Contains(e.Entity))
     {
         //shift the entities above the one to be removed
         int index = e.Entity.SceneIndex;
         foreach (IDiagramEntity entity in Paintables)
         {
             if (entity.SceneIndex > index)
             {
                 entity.SceneIndex--;
             }
         }
         Paintables.Remove(e.Entity);
     }
     //if the selection contains the shape we have to remove it from the selection
     if (Selection.SelectedItems.Contains(e.Entity))
     {
         Selection.SelectedItems.Remove(e.Entity);
     }
     RaiseOnEntityRemoved(e);
 }
示例#5
0
        /// <summary>
        /// Handles the OnEntityRemoved event of the DefaultPage.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:Netron.Diagramming.Core.EntityEventArgs"/> instance containing the event data.</param>
        void mDefaultPage_OnEntityRemoved(object sender, EntityEventArgs e)
        {
            //IShape sp = e.Entity as IShape;
            //if(sp != null)
            //{
            //    foreach(IConnector cr in sp.Connectors)
            //        mConnectorHolders.Remove(cr);
            //}

            if (mPaintables.Contains(e.Entity))
            {
                //shift the entities above the one to be removed
                int index = e.Entity.SceneIndex;
                foreach (IDiagramEntity entity in mPaintables)
                {
                    if (entity.SceneIndex > index)
                    {
                        entity.SceneIndex--;
                    }
                }
                mPaintables.Remove(e.Entity);
            }
            //if the selection contains the shape we have to remove it from the selection
            if (Selection.SelectedItems.Contains(e.Entity))
            {
                Selection.SelectedItems.Remove(e.Entity);
            }

            RaiseOnEntityRemoved(e);

            IConnection cn = e.Entity as IConnection;

            if (cn != null)
            {
                mConnectorHolders.Remove(cn.From);
                mConnectorHolders.Remove(cn.To);
            }
        }
示例#6
0
        /// <summary>
        /// Handles the OnEntityAdded event of the Page and adds the new entity to the Paintables.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="T:Netron.Diagramming.Core.EntityEventArgs"/> instance containing the event data.</param>
        void mDefaultPage_OnEntityAdded(object sender, EntityEventArgs e)
        {
            IConnection cn = e.Entity as IConnection;

            if (cn != null)
            {
                mConnectorHolders.Add(cn.From, cn);
                mConnectorHolders.Add(cn.To, cn);
            }
            //IShape sp = e.Entity as IShape;
            //if(sp != null)
            //{
            //    foreach(IConnector cr in sp.Connectors)
            //        mConnectorHolders.Add(cr, sp);
            //}

            //don't add it if it's already there or if it's a group (unless you want to deploy something special to emphasize a group shape).
            if (!mPaintables.Contains(e.Entity))
            {
                if ((e.Entity is IGroup) && !(e.Entity as IGroup).EmphasizeGroup)
                {
                    return;
                }
                //set the new entity on top of the stack
                e.Entity.SceneIndex = mPaintables.Count;
                mPaintables.Add(e.Entity);
            }
            #region Addition callback
            IAdditionCallback callback = e.Entity.GetService(typeof(IAdditionCallback)) as IAdditionCallback;
            if (callback != null)
            {
                callback.OnAddition();
            }
            #endregion
            RaiseOnEntityAdded(e);
        }
 // ------------------------------------------------------------------
 /// <summary>
 /// Handles the OnEntityAdded event of the Controller control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The
 /// <see cref="T:Netron.Diagramming.Core.EntityEventArgs"/> instance
 /// containing the event data.</param>
 // ------------------------------------------------------------------
 protected virtual void HandleOnEntityAdded(
     object sender,
     EntityEventArgs e)
 {
     RaiseOnEntityAdded(e);
 }
 /// <summary>
 /// Handles the OnEntityAdded event of the Controller control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="T:Netron.Diagramming.Core.EntityEventArgs"/> instance containing the event data.</param>
 void Controller_OnEntityAdded(object sender, EntityEventArgs e)
 {
     RaiseOnEntityAdded(e);
 }
示例#9
0
 void mModel_OnEntityAdded(object sender, EntityEventArgs e)
 {
     RaiseOnEntityAdded(e);
 }