Browse Source

DebugOptions.xaml, remove unused parameter in BrowseFolder

pull/30/head
PeterForstmeier 14 years ago
parent
commit
46e2087161
  1. 2
      src/AddIns/Analysis/CodeAnalysis/Src/AnalysisIdeOptionsPanel.xaml.cs
  2. 2
      src/AddIns/Analysis/SourceAnalysis/Src/AnalysisIdeOptionsPanel.xaml.cs
  3. 2
      src/AddIns/Analysis/SourceAnalysis/Src/AnalysisOptionsPanel.xaml.cs
  4. 6
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptions.xaml.cs
  5. 4
      src/AddIns/BackendBindings/CppBinding/CppBinding/Project/ApplicationOptions.cs
  6. 2
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonOptionsPanel.xaml.cs
  7. 9
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ApplicationSettings.xaml.cs
  8. 31
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/DebugOptions.xaml
  9. 97
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/DebugOptions.xaml.cs
  10. 37
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/OptionsHelper.cs
  11. 1
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/Signing.xaml.cs
  12. 2
      src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/ServiceReference/ServiceReferenceOptionsPanel..xaml.cs

2
src/AddIns/Analysis/CodeAnalysis/Src/AnalysisIdeOptionsPanel.xaml.cs

@ -40,7 +40,7 @@ namespace ICSharpCode.CodeAnalysis
private void FindFxCopPath_Click(object sender, System.Windows.RoutedEventArgs e) private void FindFxCopPath_Click(object sender, System.Windows.RoutedEventArgs e)
{ {
string fn = OptionsHelper.OpenFile("${res:SharpDevelop.FileFilter.ExecutableFiles}|*.exe;","",TextBoxEditMode.EditRawProperty); string fn = OptionsHelper.OpenFile("${res:SharpDevelop.FileFilter.ExecutableFiles}|*.exe;","","",TextBoxEditMode.EditRawProperty);
if (!String.IsNullOrEmpty(fn)) { if (!String.IsNullOrEmpty(fn)) {
string path = Path.GetDirectoryName(fn); string path = Path.GetDirectoryName(fn);
if (FxCopWrapper.IsFxCopPath(path)) { if (FxCopWrapper.IsFxCopPath(path)) {

2
src/AddIns/Analysis/SourceAnalysis/Src/AnalysisIdeOptionsPanel.xaml.cs

@ -63,7 +63,7 @@ namespace ICSharpCode.SourceAnalysis
private void FindStyleCopPath_Click(object sender, System.Windows.RoutedEventArgs e) private void FindStyleCopPath_Click(object sender, System.Windows.RoutedEventArgs e)
{ {
string filter = StringParser.Parse("StyleCop|*" + StyleCopWrapper.STYLE_COP_FILE + "|${res:SharpDevelop.FileFilter.AllFiles}|*.*"); string filter = StringParser.Parse("StyleCop|*" + StyleCopWrapper.STYLE_COP_FILE + "|${res:SharpDevelop.FileFilter.AllFiles}|*.*");
string path = OptionsHelper.OpenFile(filter,"",TextBoxEditMode.EditRawProperty); string path = OptionsHelper.OpenFile(filter,"","",TextBoxEditMode.EditRawProperty);
if (!String.IsNullOrEmpty(path)) { if (!String.IsNullOrEmpty(path)) {
if (StyleCopWrapper.IsStyleCopPath(path)) { if (StyleCopWrapper.IsStyleCopPath(path)) {
StyleCopPath = path; StyleCopPath = path;

2
src/AddIns/Analysis/SourceAnalysis/Src/AnalysisOptionsPanel.xaml.cs

@ -50,7 +50,7 @@ namespace ICSharpCode.SourceAnalysis
void BrowseButton_Click(object sender, RoutedEventArgs e) void BrowseButton_Click(object sender, RoutedEventArgs e)
{ {
var fn = OptionsHelper.OpenFile(String.Empty,"",TextBoxEditMode.EditRawProperty); var fn = OptionsHelper.OpenFile(String.Empty,"","",TextBoxEditMode.EditRawProperty);
if (!String.IsNullOrEmpty(fn)) { if (!String.IsNullOrEmpty(fn)) {
settingsFileTextBox.Text = fn; settingsFileTextBox.Text = fn;
} }

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

@ -288,7 +288,7 @@ 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, base.BaseDirectory,
outputPathTextBox.Text,TextBoxEditMode.EditRawProperty); outputPathTextBox.Text,TextBoxEditMode.EditRawProperty);
base.RaisePropertyChanged(()=> OutputPath); base.RaisePropertyChanged(()=> OutputPath);
} }
@ -358,7 +358,7 @@ 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, base.BaseDirectory,
this.baseIntermediateOutputPathTextBox.Text,TextBoxEditMode.EditRawProperty); this.baseIntermediateOutputPathTextBox.Text,TextBoxEditMode.EditRawProperty);
base.RaisePropertyChanged(()=> BaseIntermediateOutputPath); base.RaisePropertyChanged(()=> BaseIntermediateOutputPath);
} }
@ -377,7 +377,7 @@ 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, base.BaseDirectory,
this.intermediateOutputPathTextBox.Text,TextBoxEditMode.EditRawProperty); this.intermediateOutputPathTextBox.Text,TextBoxEditMode.EditRawProperty);
base.RaisePropertyChanged(()=> IntermediateOutputPath); base.RaisePropertyChanged(()=> IntermediateOutputPath);
} }

4
src/AddIns/BackendBindings/CppBinding/CppBinding/Project/ApplicationOptions.cs

@ -346,7 +346,7 @@ namespace ICSharpCode.CppBinding.Project
void ApplicationIconButton_Click(object sender, RoutedEventArgs e) void ApplicationIconButton_Click(object sender, RoutedEventArgs e)
{ {
string fileName = OptionsHelper.OpenFile(iconsfilter,base.BaseDirectory,TextBoxEditMode.EditRawProperty); string fileName = OptionsHelper.OpenFile(iconsfilter,base.BaseDirectory,this.applicationIconTextBox.Text,TextBoxEditMode.EditRawProperty);
if (!String.IsNullOrEmpty(fileName)) if (!String.IsNullOrEmpty(fileName))
{ {
this.applicationIconTextBox.Text = fileName; this.applicationIconTextBox.Text = fileName;
@ -408,7 +408,7 @@ namespace ICSharpCode.CppBinding.Project
void BrowseForManifest() void BrowseForManifest()
{ {
applicationManifestComboBox.SelectedIndex = -1; applicationManifestComboBox.SelectedIndex = -1;
var fileName = OptionsHelper.OpenFile(manifestFilter,base.BaseDirectory,TextBoxEditMode.EditRawProperty); var fileName = OptionsHelper.OpenFile(manifestFilter,base.BaseDirectory,ApplicationManifest.Value,TextBoxEditMode.EditRawProperty);
if (!String.IsNullOrEmpty(fileName)) { if (!String.IsNullOrEmpty(fileName)) {
this.applicationManifestComboBox.Items.Insert(0,fileName); this.applicationManifestComboBox.Items.Insert(0,fileName);
this.applicationManifestComboBox.SelectedIndex = 0; this.applicationManifestComboBox.SelectedIndex = 0;

2
src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonOptionsPanel.xaml.cs

@ -45,7 +45,7 @@ namespace ICSharpCode.PythonBinding
void Browse() void Browse()
{ {
string str = OptionsHelper.OpenFile ("${res:SharpDevelop.FileFilter.ExecutableFiles}|*.exe","",TextBoxEditMode.EditRawProperty); string str = OptionsHelper.OpenFile ("${res:SharpDevelop.FileFilter.ExecutableFiles}|*.exe","",PythonFileName,TextBoxEditMode.EditRawProperty);
if (String.IsNullOrEmpty(str)) if (String.IsNullOrEmpty(str))
return; return;
PythonFileName = str; PythonFileName = str;

9
src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ApplicationSettings.xaml.cs

@ -245,7 +245,8 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
void ApplicationIconButton_Click(object sender, RoutedEventArgs e) void ApplicationIconButton_Click(object sender, RoutedEventArgs e)
{ {
string fileName = OptionsHelper.OpenFile(iconsfilter,base.BaseDirectory,TextBoxEditMode.EditRawProperty); string fileName = OptionsHelper.OpenFile(iconsfilter,base.BaseDirectory,
ApplicationIcon.Value,TextBoxEditMode.EditRawProperty);
if (!String.IsNullOrEmpty(fileName)) if (!String.IsNullOrEmpty(fileName))
{ {
this.applicationIconTextBox.Text = fileName; this.applicationIconTextBox.Text = fileName;
@ -353,7 +354,8 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
void BrowseForManifest() void BrowseForManifest()
{ {
var fileName = OptionsHelper.OpenFile(manifestFilter,base.BaseDirectory,TextBoxEditMode.EditRawProperty); var fileName = OptionsHelper.OpenFile(manifestFilter,base.BaseDirectory,
ApplicationManifest.Value,TextBoxEditMode.EditRawProperty);
if (!String.IsNullOrEmpty(fileName)) { if (!String.IsNullOrEmpty(fileName)) {
applicationManifestComboBox.Text = fileName; applicationManifestComboBox.Text = fileName;
} }
@ -398,7 +400,8 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
void Win32ResourceComboButton_Click(object sender, RoutedEventArgs e) void Win32ResourceComboButton_Click(object sender, RoutedEventArgs e)
{ {
string fileName = OptionsHelper.OpenFile(win32filter,base.BaseDirectory,TextBoxEditMode.EditRawProperty); string fileName = OptionsHelper.OpenFile(win32filter,base.BaseDirectory,
Win32Resource.Value,TextBoxEditMode.EditRawProperty);
if (!String.IsNullOrEmpty(fileName)) if (!String.IsNullOrEmpty(fileName))
{ {
this.win32ResourceFileTextBox.Text = fileName; this.win32ResourceFileTextBox.Text = fileName;

31
src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/DebugOptions.xaml

@ -7,11 +7,10 @@
xmlns:local="clr-namespace:ICSharpCode.SharpDevelop.Gui.OptionPanels" xmlns:local="clr-namespace:ICSharpCode.SharpDevelop.Gui.OptionPanels"
xmlns:projects="clr-namespace:ICSharpCode.SharpDevelop.Project" xmlns:projects="clr-namespace:ICSharpCode.SharpDevelop.Project"
xmlns:core="http://icsharpcode.net/sharpdevelop/core"> xmlns:core="http://icsharpcode.net/sharpdevelop/core">
<optionpanels:ProjectOptionPanel.Resources> <optionpanels:ProjectOptionPanel.Resources>
<local:StorageLocationConverter <local:StorageLocationConverter x:Key="converter" />
x:Key="converter" /> <local:StartActionToBooleanConverter x:Key="startActionToBool" />
<local:StartActionToBooleanConverter
x:Key="startActionToBool" />
</optionpanels:ProjectOptionPanel.Resources> </optionpanels:ProjectOptionPanel.Resources>
<ScrollViewer> <ScrollViewer>
@ -38,21 +37,20 @@
<ColumnDefinition></ColumnDefinition> <ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition> <ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<optionpanels:StorageLocationPicker <optionpanels:StorageLocationPicker
Grid.Row="1" Grid.Row="1"
VerticalAlignment="Center"> VerticalAlignment="Center">
<optionpanels:StorageLocationPicker.Location> <optionpanels:StorageLocationPicker.Location>
<MultiBinding <MultiBinding
Converter="{StaticResource converter}"> Converter="{StaticResource converter}">
<Binding <Binding Path="StartAction.Location" />
Path="StartAction.Location" /> <Binding Path="StartProgram.Location" />
<Binding <Binding Path="StartURL.Location" />
Path="StartProgram.Location" />
<Binding
Path="StartURL.Location" />
</MultiBinding> </MultiBinding>
</optionpanels:StorageLocationPicker.Location> </optionpanels:StorageLocationPicker.Location>
</optionpanels:StorageLocationPicker> </optionpanels:StorageLocationPicker>
<RadioButton Grid.Column="1" VerticalAlignment="Center" Margin="4,0,0,0" <RadioButton Grid.Column="1" VerticalAlignment="Center" Margin="4,0,0,0"
IsChecked="{Binding StartAction.Value, IsChecked="{Binding StartAction.Value,
Converter={StaticResource startActionToBool}, Converter={StaticResource startActionToBool},
@ -60,8 +58,8 @@
Content="{core:Localize Dialog.ProjectOptions.DebugOptions.StartProject}"> Content="{core:Localize Dialog.ProjectOptions.DebugOptions.StartProject}">
</RadioButton> </RadioButton>
<!--x:Name="startexternal"-->
<RadioButton Grid.Row="1" Grid.Column="1" Margin="4,0,0,0" VerticalAlignment="Center" <RadioButton x:Name="startexternal" Grid.Row="1" Grid.Column="1" Margin="4,0,0,0" VerticalAlignment="Center"
IsChecked="{Binding StartAction.Value, IsChecked="{Binding StartAction.Value,
Converter={StaticResource startActionToBool}, Converter={StaticResource startActionToBool},
ConverterParameter={x:Static projects:StartAction.Program}}" ConverterParameter={x:Static projects:StartAction.Program}}"
@ -89,6 +87,7 @@
Text="{Binding StartURL.Value, UpdateSourceTrigger=PropertyChanged}"></TextBox> Text="{Binding StartURL.Value, UpdateSourceTrigger=PropertyChanged}"></TextBox>
</Grid> </Grid>
</GroupBox> </GroupBox>
<GroupBox Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="3" <GroupBox Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="3"
Height="90" VerticalAlignment="Top" Margin="0,5,0,0" Height="90" VerticalAlignment="Top" Margin="0,5,0,0"
Header="{core:Localize Dialog.ProjectOptions.DebugOptions.StartOptions}" Header="{core:Localize Dialog.ProjectOptions.DebugOptions.StartOptions}"
@ -104,17 +103,17 @@
<ColumnDefinition></ColumnDefinition> <ColumnDefinition></ColumnDefinition>
<ColumnDefinition Width="Auto"></ColumnDefinition> <ColumnDefinition Width="Auto"></ColumnDefinition>
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<optionpanels:StorageLocationPicker Grid.Row="1" Grid.RowSpan="2" VerticalAlignment="Center"> <optionpanels:StorageLocationPicker Grid.Row="1" Grid.RowSpan="2" VerticalAlignment="Center">
<optionpanels:StorageLocationPicker.Location> <optionpanels:StorageLocationPicker.Location>
<MultiBinding <MultiBinding
Converter="{StaticResource converter}"> Converter="{StaticResource converter}">
<Binding <Binding Path="StartArguments.Location" />
Path="StartArguments.Location" /> <Binding Path="StartWorkingDirectory.Location" />
<Binding
Path="StartWorkingDirectory.Location" />
</MultiBinding> </MultiBinding>
</optionpanels:StorageLocationPicker.Location> </optionpanels:StorageLocationPicker.Location>
</optionpanels:StorageLocationPicker> </optionpanels:StorageLocationPicker>
<Label Grid.Column="1" Margin="4,0,0,0" VerticalAlignment="Center" <Label Grid.Column="1" Margin="4,0,0,0" VerticalAlignment="Center"
Content="{core:Localize Dialog.ProjectOptions.DebugOptions.Arguments}"></Label> Content="{core:Localize Dialog.ProjectOptions.DebugOptions.Arguments}"></Label>

97
src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/DebugOptions.xaml.cs

@ -33,44 +33,31 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
public ProjectProperty<StartAction> StartAction public ProjectProperty<StartAction> StartAction
{ {
get get{ return GetProperty<StartAction>("StartAction",
{ SharpDevelop.Project.StartAction.Project, PropertyStorageLocations.ConfigurationSpecific);}
return GetProperty<StartAction>("StartAction", SharpDevelop.Project.StartAction.Project, PropertyStorageLocations.ConfigurationSpecific);
}
} }
public ProjectProperty<string> StartProgram public ProjectProperty<string> StartProgram
{ {
get get { return GetProperty("StartProgram", "", TextBoxEditMode.EditRawProperty, PropertyStorageLocations.ConfigurationSpecific);}
{
return GetProperty("StartProgram", "", TextBoxEditMode.EditRawProperty, PropertyStorageLocations.ConfigurationSpecific);
}
} }
public ProjectProperty<string> StartURL public ProjectProperty<string> StartURL
{ {
get get{ return GetProperty("StartURL", "", TextBoxEditMode.EditRawProperty, PropertyStorageLocations.ConfigurationSpecific);}
{
return GetProperty("StartURL", "", TextBoxEditMode.EditRawProperty, PropertyStorageLocations.ConfigurationSpecific);
}
} }
public ProjectProperty<string> StartArguments public ProjectProperty<string> StartArguments
{ {
get get{ return GetProperty("StartArguments", "", TextBoxEditMode.EditRawProperty, PropertyStorageLocations.ConfigurationSpecific);}
{
return GetProperty("StartArguments", "", TextBoxEditMode.EditRawProperty, PropertyStorageLocations.ConfigurationSpecific);
}
} }
public ProjectProperty<string> StartWorkingDirectory public ProjectProperty<string> StartWorkingDirectory
{ {
get { get { return GetProperty("StartWorkingDirectory", "", TextBoxEditMode.EditRawProperty, PropertyStorageLocations.ConfigurationSpecific);}
return GetProperty("StartWorkingDirectory", "", TextBoxEditMode.EditRawProperty, PropertyStorageLocations.ConfigurationSpecific);
}
} }
void ExternalProgramButton_Click(object sender, System.Windows.RoutedEventArgs e) void ExternalProgramButton_Click(object sender, System.Windows.RoutedEventArgs e)
@ -82,79 +69,15 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
void BrwoseForFolder_Click(object sender, System.Windows.RoutedEventArgs e) void BrwoseForFolder_Click(object sender, System.Windows.RoutedEventArgs e)
{ {
StartWorkingDirectory.Value = BrowseForFolder ("${res:Dialog.ProjectOptions.SelectFolderTitle}",TextBoxEditMode.EditRawProperty); StartWorkingDirectory.Value = OptionsHelper.BrowseForFolder("${res:Dialog.ProjectOptions.SelectFolderTitle}",
base.BaseDirectory,String.Empty,TextBoxEditMode.EditRawProperty);
} }
private string FileDialog (string filter) private string FileDialog (string filter)
{ {
string fileName = String.Empty; return OptionsHelper.OpenFile(filter,base.BaseDirectory,
StartProgram.Value,TextBoxEditMode.EditRawProperty);
using (OpenFileDialog fdiag = new OpenFileDialog())
{
fdiag.Filter = StringParser.Parse(filter);
fdiag.Multiselect = false;
try {
string initialDir = System.IO.Path.GetDirectoryName(System.IO.Path.Combine(base.BaseDirectory,string.Empty));
if (FileUtility.IsValidPath(initialDir) && System.IO.Directory.Exists(initialDir)) {
fdiag.InitialDirectory = initialDir;
}
}
catch {}
if(fdiag.ShowDialog() == DialogResult.OK) {
fileName = fdiag.FileName;
if (base.BaseDirectory != null) {
fileName = FileUtility.GetRelativePath(base.BaseDirectory,fileName);
}
/*
if (textBoxEditMode == TextBoxEditMode.EditEvaluatedProperty) {
target.Text = file;
} else {
target.Text = MSBuildInternals.Escape(file);
}
*/
}
// return fileName;
}
return fileName;
}
private string BrowseForFolder(string description,TextBoxEditMode textBoxEditMode)
{
string startLocation = base.BaseDirectory;
if (startLocation != null) {
string text = StartWorkingDirectory.Value;
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 (base.BaseDirectory != null) {
path = FileUtility.GetRelativePath(base.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);
//// }
return path;
}
}
return startLocation;
} }
} }
} }

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

@ -15,22 +15,20 @@ 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 startLocation,
string relativeLocation,
TextBoxEditMode textBoxEditMode) TextBoxEditMode textBoxEditMode)
{ {
string startAt = startLocation;
if (!String.IsNullOrEmpty(relativeLocation)) {
startAt = FileUtility.GetAbsolutePath(startLocation,relativeLocation);
}
string startAt = CreateStartPath(startLocation, relativeLocation);
using (System.Windows.Forms.FolderBrowserDialog fdiag = FileService.CreateFolderBrowserDialog(description,startAt)) using (System.Windows.Forms.FolderBrowserDialog fdiag = FileService.CreateFolderBrowserDialog(description,startAt))
{ {
if (fdiag.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (fdiag.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
string path = fdiag.SelectedPath; string path = fdiag.SelectedPath;
if (baseDirectory != null) { if (!String.IsNullOrEmpty(startLocation)) {
path = FileUtility.GetRelativePath(baseDirectory, path); path = FileUtility.GetRelativePath(startLocation, path);
} }
if (!path.EndsWith("\\") && !path.EndsWith("/")) if (!path.EndsWith("\\") && !path.EndsWith("/"))
path += "\\"; path += "\\";
@ -50,18 +48,23 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
/// </summary> /// </summary>
/// <param name="filter" or String.Empty></param> /// <param name="filter" or String.Empty></param>
/// <returns FileName></returns> /// <returns FileName></returns>
public static string OpenFile (string filter,string baseDirectory,TextBoxEditMode textBoxEditMode) public static string OpenFile (string filter,string startLocation,string relativeLocation, TextBoxEditMode textBoxEditMode)
{ {
string startAt = CreateStartPath(startLocation, relativeLocation);
var dialog = new OpenFileDialog(); var dialog = new OpenFileDialog();
dialog.InitialDirectory = startAt;
if (!String.IsNullOrEmpty(filter)) { if (!String.IsNullOrEmpty(filter)) {
dialog.Filter = StringParser.Parse(filter); dialog.Filter = StringParser.Parse(filter);
} }
if (dialog.ShowDialog() ?? false) { if (dialog.ShowDialog() ?? false) {
string fileName = dialog.FileName; string fileName = dialog.FileName;
if (!String.IsNullOrEmpty(baseDirectory)) {
fileName = FileUtility.GetRelativePath(baseDirectory, fileName); if (!String.IsNullOrEmpty(startLocation)) {
} fileName = FileUtility.GetRelativePath(startLocation, fileName);
}
if (textBoxEditMode == TextBoxEditMode.EditEvaluatedProperty) { if (textBoxEditMode == TextBoxEditMode.EditEvaluatedProperty) {
return fileName; return fileName;
} else { } else {
@ -70,5 +73,15 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
} }
return string.Empty; return string.Empty;
} }
private static string CreateStartPath(string startLocation, string relativeLocation)
{
string startAt = startLocation;
if (!String.IsNullOrEmpty(relativeLocation)) {
startAt = FileUtility.GetAbsolutePath(startLocation, relativeLocation);
}
return startAt;
}
} }
} }

1
src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/Signing.xaml.cs

@ -154,6 +154,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
{ {
string fileName = OptionsHelper.OpenFile("${res:SharpDevelop.FileFilter.KeyFiles} (" + KeyFileExtensions + ")|" + KeyFileExtensions + "|${res:SharpDevelop.FileFilter.AllFiles}|*.*", string fileName = OptionsHelper.OpenFile("${res:SharpDevelop.FileFilter.KeyFiles} (" + KeyFileExtensions + ")|" + KeyFileExtensions + "|${res:SharpDevelop.FileFilter.AllFiles}|*.*",
base.BaseDirectory, base.BaseDirectory,
this.AssemblyOriginatorKeyFile.Value,
TextBoxEditMode.EditRawProperty); TextBoxEditMode.EditRawProperty);
if (!String.IsNullOrEmpty(fileName)) { if (!String.IsNullOrEmpty(fileName)) {
this.AssemblyOriginatorKeyFile.Value = fileName; this.AssemblyOriginatorKeyFile.Value = fileName;

2
src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/ServiceReference/ServiceReferenceOptionsPanel..xaml.cs

@ -29,7 +29,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels.ServiceReference
void Browse() void Browse()
{ {
string fileName = OptionsHelper.OpenFile(string.Empty,"",TextBoxEditMode.EditRawProperty); string fileName = OptionsHelper.OpenFile(string.Empty,String.Empty,String.Empty,TextBoxEditMode.EditRawProperty);
if (!String.IsNullOrEmpty(fileName)) { if (!String.IsNullOrEmpty(fileName)) {
SvcUtilPath = fileName; SvcUtilPath = fileName;
} }

Loading…
Cancel
Save