private void ProjectEvents_ItemAdded(ProjectItem ProjectItem) { // If the user added a different file, or if there // is no real solution, do nothing. // Also do nothing when a solution that contains a // Solution Item that doesn't exist is opened. if (!dte.Solution.IsOpen || string.IsNullOrEmpty(dte.Solution.FullName)) { return; } var expectedPath = locator.SolutionPath(dte.Solution); if (String.IsNullOrEmpty(expectedPath) || ProjectItem.Name != Path.GetFileName(expectedPath) || ProjectItem.FileCount != 1 || !File.Exists(ProjectItem.get_FileNames(1))) { return; } if (File.Exists(expectedPath)) { persister.ActivateSettingsFile(expectedPath); } else { MessageBox.Show("The Rebracer settings file that you added is not in the correct location; you are still using global settings.\n" + "To add a Rebracer settings file, right-click the solution, click Add, New Rebracer Settings File\n" + "Alternatively, copy an existing settings file to \n " + expectedPath, "Rebracer", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
void UpdateCommandStatus() { Command.Visible = dte.Solution.IsOpen && !String.IsNullOrEmpty(dte.Solution.FileName) && !File.Exists(locator.SolutionPath(dte.Solution)); }