public IRibbonConnector GetRibbonForUserControl( UserControl userControl) { IRibbonConnector ribbonConnector = null; foreach (UserInterfaceContainer uic in _items) { if (uic.TaskPane.ContentControl == userControl) { ribbonConnector = uic.RibbonConnector; break; } } return(ribbonConnector); }
public IRibbonConnector GetRibbonForInspector( Outlook.Inspector inspector) { IRibbonConnector ribbonConnector = null; foreach (UserInterfaceContainer uic in _items) { if (uic.Inspector == inspector) { ribbonConnector = uic.RibbonConnector; break; } } return(ribbonConnector); }
public UserInterfaceContainer( Outlook.Inspector inspector, Office.Core.CustomTaskPane taskPane, IRibbonConnector ribbonConnector) { if (inspector != null) { _inspector = inspector; _taskPane = taskPane; _ribbonConnector = ribbonConnector; // Sink the InspectorClose event so that we can clean up. _inspectorEvents = (Outlook.InspectorEvents_10_Event)_inspector; _inspectorEvents.Close += new Outlook.InspectorEvents_10_CloseEventHandler( _inspectorEvents_Close); } }
public UserInterfaceContainer( Outlook.Inspector inspector, Office.Core.CustomTaskPane taskPane, IRibbonConnector ribbonConnector) { if (inspector != null) { _inspector = inspector; _taskPane = taskPane; _ribbonConnector = ribbonConnector; // 接收 InspectorClose 事件以便我们能够进行清理。 _inspectorEvents = (Outlook.InspectorEvents_10_Event)_inspector; _inspectorEvents.Close += new Outlook.InspectorEvents_10_CloseEventHandler( _inspectorEvents_Close); } }
void _inspectorEvents_Close() { // Remove ourselves from the collection of UI objects, // unhook the Close event, and clean up all references. _inspectorEvents.Close -= new Outlook.InspectorEvents_10_CloseEventHandler( _inspectorEvents_Close); if (InspectorClose != null) { // Tell anyone who's listening that we're being closed. InspectorClose(this, new EventArgs()); } _inspector = null; _inspectorEvents = null; _taskPane = null; _formRegionControls = null; _ribbonConnector = null; }
void _inspectorEvents_Close() { // 将我们自身从 UI 对象集合中移除, // 解除挂钩关闭事件,然后清理所有引用。 _inspectorEvents.Close -= new Outlook.InspectorEvents_10_CloseEventHandler( _inspectorEvents_Close); if (InspectorClose != null) { // 告诉所有侦听方我们正在关闭。 InspectorClose(this, new EventArgs()); } _inspector = null; _inspectorEvents = null; _taskPane = null; _formRegionControls = null; _ribbonConnector = null; }