Browse Source

[Obsolete("Use SD.FileService.BrowseForFolder() instead.")]

Remove obsolete call to CreateFolderBrowserDialog
newNRvisualizers
Peter Forstmeier 13 years ago
parent
commit
12e00303ad
  1. 37
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ProjectOptionPanel.cs

37
src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ProjectOptionPanel.cs

@ -399,9 +399,10 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
/// </summary> /// </summary>
public void BrowseForFolder(ProjectProperty<string> property, string description) public void BrowseForFolder(ProjectProperty<string> property, string description)
{ {
string newValue = BrowseForFolder(description, BaseDirectory, property.TextBoxEditMode); string path = BrowseForFolder(description, BaseDirectory, property.TextBoxEditMode);
if (newValue != null) if (!String.IsNullOrEmpty(path)) {
property.Value = newValue; property.Value = path;
}
} }
/// <summary> /// <summary>
@ -411,26 +412,24 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
/// <param name="startLocation">Start location, relative to the <see cref="BaseDirectory"/></param> /// <param name="startLocation">Start location, relative to the <see cref="BaseDirectory"/></param>
/// <param name="textBoxEditMode">The TextBoxEditMode used for the text box containing the file name</param> /// <param name="textBoxEditMode">The TextBoxEditMode used for the text box containing the file name</param>
/// <returns>Returns the location of the folder; or null if the dialog was cancelled.</returns> /// <returns>Returns the location of the folder; or null if the dialog was cancelled.</returns>
protected string BrowseForFolder(string description, string startLocation, TextBoxEditMode textBoxEditMode) private string BrowseForFolder(string description, string startLocation, TextBoxEditMode textBoxEditMode)
{ {
string startAt = GetInitialDirectory(startLocation, textBoxEditMode, false); string startAt = GetInitialDirectory(startLocation, textBoxEditMode, false);
using (var fdiag = FileService.CreateFolderBrowserDialog(description, startAt)) string path = SD.FileService.BrowseForFolder(description,startAt);
{ if (String.IsNullOrEmpty(path)) {
if (fdiag.ShowDialog() == System.Windows.Forms.DialogResult.OK) { return null;
string path = fdiag.SelectedPath; } else {
if (!String.IsNullOrEmpty(startLocation)) { if (!String.IsNullOrEmpty(startLocation)) {
path = FileUtility.GetRelativePath(startLocation, path); path = FileUtility.GetRelativePath(startLocation, path);
} }
if (!path.EndsWith("\\", StringComparison.Ordinal) && !path.EndsWith("/", StringComparison.Ordinal)) if (!path.EndsWith("\\", StringComparison.Ordinal) && !path.EndsWith("/", StringComparison.Ordinal))
path += "\\"; path += "\\";
if (textBoxEditMode == TextBoxEditMode.EditEvaluatedProperty) { if (textBoxEditMode == TextBoxEditMode.EditEvaluatedProperty) {
return path; return path;
} else { } else {
return MSBuildInternals.Escape(path); return MSBuildInternals.Escape(path);
}
} }
} }
return null;
} }
/// <summary> /// <summary>

Loading…
Cancel
Save