Ejemplo n.º 1
0
        /// <summary>
        /// The construction code.
        /// </summary>
        /// <param name="explorer">The outlook explorer that should be wrapped.</param>
        public ExplorerWrapper(Outlook.Explorer explorer)
        {
            _Id       = Guid.NewGuid();
            _Explorer = explorer as Outlook.Explorer;
            if (_Explorer == null)
            {
                return;
            }

            Outlook.ExplorerEvents_10_Event explorerEvents = _Explorer as Outlook.ExplorerEvents_10_Event;
            if (explorerEvents == null)
            {
                return;
            }

            explorerEvents.FolderSwitch += new Outlook.ExplorerEvents_10_FolderSwitchEventHandler(_Explorer_FolderSwitch);
            explorerEvents.Close        += new Outlook.ExplorerEvents_10_CloseEventHandler(_Explorer_ExplorerEvents_Event_Close);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This event occures when this explorer has been closed.
        /// </summary>
        void _Explorer_ExplorerEvents_Event_Close()
        {
            // here release references to the explorer from memory.
            Outlook.ExplorerEvents_10_Event explorerEvents = _Explorer as Outlook.ExplorerEvents_10_Event;
            if (explorerEvents == null)
            {
                return;
            }

            explorerEvents.FolderSwitch -= new Outlook.ExplorerEvents_10_FolderSwitchEventHandler(_Explorer_FolderSwitch);
            explorerEvents.Close        -= new Outlook.ExplorerEvents_10_CloseEventHandler(_Explorer_ExplorerEvents_Event_Close);
            _Explorer = null;

            // fire an event toinform the application that this explorer has been closed.
            if (ExplorerClosed == null)
            {
                return;
            }

            ExplorerClosed(this._Id);
        }