Ejemplo n.º 1
0
        // 我们重写 RequestService 以便为
        // 我们实现的每个新扩展接口返回合适的对象。
        protected override object RequestService(Guid serviceGuid)
        {
            if (serviceGuid ==
                typeof(Office.Core.ICustomTaskPaneConsumer).GUID)
            {
                if (_taskPaneConnector == null)
                {
                    _taskPaneConnector = new TaskPaneConnector();
                }
                return(_taskPaneConnector);
            }

            else if (serviceGuid ==
                     typeof(Office.Core.IRibbonExtensibility).GUID)
            {
                if (_ribbonConnector == null)
                {
                    _ribbonConnector = new RibbonConnector();
                }
                return(_ribbonConnector);
            }

            else if (serviceGuid ==
                     typeof(Outlook.FormRegionStartup).GUID)
            {
                if (_formRegionConnector == null)
                {
                    _formRegionConnector = new FormRegionConnector();
                }
                return(_formRegionConnector);
            }

            return(base.RequestService(serviceGuid));
        }
Ejemplo n.º 2
0
        // 我们重写 RequestService 以便为
        // 我们实现的每个新扩展接口返回合适的对象。
        protected override object RequestService(Guid serviceGuid)
        {
            if (serviceGuid ==
                typeof(Office.Core.ICustomTaskPaneConsumer).GUID)
            {
                if (_taskPaneConnector == null)
                {
                    _taskPaneConnector = new TaskPaneConnector();
                }
                return _taskPaneConnector;
            }

            else if (serviceGuid ==
                typeof(Office.Core.IRibbonExtensibility).GUID)
            {
                if (_ribbonConnector == null)
                {
                    _ribbonConnector = new RibbonConnector();
                }
                return _ribbonConnector;
            }

            else if (serviceGuid ==
                typeof(Outlook.FormRegionStartup).GUID)
            {
                if (_formRegionConnector == null)
                {
                    _formRegionConnector = new FormRegionConnector();
                }
                return _formRegionConnector;
            }

            return base.RequestService(serviceGuid);
        }