// ------------------------------------------------------------------ /// <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); }
/// <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); }