private static void RegisterDeleteEventHandlers() { DeleteEventHandlerRegistry.Register(ShapeNames.TypeAlternative, new DeleteAlternativeEventHandler()); DeleteEventHandlerRegistry.Register(ShapeNames.TypeAlternatives, new DeleteAlternativesEventHandler()); DeleteEventHandlerRegistry.Register(ShapeNames.TypeRelatedUrlUrl, new DeletedRelatedUrlUrlEventHandler()); DeleteEventHandlerRegistry.Register(ShapeNames.TypeRelatedDocumentContainer, new DeleteRelatedDocumentEventHandler()); DeleteEventHandlerRegistry.Register(ShapeNames.TypeRelatedDocuments, new DeleteRelatedDocumentsEventHandler()); DeleteEventHandlerRegistry.Register("forces", new DeleteForcesEventHandler()); DeleteEventHandlerRegistry.Register("forceContainer", new DeleteForceEventHandler()); DeleteEventHandlerRegistry.Register("decisionName", new DeleteTitleEventHandler()); DeleteEventHandlerRegistry.Register("informationBox", new DeleteInformationBoxEventHandler()); DeleteEventHandlerRegistry.Register("informationAuthor", new DeleteInformationComponentEventHandler()); DeleteEventHandlerRegistry.Register("informationDate", new DeleteInformationComponentEventHandler()); DeleteEventHandlerRegistry.Register("informationVersion", new DeleteInformationComponentEventHandler()); DeleteEventHandlerRegistry.Register("informationAuthorLabel", new DeleteInformationComponentEventHandler()); DeleteEventHandlerRegistry.Register("informationDateLabel", new DeleteInformationComponentEventHandler()); DeleteEventHandlerRegistry.Register("informationVersionLabel", new DeleteInformationComponentEventHandler()); DeleteEventHandlerRegistry.Register("stakeholder", new DeleteStakeholderEventHandler()); DeleteEventHandlerRegistry.Register("stakeholders", new DeleteStakeholdersEventHandler()); DeleteEventHandlerRegistry.Register("planningItem", new DeletePlanningItemEventHandler()); DeleteEventHandlerRegistry.Register("planning", new DeletePlanningContainerEventHandler()); }
private void Application_DeleteShapeEvent(Shape s) //Fired when a shape is deleted. Shape now no longer exists { if (s.Document.Template.Contains(Information.TemplateName)) { try { Log.Debug("shape deleted event for: " + s.Name); if (s.CellExistsU[VisioFormulas.Cell_Stub, (short)VisExistsFlags.visExistsAnywhere] == Constants.CellExists) { return; } if (s.CellExistsU[VisioFormulas.Cell_RationallyType, (short)VisExistsFlags.visExistsAnywhere] == Constants.CellExists) { string rationallyType = s.CellsU[VisioFormulas.Cell_RationallyType].ResultStr[VisioFormulas.Value]; //mark the deleted shape as 'deleted' in the view tree VisioShape deleted = View.GetComponentByShape(s); if (deleted != null) { deleted.Deleted = true; } DeleteEventHandlerRegistry.HandleEvent(rationallyType, Model, s); } else { if (StartedUndoState == 0) { RebuildTree(s.ContainingPage.Document); } } if ((StartedUndoState != 0) && (s.Name == LastDelete)) { Log.Debug("ending undo scope"); Application.EndUndoScope(StartedUndoState, true); StartedUndoState = 0; LastDelete = ""; } } catch (Exception ex) { Log.Error(ex, ex); #if DEBUG throw; #endif } } }