protected virtual void RaiseOnEntityRemoved(EntityEventArgs e) { EventHandler <EntityEventArgs> handler = OnEntityRemoved; if (handler != null) { handler(this, e); } }
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 (!mPaintables.Contains(e.Entity) && !(e.Entity is IGroup)) { //set the new entity on top of the stack e.Entity.SceneIndex = mPaintables.Count; mPaintables.Add(e.Entity); } RaiseOnEntityAdded(e); }
void mDefaultPage_OnEntityRemoved(object sender, EntityEventArgs e) { 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); }
void mModel_OnEntityAdded(object sender, EntityEventArgs e) { RaiseOnEntityAdded(e); }