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); }
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); }
public async Task <object> ShutdownRhino(dynamic input) { // Unload Rhino try { rhinoCore.Dispose(); return("Rhino has shutdown."); } catch (Exception ex) { return(ex.Message); } }
protected override void OnHandleDestroyed(EventArgs e) { if (definition != null) { definition.Dispose(); definition = null; } if (rhinoCore != null) { rhinoCore.Dispose(); rhinoCore = null; } base.OnHandleDestroyed(e); }
public void Terminate() { Application.Idle -= onIdle; Application.DocumentManager.DocumentDestroyed -= OnBcDocDestroyed; try { _rhinoCore?.Dispose(); _preview?.Dispose(); } catch { // ignored } }
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); }
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); }
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); }