private string SelectProject() { string defaultOpenProjectPath = this.ProjectManager().DefaultOpenProjectPath; NewNamePathDialog newNamePathDialog = null; if (!Microsoft.Expression.Framework.Documents.PathHelper.DirectoryExists(defaultOpenProjectPath)) { defaultOpenProjectPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); } if (!Microsoft.Expression.Framework.Documents.PathHelper.DirectoryExists(defaultOpenProjectPath)) { defaultOpenProjectPath = Path.GetPathRoot(Environment.CurrentDirectory); } newNamePathDialog = new NewNamePathDialog(this.DisplayName, defaultOpenProjectPath, string.Empty, StringTable.SelectWebsiteFolderDialogDescription, StringTable.SelectProjectFolderDialogDescriptionVista) { ShowDiscardButton = false, ShowName = false }; newNamePathDialog.ShowDialog(); if (newNamePathDialog.Result == ProjectDialog.ProjectDialogResult.Ok) { if (Microsoft.Expression.Framework.Documents.PathHelper.DirectoryExists(newNamePathDialog.NewPath)) { return(newNamePathDialog.NewPath); } CultureInfo currentCulture = CultureInfo.CurrentCulture; string directoryDoesNotExistErrorMessage = StringTable.DirectoryDoesNotExistErrorMessage; object[] newPath = new object[] { newNamePathDialog.NewPath }; this.DisplayCommandFailedMessage(string.Format(currentCulture, directoryDoesNotExistErrorMessage, newPath)); } return(string.Empty); }
protected ProjectDialog.ProjectDialogResult PromptUserForNewNameAndPath(ref string path, ref string name, bool allowDiscard) { NewNamePathDialog newNamePathDialog = null; do { newNamePathDialog = new NewNamePathDialog(this.DisplayName, path, name, StringTable.SelectProjectFolderDialogDescription, StringTable.SelectProjectFolderDialogDescriptionVista) { ShowDiscardButton = allowDiscard }; newNamePathDialog.ShowDialog(); }while (newNamePathDialog.Result == ProjectDialog.ProjectDialogResult.Ok && !this.ValidatePathIsNew(Path.Combine(newNamePathDialog.NewPath, newNamePathDialog.NewName))); if (newNamePathDialog.Result == ProjectDialog.ProjectDialogResult.Ok) { path = newNamePathDialog.NewPath; name = newNamePathDialog.NewName; } return(newNamePathDialog.Result); }