protected override Result Work() { try { var data = ElementPresenter.RequestPanelData(CurrentApplication); var element = ElementFinder.FindPanelSchedule(CurrentDocument, data.FieldName, data.FieldValue); if (element == null) { return(Result.Failed); } ElementPresenter.ShowElement(element, CurrentApplication); return(Result.Succeeded); } catch (CancellableException e) { //TaskDialog.Show("Cancelled", "User cancelled operation"); return(Result.Cancelled); } catch (Exception e) { if (e.Message.Equals("Not in Panel Schedule View")) { TaskDialog.Show("Error", "This command can only be used from a Panel Schedule. Please open a Panel Schedule and try again."); } return(Result.Failed); } }
protected override Result Work() { try { var data = ElementPresenter.RequestElementData(); var element = ElementFinder.FindElementByName(CurrentDocument, data.FieldValue, data.FieldName); if (element == null) { return(Result.Failed); } ElementPresenter.ShowElement(element, CurrentApplication); return(Result.Succeeded); } catch (CancellableException e) { TaskDialog.Show("Ended", "The requested operation was cancelled"); return(Result.Failed); } catch (Exception e) { TaskDialog.Show("Failure", e.Message); return(Result.Failed); } }