private void OnProjectMenuBeforeQueryStatus(object sender, EventArgs e) { var menuCommand = sender as OleMenuCommand; if (menuCommand == null) { return; } if (LocalUtils.GetActiveProject().Kind != "{fc65038c-1b2f-41e1-a629-bed71d161fff}") { menuCommand.Visible = false; return; } if (LocalUtils.MyDte?.SelectedItems.Count != 1) { return; } _folderName = LocalUtils.MyDte.SelectedItems.Item(1)?.ProjectItem?.Name; var typeTuple = FolderType.FindTypeFromFolderName(_folderName); var canAdd = !string.IsNullOrEmpty(_folderName) && typeTuple != null; menuCommand.Visible = canAdd; menuCommand.Text = "Add new"; }
private void OnProjectMenuBeforeQueryStatus(object sender, EventArgs e) { var menuCommand = sender as OleMenuCommand; if (menuCommand == null) { return; } var project = LocalUtils.GetActiveProject(); if (project == null) { menuCommand.Visible = false; return; } if (project.Kind != GuidUtils.D365OperationsProject.ToString("B")) { menuCommand.Visible = false; return; } if (LocalUtils.MyDte?.SelectedItems.Count != 1) { return; } var projectItem = LocalUtils.MyDte.SelectedItems.Item(1).ProjectItem; var canShow = AotElementCreateEngin.CheckIsMatch(projectItem); menuCommand.Visible = canShow; }
private void OnProjectMenuBeforeQueryStatus(object sender, EventArgs e) { var menuCommand = sender as OleMenuCommand; if (menuCommand == null) { return; } var project = LocalUtils.GetActiveProject(); if (project == null) { menuCommand.Visible = false; return; } if (project.Kind != GuidUtils.D365OperationsProject.ToString("B")) { menuCommand.Visible = false; return; } if (LocalUtils.MyDte?.SelectedItems.Count != 1) { menuCommand.Visible = false; return; } if (!(LocalUtils.MyDte.SelectedItems.Item(1).ProjectItem is OAVSProjectFileItem)) { menuCommand.Visible = false; return; } OAVSProjectFileItem _class = LocalUtils.MyDte.SelectedItems.Item(1).ProjectItem as OAVSProjectFileItem; dynamic property = (_class?.Object as VSProjectFileNode)?.NodeProperties; menuCommand.Visible = property?.ItemType == "Class Item"; }
private void OnProjectMenuBeforeQueryStatus(object sender, EventArgs e) { var menuCommand = sender as OleMenuCommand; if (menuCommand == null) { return; } var project = LocalUtils.GetActiveProject(); if (project == null) { menuCommand.Visible = false; return; } if (project.Kind != GuidUtils.D365OperationsProject.ToString("B")) { menuCommand.Visible = false; return; } }