Browse Source

re implement TextBoxEditMode in OptionPanels/ProjectOptions/OptionsHelper.cs - BrowseForFolder

pull/30/head
PeterForstmeier 14 years ago
parent
commit
bebce53958
  1. 9
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptions.xaml.cs
  2. 38
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/OptionsHelper.cs

9
src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptions.xaml.cs

@ -268,7 +268,8 @@ namespace CSharpBinding.OptionPanels
private void ChangeOutputPathExecute() private void ChangeOutputPathExecute()
{ {
OutputPath.Value = OptionsHelper.BrowseForFolder("${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}", OutputPath.Value = OptionsHelper.BrowseForFolder("${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}",
base.BaseDirectory,base.BaseDirectory,outputPathTextBox.Text); base.BaseDirectory,base.BaseDirectory,
outputPathTextBox.Text,TextBoxEditMode.EditRawProperty);
base.RaisePropertyChanged(()=> OutputPath); base.RaisePropertyChanged(()=> OutputPath);
} }
@ -319,7 +320,8 @@ namespace CSharpBinding.OptionPanels
private void BaseIntermediateOutputPathExecute () private void BaseIntermediateOutputPathExecute ()
{ {
BaseIntermediateOutputPath.Value = OptionsHelper.BrowseForFolder("${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}", BaseIntermediateOutputPath.Value = OptionsHelper.BrowseForFolder("${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}",
base.BaseDirectory,base.BaseDirectory,this.baseIntermediateOutputPathTextBox.Text); base.BaseDirectory,base.BaseDirectory,
this.baseIntermediateOutputPathTextBox.Text,TextBoxEditMode.EditRawProperty);
base.RaisePropertyChanged(()=> BaseIntermediateOutputPath); base.RaisePropertyChanged(()=> BaseIntermediateOutputPath);
} }
@ -337,7 +339,8 @@ namespace CSharpBinding.OptionPanels
private void IntermediateOutputPathExecute () private void IntermediateOutputPathExecute ()
{ {
IntermediateOutputPath.Value = OptionsHelper.BrowseForFolder("${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}", IntermediateOutputPath.Value = OptionsHelper.BrowseForFolder("${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}",
base.BaseDirectory,base.BaseDirectory,this.intermediateOutputPathTextBox.Text); base.BaseDirectory,base.BaseDirectory,
this.intermediateOutputPathTextBox.Text,TextBoxEditMode.EditRawProperty);
base.RaisePropertyChanged(()=> IntermediateOutputPath); base.RaisePropertyChanged(()=> IntermediateOutputPath);
} }

38
src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/OptionsHelper.cs

@ -4,7 +4,9 @@
using System; using System;
using ICSharpCode.Core; using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Project;
using Microsoft.Win32; using Microsoft.Win32;
namespace ICSharpCode.SharpDevelop.Gui.OptionPanels namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
{ {
/// <summary> /// <summary>
@ -13,7 +15,9 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
public class OptionsHelper public class OptionsHelper
{ {
public static string BrowseForFolder(string description,string baseDirectory,string startLocation,string relativeLocation) public static string BrowseForFolder(string description,string baseDirectory,
string startLocation,string relativeLocation,
TextBoxEditMode textBoxEditMode)
{ {
string startAt = startLocation; string startAt = startLocation;
if (!String.IsNullOrEmpty(relativeLocation)) { if (!String.IsNullOrEmpty(relativeLocation)) {
@ -30,12 +34,44 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
} }
if (!path.EndsWith("\\") && !path.EndsWith("/")) if (!path.EndsWith("\\") && !path.EndsWith("/"))
path += "\\"; path += "\\";
if (textBoxEditMode == TextBoxEditMode.EditEvaluatedProperty) {
return path; return path;
} else {
return MSBuildInternals.Escape(path);
}
} }
} }
return startLocation; return startLocation;
} }
/*
public void Event(object sender, EventArgs e)
{
string startLocation = panel.baseDirectory;
if (startLocation != null) {
string text = panel.ControlDictionary[target].Text;
if (textBoxEditMode == TextBoxEditMode.EditRawProperty)
text = MSBuildInternals.Unescape(text);
startLocation = FileUtility.GetAbsolutePath(startLocation, text);
}
using (FolderBrowserDialog fdiag = FileService.CreateFolderBrowserDialog(description, startLocation)) {
if (fdiag.ShowDialog() == DialogResult.OK) {
string path = fdiag.SelectedPath;
if (panel.baseDirectory != null) {
path = FileUtility.GetRelativePath(panel.baseDirectory, path);
}
if (!path.EndsWith("\\") && !path.EndsWith("/"))
path += "\\";
if (textBoxEditMode == TextBoxEditMode.EditEvaluatedProperty) {
panel.ControlDictionary[target].Text = path;
} else {
panel.ControlDictionary[target].Text = MSBuildInternals.Escape(path);
}
}
}
}
*/
public static string OpenFile (string filter) public static string OpenFile (string filter)

Loading…
Cancel
Save