protected void menuItemCallback(object sender, EventArgs e) { try { ThreadHelper.ThrowIfNotOnUIThread(); OleMenuCommand menuCommand = sender as OleMenuCommand; if (menuCommand == null) { return; } var applicationObject = CrmDeveloperHelperPackage.Singleton?.ApplicationObject; if (applicationObject == null) { return; } var helper = DTEHelper.Create(applicationObject); CommandAction(helper); } catch (Exception ex) { DTEHelper.WriteExceptionToOutput(null, ex); } }
protected void menuItem_BeforeQueryStatus(object sender, EventArgs e) { try { if (sender is OleMenuCommand menuCommand) { menuCommand.Enabled = menuCommand.Visible = false; var applicationObject = CrmDeveloperHelperPackage.Singleton.ApplicationObject; if (applicationObject == null) { return; } var helper = DTEHelper.Create(applicationObject); var connectionData = helper.GetOutputWindowConnection(); if (connectionData == null) { return; } menuCommand.Enabled = menuCommand.Visible = true; CommandBeforeQueryStatus(applicationObject, connectionData, menuCommand); } } catch (Exception ex) { DTEHelper.WriteExceptionToOutput(null, ex); } }
protected void menuItemCallback(object sender, EventArgs e) { try { OleMenuCommand menuCommand = sender as OleMenuCommand; if (menuCommand == null) { return; } var applicationObject = CrmDeveloperHelperPackage.Singleton.ApplicationObject; if (applicationObject == null) { return; } var helper = DTEHelper.Create(applicationObject); var connectionData = helper.GetOutputWindowConnection(); if (connectionData == null) { return; } CommandAction(helper, connectionData); } catch (Exception ex) { DTEHelper.WriteExceptionToOutput(null, ex); } }
private void menuItemCallback(object sender, EventArgs e) { try { OleMenuCommand menuCommand = sender as OleMenuCommand; if (menuCommand == null) { return; } var applicationObject = CrmDeveloperHelperPackage.Singleton.ApplicationObject; if (applicationObject == null) { return; } var index = menuCommand.CommandID.ID - _baseIdStart; var elementsList = GetElementSourceCollection(); if (0 <= index && index < elementsList.Count) { var element = elementsList.ElementAt(index); var helper = DTEHelper.Create(applicationObject); CommandAction(helper, element); } } catch (Exception ex) { DTEHelper.WriteExceptionToOutput(null, ex); } }
private void menuItem_BeforeQueryStatus(object sender, EventArgs e) { try { ThreadHelper.ThrowIfNotOnUIThread(); if (sender is OleMenuCommand menuCommand) { menuCommand.Enabled = menuCommand.Visible = false; var applicationObject = CrmDeveloperHelperPackage.Singleton?.ApplicationObject; if (applicationObject == null) { return; } var helper = DTEHelper.Create(applicationObject); var connectionData = helper.GetOutputWindowConnection(); if (connectionData == null) { return; } var index = menuCommand.CommandID.ID - _baseIdStart; var elementsList = GetElementSourceCollection(connectionData); if (0 <= index && index < elementsList.Count) { var element = elementsList.ElementAt(index); menuCommand.Text = GetElementName(connectionData, element); menuCommand.Enabled = menuCommand.Visible = true; CommandBeforeQueryStatus(applicationObject, connectionData, element, menuCommand); } } } catch (Exception ex) { DTEHelper.WriteExceptionToOutput(null, ex); } }