Beispiel #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);
            }
        }
Beispiel #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);
            }
        }
Beispiel #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);
 }
Beispiel #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);
 }
Beispiel #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);
            }
        }
Beispiel #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);
 }
Beispiel #9
0
 void mModel_OnEntityAdded(object sender, EntityEventArgs e)
 {
     RaiseOnEntityAdded(e);
 }