Example #1
0
        /// <summary>
        /// Called when the reference count goes to zero.
        /// </summary>
        protected override void _cleanup()
        {
            try
            {
                this._closeAllViews();
                if (true == _commands.Valid)
                {
                    _commands.Value.clear();
                    _commands.Value = null;
                }
                if (null != _gui)
                {
                    _gui.Document = null;
                    _gui          = null;
                }
                if (null != _views)
                {
                    _views.Clear();

                    // Not setting to null here is a work-around for a bug related to
                    // the fact that the views, documents, and document-manager are
                    // too tightly coupled.
                    _views = new DocViews();
                }
                base._cleanup();
            }
            catch (System.Exception e)
            {
                System.Console.WriteLine("Error 3201769786: {0}", e.Message);
            }
        }
Example #2
0
 /// <summary>
 /// Create new gui.
 /// </summary>
 void CadKit.Interfaces.IGuiCreate.create(object caller)
 {
     CadKit.Interfaces.IGuiDelegate gui = this.GuiDelegate;
     {
         if (null != gui)
         {
             // Potential deadlock if this calls BeginInvoke and
             // tries to write to this instance.
             gui.create(caller);
         }
     }
 }
Example #3
0
 /// <summary>
 /// Hook up document with appropriate delegate.
 /// </summary>
 public void setGuiDelegate(CadKit.Interfaces.IDocument doc, object caller)
 {
     if (null != doc)
     {
         // Look for delegate.
         CadKit.Interfaces.IGuiDelegateCreate[] creators = CadKit.Plugins.Manager.Instance.getAll <CadKit.Interfaces.IGuiDelegateCreate>();
         foreach (CadKit.Interfaces.IGuiDelegateCreate creator in creators)
         {
             CadKit.Interfaces.IGuiDelegate gui = ((null != creator) ? (creator.create(caller) as CadKit.Interfaces.IGuiDelegate) : null);
             if (null != gui && true == gui.doesHandle(doc.TypeName))
             {
                 doc.GuiDelegate = gui;
                 gui.Document    = doc;
             }
         }
     }
 }