/// <summary> /// Called when the user clicks a command. /// </summary> /// <remarks> /// Note to inheritors: override OnClick and use this method to /// perform the actual work of the custom command. /// </remarks> public override void OnClick() { try { IMMPxApplication pxApp = this.Application.GetPxApplication(); IMMPxNode node = pxApp.GetCurrentNode(); IMMPxTask task = node.GetTask(this.TaskName, true); task.Execute(node); } catch (Exception ex) { Log.Error(this.Caption, ex); } }
/// <summary> /// Executes the tree tool within error handling. /// </summary> /// <param name="selection">The selection.</param> protected virtual void InternalExecute(IMMTreeViewSelection selection) { // Only enable if 1 item is selected. if (selection == null || selection.Count != 1) { return; } // Execute the Task for the specified node. selection.Reset(); IMMPxNode node = (IMMPxNode)selection.Next; IMMPxTask task = ((IMMPxNode3)node).GetTaskByName(this.Name); if (task == null) { return; } task.Execute(node); }