/// <summary> /// Implements the OnShutdown event /// </summary> /// <param name="application"></param> /// <returns></returns> public Result OnShutdown(UIControlledApplication application) { // Remove the command binding on shutdown if (s_commandId.HasBinding) { application.RemoveAddInCommandBinding(s_commandId); } return(Result.Succeeded); }
private void RemoveCommandBinding() { if (null != dynamoCommand) { uiControlledApplication.RemoveAddInCommandBinding(dynamoCommand.RevitCommandId); dynamoCommand.BeforeExecuted -= beforeExecuted; dynamoCommand.CanExecute -= canExecute; dynamoCommand.Executed -= executed; dynamoCommand = null; } if (null != dynamoPlayerCommand) { uiControlledApplication.RemoveAddInCommandBinding(dynamoPlayerCommand.RevitCommandId); dynamoPlayerCommand.BeforeExecuted -= beforeExecuted; dynamoPlayerCommand.CanExecute -= canExecute; dynamoPlayerCommand.Executed -= executedPlaylist; dynamoPlayerCommand = null; } }
public Result OnShutdown(UIControlledApplication application) { try { application.ControlledApplication.DocumentOpened -= EventDocOpen; application.ControlledApplication.DocumentClosing -= EventDocClose; application.ControlledApplication.DocumentSynchronizingWithCentral -= EventSwcStart; application.ControlledApplication.DocumentSynchronizedWithCentral -= EventSwcStop; application.ControlledApplication.DocumentChanged -= EventCommandFinished; if (_commandId.HasBinding) { application.RemoveAddInCommandBinding(_commandId); } return(Result.Succeeded); } catch (Exception e) { Log.AppendLog(LogMessageType.EXCEPTION, e.Message); return(Result.Failed); } }