示例#1
0
 void IDisposable.Dispose()
 {
     this._namespaceTable = null;
     this._registeredNamespaces = null;
     this._referenceManager = null;
     this._editor = null;
 }
示例#2
0
 void IDisposable.Dispose()
 {
     _namespaceTable       = null;
     _registeredNamespaces = null;
     _registeredBehaviors  = null;
     _editor = null;
 }
示例#3
0
        private bool RegisterNamespaceWithEditor(string namespaceName)
        {
            if (_namespaceTable == null)
            {
                Interop.IOleServiceProvider interop_IOleServiceProvider = _editor.GetActiveDocument(true) as Interop.IOleServiceProvider;
                Guid   guid1 = typeof(Interop.IElementNamespaceTable).GUID;
                Guid   guid2 = guid1;
                IntPtr i;
                if (interop_IOleServiceProvider != null && interop_IOleServiceProvider.QueryService(ref guid1, ref guid2, out i) == 0 && i != Interop.NullIntPtr)
                {
                    _namespaceTable = (Interop.IElementNamespaceTable)Marshal.GetObjectForIUnknown(i);
                    Marshal.Release(i);
                }
                else
                {
                    // cannot register, document not ready
                    return(false);
                }
            }
            if (_namespaceTable == null)
            {
                return(false);
            }
            object local = this;

            try
            {
                _namespaceTable.AddNamespace(namespaceName, null, 2, ref local);
                return(true);
            }
            catch (Exception)
            {
                bool flag = false;
                return(flag);
            }
        }
示例#4
0
 private bool RegisterNamespaceWithEditor(string namespaceName)
 {
     if (this._namespaceTable == null)
     {
         IntPtr ptr;
         Interop.IOleServiceProvider mSHTMLDocument = this._editor.MSHTMLDocument as Interop.IOleServiceProvider;
         Guid gUID = typeof(Interop.IElementNamespaceTable).GUID;
         Guid riid = gUID;
         if ((mSHTMLDocument.QueryService(ref gUID, ref riid, out ptr) == 0) && (ptr != Interop.NullIntPtr))
         {
             this._namespaceTable = (Interop.IElementNamespaceTable) Marshal.GetObjectForIUnknown(ptr);
             Marshal.Release(ptr);
         }
     }
     if (this._namespaceTable == null)
     {
         return false;
     }
     object factory = this;
     try
     {
         this._namespaceTable.AddNamespace(namespaceName, null, 2, ref factory);
     }
     catch (Exception)
     {
         return false;
     }
     return true;
 }