示例#1
0
        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);
        }
示例#2
0
        public void Dispose()
        {
            if (_wsPropertyAccessor != null)
            {
                _wsPropertyAccessor.Dispose();
                _wsPropertyAccessor = null;
            }

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

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

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

            if (_addressEntry != null)
            {
                Marshal.ReleaseComObject(_addressEntry);
                _addressEntry = null;
            }
        }
示例#3
0
        public void Dispose()
        {
            if (_wsPropertyAccessor != null)
            {
                _wsPropertyAccessor.Dispose();
                _wsPropertyAccessor = null;
            }

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

            if (_attachment != null)
            {
                Marshal.ReleaseComObject(_attachment);
                _attachment = null;
            }
        }