private void EditRamlPropertiesCallback(object sender, EventArgs e) { ChangeCommandStatus(editRamlPropertiesCmdId, false); // Get the file path uint itemid; IVsHierarchy hierarchy; if (!IsSingleProjectItemSelection(out hierarchy, out itemid)) return; string ramlFilePath; ((IVsProject)hierarchy).GetMkDocument(itemid, out ramlFilePath); var refFilePath = InstallerServices.GetRefFilePath(ramlFilePath); var frm = new RamlPropertiesEditor(); frm.Load(refFilePath, Settings.Default.ContractsFolderName, Settings.Default.ApiReferencesFolderName); var result = frm.ShowDialog(); if (result != null && result.Value) { if (IsServerSide(ramlFilePath)) { var ramlScaffoldUpdater = new RamlScaffoldService(new T4Service(ServiceProvider.GlobalProvider), ServiceProvider.GlobalProvider); ramlScaffoldUpdater.UpdateRaml(ramlFilePath); } else { var templatesManager = new TemplatesManager(); var ramlFolder = Path.GetDirectoryName(ramlFilePath).TrimEnd(Path.DirectorySeparatorChar); var generatedFolderPath = ramlFolder.Substring(0, ramlFolder.LastIndexOf(Path.DirectorySeparatorChar) + 1); if (!templatesManager.ConfirmWhenIncompatibleClientTemplate(generatedFolderPath)) return; var dte = (DTE2)GetService(typeof(SDTE)); dte.ExecuteCommand("Project.RunCustomTool"); } } ChangeCommandStatus(editRamlPropertiesCmdId, true); }
private void EditRamlPropertiesCallback(object sender, EventArgs e) { ChangeCommandStatus(editRamlPropertiesCmdId, false); // Get the file path uint itemid; IVsHierarchy hierarchy; if (!IsSingleProjectItemSelection(out hierarchy, out itemid)) return; string ramlFilePath; ((IVsProject)hierarchy).GetMkDocument(itemid, out ramlFilePath); var refFilePath = InstallerServices.GetRefFilePath(ramlFilePath); var frm = new RamlPropertiesEditor(); frm.Load(refFilePath, Settings.Default.ContractsFolderName, Settings.Default.ApiReferencesFolderName); frm.ShowDialog(); ChangeCommandStatus(editRamlPropertiesCmdId, true); }