示例#1
0
        internal static Result Shutdown()
        {
            if (core is object)
            {
                RhinoApp.MainLoop    -= MainLoop;
                RhinoDoc.NewDocument -= OnNewDocument;
                Revit.ApplicationUI.ApplicationClosing -= OnApplicationClosing;

                // Unload Guests
                CheckOutGuests();

                // Unload RhinoCore
                try
                {
                    core.Dispose();
                    core = null;
                }
                catch (Exception /*e*/)
                {
                    //Debug.Fail(e.Source, e.Message);
                    return(Result.Failed);
                }
            }

            return(Result.Succeeded);
        }
示例#2
0
        internal static Result Shutdown()
        {
            if (core is object)
            {
                // Unload Guests
                CheckOutGuests();

                Revit.ApplicationUI.Idling -= RunScript;

                Command.EndCommand   -= EndCommand;
                Command.BeginCommand -= BeginCommand;

                RhinoDoc.EndOpenDocumentInitialViewUpdate -= EndOpenDocumentInitialViewUpdate;
                RhinoDoc.NewDocument -= OnNewDocument;

                RhinoApp.MainLoop -= MainLoop;

                // Unload RhinoCore
                try
                {
                    core.Dispose();
                    core = null;
                }
                catch (Exception /*e*/)
                {
                    //Debug.Fail(e.Source, e.Message);
                    return(Result.Failed);
                }
            }

            return(Result.Succeeded);
        }
示例#3
0
 public async Task <object> ShutdownRhino(dynamic input)
 {
     // Unload Rhino
     try
     {
         rhinoCore.Dispose();
         return("Rhino has shutdown.");
     }
     catch (Exception ex)
     {
         return(ex.Message);
     }
 }
示例#4
0
 protected override void OnHandleDestroyed(EventArgs e)
 {
     if (definition != null)
     {
         definition.Dispose();
         definition = null;
     }
     if (rhinoCore != null)
     {
         rhinoCore.Dispose();
         rhinoCore = null;
     }
     base.OnHandleDestroyed(e);
 }
示例#5
0
 public void Terminate()
 {
     Application.Idle -= onIdle;
     Application.DocumentManager.DocumentDestroyed -= OnBcDocDestroyed;
     try
     {
         _rhinoCore?.Dispose();
         _preview?.Dispose();
     }
     catch
     {
         // ignored
     }
 }
示例#6
0
        public Autodesk.Revit.UI.Result OnShutdown(UIControlledApplication applicationUI)
        {
            // Remove the Idling event handler
            ApplicationUI.Idling -= new EventHandler <IdlingEventArgs>(OnIdle);

            // Unload Rhino
            try
            {
                rhinoCore.Dispose();
            }
            catch (Exception e)
            {
                Debug.Fail(e.Source, e.Message);
                return(Autodesk.Revit.UI.Result.Failed);
            }

            ApplicationUI = null;
            return(Autodesk.Revit.UI.Result.Succeeded);
        }
示例#7
0
        public Autodesk.Revit.UI.Result OnShutdown(UIControlledApplication applicationUI)
        {
            // Unregister some events
            ApplicationUI.ControlledApplication.DocumentChanged -= OnDocumentChanged;
            ApplicationUI.Idling -= OnIdle;

            // Unload Rhino
            try
            {
                rhinoCore.Dispose();
            }
            catch (Exception e)
            {
                Debug.Fail(e.Source, e.Message);
                return(Autodesk.Revit.UI.Result.Failed);
            }

            ApplicationUI = null;
            return(Autodesk.Revit.UI.Result.Succeeded);
        }
示例#8
0
        public Result OnShutdown(UIControlledApplication applicationUI)
        {
            // Unregister GrasshopperPreviewServer
            grasshopperPreviewServer?.Unregister();
            grasshopperPreviewServer = null;

            // Unregister some events
            ApplicationUI.ControlledApplication.DocumentChanged -= OnDocumentChanged;
            ApplicationUI.Idling -= OnIdle;

            // Unload Rhino
            try
            {
                rhinoCore.Dispose();
            }
            catch (Exception e)
            {
                Debug.Fail(e.Source, e.Message);
                return(Result.Failed);
            }

            ApplicationUI = null;
            return(Result.Succeeded);
        }