public override bool OnUpdateSettingsCanExecute() { Visio.Application app = Globals.ThisAddIn.Application; switch (_shapeType) { case ShapeType.Document: return(app.ActiveDocument != null ? true : false); case ShapeType.Page: return(app.ActivePage != null ? true : false); case ShapeType.Shape: return(base.OnLoadCurrentSettingsCanExecute()); default: MessageBox.Show($"Unexpected _shapeType({_shapeType.GetType()}"); break; } return(false); }
/// <override></override> void IRegistrar.RegisterShapeType(ShapeType shapeType) { if (initializingLibrary == null) { throw new InvalidOperationException("RegisterShapeType can only be called while a library is initializing."); } if (string.IsNullOrEmpty(initializingLibrary.Name)) { throw new InvalidOperationException("RegisterLibrary has not been called or the library has an empty library name."); } if (shapeType == null) { throw new ArgumentNullException("shapeType"); } if (shapeType.LibraryName != initializingLibrary.Name) { throw new InvalidOperationException(string.Format("The library name of shape type '{0}' is '{1}' instead of '{2}'.", shapeType.GetType().Name, shapeType.LibraryName, initializingLibrary.Name)); } // shapeType.StyleSetProvider = this; shapeTypes.Add(shapeType); // If the cache is not open, the following actions will be performed // when opening it. if (repository != null && repository.IsOpen) { RegisterShapeEntityType(shapeType, addingLibrary); if (autoCreateTemplates && addingLibrary) { CreateDefaultTemplate(shapeType); } } }
public Type GetShapeType() { return(shape?.GetType()); }