コード例 #1
0
ファイル: WsApplication.cs プロジェクト: killbug2004/WSProf
        public void Dispose()
        {
            if (ApplicationEvents != null)
            {
                ApplicationEvents.MAPILogonComplete -= OnMapiLogonComplete;
                
                ApplicationEvents = null;
            }

            if (_wsSession != null)
            {
                _wsSession.Dispose();
                _wsSession = null;
            }

            if (_application != null)
            {
                Marshal.ReleaseComObject(_application);
                _application = null;
            }
        }
コード例 #2
0
ファイル: WsMailItem.cs プロジェクト: killbug2004/WSProf
        protected override void Dispose(bool disposing)
        {
            if (_item != null)
            {
                ((MailItem) (_item)).BeforeAttachmentRead -= OnBeforeAttachmentRead;
                ((MailItem) _item).AttachmentAdd -= OnAttachmentAdd;
                ((MailItem) _item).AttachmentRemove -= OnAttachmentRemove;
                ((MailItem) _item).BeforeCheckNames -= OnBeforeCheckNames;
            }

            if (_recipients != null)
            {
                _recipients.Dispose();
                _recipients = null;
            }

            if (_wsAttachments != null)
            {
                _wsAttachments.Dispose();
                _wsAttachments = null;
            }

            if (_wsInspector != null)
            {
                _wsInspector.Dispose();
                _wsInspector = null;
            }

            if (_wsAccount != null)
            {
                _wsAccount.Dispose();
                _wsAccount = null;
            }

            if (_wsApplication != null)
            {
                _wsApplication.Dispose();
                _wsApplication = null;
            }

            if (_wsUserProperties != null)
            {
                _wsUserProperties.Dispose();
                _wsUserProperties = null;
            }

            if (_wsPropertyAccessor != null)
            {
                _wsPropertyAccessor.Dispose();
                _wsPropertyAccessor = null;
            }

            if (_wsSession != null)
            {
                _wsSession.Dispose();
                _wsSession = null;
            }
            base.Dispose(disposing);
        }