Browse Source

ApplicationSettings, modify OptionsHelper.cs BrowseForFolder and OpenFile to return Relative Path

pull/30/head
PeterForstmeier 13 years ago
parent
commit
04cd4b46c5
  1. 3
      src/AddIns/Analysis/CodeAnalysis/Src/AnalysisIdeOptionsPanel.xaml.cs
  2. 3
      src/AddIns/Analysis/SourceAnalysis/Src/AnalysisIdeOptionsPanel.xaml.cs
  3. 2
      src/AddIns/Analysis/SourceAnalysis/Src/AnalysisOptionsPanel.xaml.cs
  4. 4
      src/AddIns/BackendBindings/CppBinding/CppBinding/Project/ApplicationOptions.cs
  5. 3
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonOptionsPanel.xaml.cs
  6. 1
      src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
  7. 56
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ApplicationSettings.xaml
  8. 183
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ApplicationSettings.xaml.cs
  9. 44
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/OptionsHelper.cs
  10. 8
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/Signing.xaml.cs
  11. 3
      src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/ServiceReference/ServiceReferenceOptionsPanel..xaml.cs

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

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

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

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

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

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

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

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

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

@ -7,6 +7,7 @@ using System.Windows.Input; @@ -7,6 +7,7 @@ using System.Windows.Input;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Gui.OptionPanels;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Widgets;
using SDCore = ICSharpCode.Core;
@ -44,7 +45,7 @@ namespace ICSharpCode.PythonBinding @@ -44,7 +45,7 @@ namespace ICSharpCode.PythonBinding
void Browse()
{
string str = OptionsHelper.OpenFile ("${res:SharpDevelop.FileFilter.ExecutableFiles}|*.exe");
string str = OptionsHelper.OpenFile ("${res:SharpDevelop.FileFilter.ExecutableFiles}|*.exe","",TextBoxEditMode.EditRawProperty);
if (String.IsNullOrEmpty(str))
return;
PythonFileName = str;

1
src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj

@ -28,6 +28,7 @@ @@ -28,6 +28,7 @@
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<ApplicationIcon>..\..\StartUp\Project\Resources\SharpDevelop.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugType>Full</DebugType>

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

@ -9,7 +9,9 @@ @@ -9,7 +9,9 @@
xmlns:core="http://icsharpcode.net/sharpdevelop/core"
xmlns:optionpanels="clr-namespace:ICSharpCode.SharpDevelop.Gui.OptionPanels"
xmlns:project="clr-namespace:ICSharpCode.SharpDevelop.Project">
<!--<optionpanels:ProjectOptionPanel.Resources>
<optionpanels:StorageLocationConverter x:Key="locationConverter" />
</optionpanels:ProjectOptionPanel.Resources>-->
<ScrollViewer VerticalScrollBarVisibility="Auto">
<Grid>
<Grid.RowDefinitions>
@ -59,16 +61,32 @@ @@ -59,16 +61,32 @@
<Label Grid.Row="4" Grid.Column="2"
Content="{core:Localize Dialog.ProjectOptions.ApplicationSettings.StartupObject}"></Label>
<optionpanels:StorageLocationPicker Grid.Row="5" DockPanel.Dock="Left"
Location="{Binding OutputType.Location}"/>
<ComboBox x:Name="outputTypeComboBox" Grid.Row="5" Grid.Column="1" VerticalAlignment="Center" Margin="3,0,3,0"
gui:EnumBinding.EnumType="{x:Type project:OutputType}"></ComboBox>
<optionpanels:StorageLocationPicker Grid.Row="5" DockPanel.Dock="Left">
<!--<optionpanels:StorageLocationPicker.Location>
<MultiBinding
Converter="{StaticResource locationConverter}">
<Binding Path="OutputType.Location" />
<Binding Path="StartupObject.Location" />
</MultiBinding>
</optionpanels:StorageLocationPicker.Location>-->
</optionpanels:StorageLocationPicker>
<ComboBox x:Name="outputTypeComboBox"
Grid.Row="5" Grid.Column="1" VerticalAlignment="Center" Margin="3,0,3,0"
gui:EnumBinding.EnumType="{x:Type project:OutputType}"
SelectedValue="{Binding OutputType.Value}"
></ComboBox>
<ComboBox x:Name="startupObjectComboBox" Grid.Row="5" Grid.Column="2" VerticalAlignment="Center"
IsEnabled="False"></ComboBox>
Text="{Binding StartupObject.Value,UpdateSourceTrigger=PropertyChanged}"
IsEditable="True"
IsEnabled="False">
</ComboBox>
<Image x:Name="applicationIconImage" Width="32" Height="32" Grid.Row="6"></Image>
<Image Grid.Row="6" Width="32" Height="32"
Source="{Binding Image}">
</Image>
<Label Grid.Row="6" Grid.Column="1" Margin="3,0,3,0"
Content="{core:Localize Dialog.ProjectOptions.ApplicationSettings.ApplicationIcon}"></Label>
@ -78,8 +96,10 @@ @@ -78,8 +96,10 @@
<optionpanels:StorageLocationPicker DockPanel.Dock="Left" Location="{Binding ApplicationIcon.Location}"></optionpanels:StorageLocationPicker>
<TextBox x:Name="applicationIconTextBox"
VerticalAlignment="Center"
Text="{Binding ApplicationIcon.Value,UpdateSourceTrigger=PropertyChanged}"></TextBox>
VerticalAlignment="Center"
TextChanged="ApplicationIconTextBox_TextChanged"
Text="{Binding ApplicationIcon.Value,UpdateSourceTrigger=PropertyChanged}">
</TextBox>
</DockPanel>
@ -93,12 +113,16 @@ @@ -93,12 +113,16 @@
<widgets:StackPanelWithSpacing Grid.Row="7" Grid.Column="2" Grid.ColumnSpan="2"
SpaceBetweenItems="3"
Orientation="Horizontal">
<optionpanels:StorageLocationPicker DockPanel.Dock="Left"
Location="{Binding PreBuildEvent.Location}"/>
<ComboBox x:Name="applicationManifestComboBox" VerticalAlignment="Center"
SelectionChanged="ApplicationManifestComboBox_SelectionChanged"
Width="200"></ComboBox>
<optionpanels:StorageLocationPicker DockPanel.Dock="Left" Location="{Binding ApplicationManifest.Location}"/>
<!-- Text="{Binding ApplicationManifest.Value,UpdateSourceTrigger=PropertyChanged}"-->
<ComboBox x:Name="applicationManifestComboBox" VerticalAlignment="Center" Width="200"
IsEditable="True"
ItemsSource="{Binding ManifestItems}"
LostFocus="ApplicationManifestComboBox_LostFocus"
SelectionChanged="ApplicationManifestComboBox_SelectionChanged" >
</ComboBox>
</widgets:StackPanelWithSpacing>

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

@ -32,12 +32,13 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -32,12 +32,13 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
public ApplicationSettings()
{
InitializeComponent();
this.DataContext = this;
}
private void Initialize()
{
startupObjectComboBox.Items.Clear();
foreach (IClass c in GetPossibleStartupObjects(base.Project)) {
startupObjectComboBox.Items.Add(c.FullyQualifiedName);
}
@ -65,16 +66,36 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -65,16 +66,36 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
}
private List<String> itemsSource;
public List<string> ManifestItems {
get { return itemsSource; }
set { itemsSource = value;
base.RaisePropertyChanged(() => ManifestItems);
}
}
void FillManifestCombo()
{
applicationManifestComboBox.Items.Add(StringParser.Parse("${res:Dialog.ProjectOptions.ApplicationSettings.Manifest.EmbedDefault}"));
applicationManifestComboBox.Items.Add(StringParser.Parse("${res:Dialog.ProjectOptions.ApplicationSettings.Manifest.DoNotEmbedManifest}"));
itemsSource = new List<string>();
itemsSource.Add(StringParser.Parse("${res:Dialog.ProjectOptions.ApplicationSettings.Manifest.EmbedDefault}"));
itemsSource.Add(StringParser.Parse("${res:Dialog.ProjectOptions.ApplicationSettings.Manifest.DoNotEmbedManifest}"));
foreach (string fileName in Directory.GetFiles(base.BaseDirectory, "*.manifest")) {
applicationManifestComboBox.Items.Add(Path.GetFileName(fileName));
itemsSource.Add(Path.GetFileName(fileName));
}
applicationManifestComboBox.Items.Add(StringParser.Parse("<${res:Global.CreateButtonText}...>"));
applicationManifestComboBox.Items.Add(StringParser.Parse("<${res:Global.BrowseText}...>"));
applicationManifestComboBox.SelectedIndex = 0;
itemsSource.Add(StringParser.Parse("<${res:Global.CreateButtonText}...>"));
itemsSource.Add(StringParser.Parse("<${res:Global.BrowseText}...>"));
// applicationManifestComboBox.Items.Clear();
// applicationManifestComboBox.Items.Add(StringParser.Parse("${res:Dialog.ProjectOptions.ApplicationSettings.Manifest.EmbedDefault}"));
// applicationManifestComboBox.Items.Add(StringParser.Parse("${res:Dialog.ProjectOptions.ApplicationSettings.Manifest.DoNotEmbedManifest}"));
// foreach (string fileName in Directory.GetFiles(base.BaseDirectory, "*.manifest")) {
// applicationManifestComboBox.Items.Add(Path.GetFileName(fileName));
// }
// applicationManifestComboBox.Items.Add(StringParser.Parse("<${res:Global.CreateButtonText}...>"));
// applicationManifestComboBox.Items.Add(StringParser.Parse("<${res:Global.BrowseText}...>"));
// applicationManifestComboBox.ItemsSource = itemsSource;
ManifestItems = itemsSource;
}
@ -82,13 +103,20 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -82,13 +103,20 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
get { return GetProperty("AssemblyName", "", TextBoxEditMode.EditRawProperty); }
}
public ProjectProperty<string> RootNamespace {
get { return GetProperty("RootNamespace", "", TextBoxEditMode.EditRawProperty); }
}
public ProjectProperty<OutputType> OutputType {
get {return GetProperty("OutputType", ICSharpCode.SharpDevelop.Project.OutputType.Exe); }
get {
return GetProperty("OutputType", ICSharpCode.SharpDevelop.Project.OutputType.Exe); }
}
public ProjectProperty<string> StartupObject {
get {return GetProperty("StartupObject", "", TextBoxEditMode.EditRawProperty); }
}
@ -98,7 +126,14 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -98,7 +126,14 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
public ProjectProperty<string> ApplicationManifest {
get { return GetProperty("ApplicationManifest", "", TextBoxEditMode.EditRawProperty); }
get {
return GetProperty("ApplicationManifest", "", TextBoxEditMode.EditRawProperty); }
}
public ProjectProperty<bool> NoWin32Manifest {
get {
return GetProperty("NoWin32Manifest",false); }
}
@ -114,11 +149,37 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -114,11 +149,37 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
{
base.Load(project, configuration, platform);
Initialize();
if (string.IsNullOrEmpty(this.ApplicationManifest.Value)) {
if (this.NoWin32Manifest.Value) {
applicationManifestComboBox.SelectedIndex = 1;
} else {
applicationManifestComboBox.SelectedIndex = 0;
}
}
else {
applicationManifestComboBox.Text = this.ApplicationManifest.Value;
}
IsDirty = false;
}
protected override bool Save(MSBuildBasedProject project, string configuration, string platform)
{
if (applicationManifestComboBox.SelectedIndex == 0) {
// Embed default manifest
this.NoWin32Manifest.Value = false;
this.ApplicationManifest.Value = "";
this.NoWin32Manifest.Location = ApplicationManifest.Location;
} else if (applicationManifestComboBox.SelectedIndex == 1) {
// No manifest
this.NoWin32Manifest.Value = true;
this.ApplicationManifest.Value = "";
this.NoWin32Manifest.Location = ApplicationManifest.Location;
} else {
ApplicationManifest.Value = applicationManifestComboBox.Text;
this.NoWin32Manifest.Value = false;
this.NoWin32Manifest.Location = ApplicationManifest.Location;
}
return base.Save(project, configuration, platform);
}
@ -141,12 +202,14 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -141,12 +202,14 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
return results;
}
void project_MinimumSolutionVersionChanged(object sender, EventArgs e)
{
// embedding manifests requires the project to target MSBuild 3.5 or higher
applicationManifestComboBox.IsEnabled = base.Project.MinimumSolutionVersion >= Solution.SolutionVersionVS2008;
}
#region refresh Outputpath + StartupOptions
void RefreshOutputNameTextBox (object sender, TextChangedEventArgs e)
@ -182,38 +245,84 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -182,38 +245,84 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
void ApplicationIconButton_Click(object sender, RoutedEventArgs e)
{
string fileName = OptionsHelper.OpenFile(iconsfilter);
string fileName = OptionsHelper.OpenFile(iconsfilter,base.BaseDirectory,TextBoxEditMode.EditRawProperty);
if (!String.IsNullOrEmpty(fileName))
{
this.applicationIconTextBox.Text = fileName;
}
}
void ApplicationIconTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
if (base.Project != null) {
if(FileUtility.IsValidPath(this.applicationIconTextBox.Text))
{
string appIconPath = Path.Combine(base.BaseDirectory, this.applicationIconTextBox.Text);
Console.WriteLine(appIconPath);
var b = File.Exists(appIconPath);
if (File.Exists(appIconPath)) {
try {
FileStream stream = new FileStream(appIconPath, FileMode.Open, FileAccess.Read);
Image image = new Image();
BitmapImage src = new BitmapImage();
src.BeginInit();
src.StreamSource = stream;
src.EndInit();
image.Source = src;
image.Stretch = Stretch.Uniform;
MemoryStream memoryStream = new MemoryStream();
using (var stream = new FileStream(appIconPath, FileMode.Open, FileAccess.Read))
{
memoryStream.SetLength(stream.Length);
stream.Read(memoryStream.GetBuffer(), 0, (int)stream.Length);
memoryStream.Flush();
stream.Close();
Image image = new Image();
BitmapImage src = new BitmapImage();
src.BeginInit();
src.StreamSource = memoryStream;
src.EndInit();
image.Source = src;
image.Stretch = Stretch.Uniform;
Image = image.Source;
}
this.applicationIconImage.Source = image.Source;
this.applicationIconImage.Stretch = Stretch.Fill;
} catch (OutOfMemoryException) {
Image = null;
MessageService.ShowErrorFormatted("${res:Dialog.ProjectOptions.ApplicationSettings.InvalidIconFile}",
FileUtility.NormalizePath(appIconPath));
}
} else {
Image = null;
}
}
}
}
private ImageSource image;
public ImageSource Image {
get { return image; }
set { image = value;
base.RaisePropertyChanged(() => Image); }
}
/*
void ApplicationIconTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
if (base.Project != null) {
if(FileUtility.IsValidPath(this.applicationIconTextBox.Text))
{
string appIconPath = Path.Combine(base.BaseDirectory, this.applicationIconTextBox.Text);
if (File.Exists(appIconPath)) {
// http://stackoverflow.com/questions/569561/dynamic-loading-of-images-in-wpf
try {
using (var stream = new FileStream(appIconPath, FileMode.Open, FileAccess.Read))
{
Image image = new Image();
BitmapImage src = new BitmapImage();
src.BeginInit();
src.StreamSource = stream;
src.EndInit();
image.Source = src;
image.Stretch = Stretch.Uniform;
this.applicationIconImage.Source = image.Source;
this.applicationIconImage.Stretch = Stretch.Fill;
}
} catch (OutOfMemoryException) {
this.applicationIconImage.Source = null;
@ -226,13 +335,14 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -226,13 +335,14 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
}
}
}
*/
#endregion
#region manifest
void ApplicationManifestComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
Console.WriteLine("ComboBox_SelectionChanged {0}",applicationManifestComboBox.Text);
if (applicationManifestComboBox.SelectedIndex == applicationManifestComboBox.Items.Count - 2) {
CreateManifest();
} else if (applicationManifestComboBox.SelectedIndex == applicationManifestComboBox.Items.Count - 1) {
@ -243,12 +353,12 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -243,12 +353,12 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
void BrowseForManifest()
{
applicationManifestComboBox.SelectedIndex = -1;
var fileName = OptionsHelper.OpenFile(manifestFilter);
var fileName = OptionsHelper.OpenFile(manifestFilter,base.BaseDirectory,TextBoxEditMode.EditRawProperty);
if (!String.IsNullOrEmpty(fileName)) {
this.applicationManifestComboBox.Items.Insert(0,fileName);
this.applicationManifestComboBox.SelectedIndex = 0;
applicationManifestComboBox.Text = fileName;
}
Console.WriteLine("aaa {0}",applicationManifestComboBox.Text);
Console.WriteLine("bbb {0}",ApplicationManifest.Value);
}
void CreateManifest()
@ -277,7 +387,8 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -277,7 +387,8 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
FileService.OpenFile(manifestFile);
this.applicationManifestComboBox.Items.Insert(0,"app.manifest");
// this.applicationManifestComboBox.Items.Insert(0,"app.manifest");
ManifestItems.Insert(0,"app.manifest");
this.applicationManifestComboBox.SelectedIndex = 0;
}
@ -287,13 +398,19 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -287,13 +398,19 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
void Win32ResourceComboButton_Click(object sender, RoutedEventArgs e)
{
string fileName = OptionsHelper.OpenFile(win32filter);
string fileName = OptionsHelper.OpenFile(win32filter,base.BaseDirectory,TextBoxEditMode.EditRawProperty);
if (!String.IsNullOrEmpty(fileName))
{
this.win32ResourceFileTextBox.Text = fileName;
}
}
void ApplicationManifestComboBox_LostFocus(object sender, RoutedEventArgs e)
{
Console.WriteLine("ComboBox_LostFocus {0}",applicationManifestComboBox.Text);
}
#endregion
}
}

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

@ -17,7 +17,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -17,7 +17,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
public static string BrowseForFolder(string description,string baseDirectory,
string startLocation,string relativeLocation,
TextBoxEditMode textBoxEditMode)
TextBoxEditMode textBoxEditMode)
{
string startAt = startLocation;
if (!String.IsNullOrEmpty(relativeLocation)) {
@ -40,45 +40,17 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -40,45 +40,17 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
return MSBuildInternals.Escape(path);
}
}
}
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);
}
}
}
}
*/
/// <summary>
/// Open File
/// </summary>
/// <param name="filter" or String.Empty></param>
/// <returns FileName></returns>
public static string OpenFile (string filter)
public static string OpenFile (string filter,string baseDirectory,TextBoxEditMode textBoxEditMode)
{
var dialog = new OpenFileDialog();
if (!String.IsNullOrEmpty(filter)) {
@ -86,7 +58,15 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -86,7 +58,15 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
}
if (dialog.ShowDialog() ?? false) {
return dialog.FileName;
string fileName = dialog.FileName;
if (!String.IsNullOrEmpty(baseDirectory)) {
fileName = FileUtility.GetRelativePath(baseDirectory, fileName);
}
if (textBoxEditMode == TextBoxEditMode.EditEvaluatedProperty) {
return fileName;
} else {
return MSBuildInternals.Escape(fileName);
}
}
return string.Empty;
}

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

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

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

@ -6,6 +6,7 @@ using System.ComponentModel; @@ -6,6 +6,7 @@ using System.ComponentModel;
using System.Windows.Input;
using ICSharpCode.SharpDevelop.Gui.Dialogs.ReferenceDialog.ServiceReference;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Widgets;
using Microsoft.Win32;
@ -28,7 +29,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels.ServiceReference @@ -28,7 +29,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels.ServiceReference
void Browse()
{
string fileName = OptionsHelper.OpenFile(string.Empty);
string fileName = OptionsHelper.OpenFile(string.Empty,"",TextBoxEditMode.EditRawProperty);
if (!String.IsNullOrEmpty(fileName)) {
SvcUtilPath = fileName;
}

Loading…
Cancel
Save