diff --git a/src/AddIns/Analysis/CodeAnalysis/Src/AnalysisIdeOptionsPanel.xaml.cs b/src/AddIns/Analysis/CodeAnalysis/Src/AnalysisIdeOptionsPanel.xaml.cs
index 531df0b4aa..c6e1b5384a 100644
--- a/src/AddIns/Analysis/CodeAnalysis/Src/AnalysisIdeOptionsPanel.xaml.cs
+++ b/src/AddIns/Analysis/CodeAnalysis/Src/AnalysisIdeOptionsPanel.xaml.cs
@@ -11,6 +11,7 @@ using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Gui.OptionPanels;
using ICSharpCode.SharpDevelop.Project;
+using Microsoft.Win32;
namespace ICSharpCode.CodeAnalysis
{
@@ -40,9 +41,11 @@ namespace ICSharpCode.CodeAnalysis
private void FindFxCopPath_Click(object sender, System.Windows.RoutedEventArgs e)
{
- string fn = OptionsHelper.OpenFile("${res:SharpDevelop.FileFilter.ExecutableFiles}|*.exe;","","",TextBoxEditMode.EditRawProperty);
- if (!String.IsNullOrEmpty(fn)) {
- string path = Path.GetDirectoryName(fn);
+ OpenFileDialog dlg = new OpenFileDialog();
+ dlg.DefaultExt = "exe";
+ dlg.Filter = StringParser.Parse("FxCop|fxcop.exe|${res:SharpDevelop.FileFilter.AllFiles}|*.*");
+ if (dlg.ShowDialog() == true) {
+ string path = Path.GetDirectoryName(dlg.FileName);
if (FxCopWrapper.IsFxCopPath(path)) {
FxCopPath = path;
} else {
diff --git a/src/AddIns/Analysis/CodeAnalysis/Src/AnalysisProjectOptionsPanelXaml.xaml.cs b/src/AddIns/Analysis/CodeAnalysis/Src/AnalysisProjectOptionsPanelXaml.xaml.cs
index b9bb430c28..a6854c8943 100644
--- a/src/AddIns/Analysis/CodeAnalysis/Src/AnalysisProjectOptionsPanelXaml.xaml.cs
+++ b/src/AddIns/Analysis/CodeAnalysis/Src/AnalysisProjectOptionsPanelXaml.xaml.cs
@@ -21,7 +21,6 @@ using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
-using Gui.Dialogs.OptionPanels.ProjectOptions;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom;
diff --git a/src/AddIns/Analysis/SourceAnalysis/Src/AnalysisIdeOptionsPanel.xaml.cs b/src/AddIns/Analysis/SourceAnalysis/Src/AnalysisIdeOptionsPanel.xaml.cs
index 1d37e440a0..fa9979195e 100644
--- a/src/AddIns/Analysis/SourceAnalysis/Src/AnalysisIdeOptionsPanel.xaml.cs
+++ b/src/AddIns/Analysis/SourceAnalysis/Src/AnalysisIdeOptionsPanel.xaml.cs
@@ -21,6 +21,7 @@ using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Gui.OptionPanels;
using ICSharpCode.SharpDevelop.Project;
+using Microsoft.Win32;
namespace ICSharpCode.SourceAnalysis
{
@@ -50,7 +51,7 @@ namespace ICSharpCode.SourceAnalysis
EnableModifyStyleCopSettings = true;
}
}
-
+
public bool EnableModifyStyleCopSettings {
get { return enableModifyStyleCopSettings; }
@@ -62,9 +63,11 @@ 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,"","",TextBoxEditMode.EditRawProperty);
- if (!String.IsNullOrEmpty(path)) {
+ OpenFileDialog dlg = new OpenFileDialog();
+ dlg.DefaultExt = "dll";
+ dlg.Filter = StringParser.Parse("StyleCop|*" + StyleCopWrapper.STYLE_COP_FILE + "|${res:SharpDevelop.FileFilter.AllFiles}|*.*");
+ if (dlg.ShowDialog() == true) {
+ string path = dlg.FileName;
if (StyleCopWrapper.IsStyleCopPath(path)) {
StyleCopPath = path;
} else {
diff --git a/src/AddIns/Analysis/SourceAnalysis/Src/AnalysisOptionsPanel.xaml.cs b/src/AddIns/Analysis/SourceAnalysis/Src/AnalysisOptionsPanel.xaml.cs
index 1755bc5064..83a67babab 100644
--- a/src/AddIns/Analysis/SourceAnalysis/Src/AnalysisOptionsPanel.xaml.cs
+++ b/src/AddIns/Analysis/SourceAnalysis/Src/AnalysisOptionsPanel.xaml.cs
@@ -50,10 +50,7 @@ namespace ICSharpCode.SourceAnalysis
void BrowseButton_Click(object sender, RoutedEventArgs e)
{
- var fn = OptionsHelper.OpenFile(String.Empty,"","",TextBoxEditMode.EditRawProperty);
- if (!String.IsNullOrEmpty(fn)) {
- settingsFileTextBox.Text = fn;
- }
+ BrowseForFile(SourceAnalysisOverrideSettingsFile, "");
}
diff --git a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptions.xaml.cs b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptions.xaml.cs
index b0245eb117..2e716d98e8 100644
--- a/src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptions.xaml.cs
+++ b/src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptions.xaml.cs
@@ -11,7 +11,6 @@ using System.Diagnostics;
using System.Globalization;
using System.IO;
-using Gui.Dialogs.OptionPanels.ProjectOptions;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui.OptionPanels;
using ICSharpCode.SharpDevelop.Project;
@@ -287,10 +286,7 @@ namespace CSharpBinding.OptionPanels
}
private void ChangeOutputPathExecute()
{
- OutputPath.Value = OptionsHelper.BrowseForFolder("${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}",
- base.BaseDirectory,
- outputPathTextBox.Text,TextBoxEditMode.EditRawProperty);
- base.RaisePropertyChanged(()=> OutputPath);
+ BrowseForFolder(OutputPath, "${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}");
}
#endregion
@@ -357,10 +353,7 @@ namespace CSharpBinding.OptionPanels
private void BaseIntermediateOutputPathExecute ()
{
- BaseIntermediateOutputPath.Value = OptionsHelper.BrowseForFolder("${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}",
- base.BaseDirectory,
- this.baseIntermediateOutputPathTextBox.Text,TextBoxEditMode.EditRawProperty);
- base.RaisePropertyChanged(()=> BaseIntermediateOutputPath);
+ BrowseForFolder(BaseIntermediateOutputPath, "${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}");
}
#endregion
@@ -376,10 +369,7 @@ namespace CSharpBinding.OptionPanels
private void IntermediateOutputPathExecute ()
{
- IntermediateOutputPath.Value = OptionsHelper.BrowseForFolder("${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}",
- base.BaseDirectory,
- this.intermediateOutputPathTextBox.Text,TextBoxEditMode.EditRawProperty);
- base.RaisePropertyChanged(()=> IntermediateOutputPath);
+ BrowseForFolder(IntermediateOutputPath, "${res:Dialog.Options.PrjOptions.Configuration.FolderBrowserDescription}");
}
#endregion
diff --git a/src/AddIns/BackendBindings/CppBinding/CppBinding/Project/ApplicationOptions.cs b/src/AddIns/BackendBindings/CppBinding/CppBinding/Project/ApplicationOptions.cs
index fd188c4bfd..61bfa61ff4 100644
--- a/src/AddIns/BackendBindings/CppBinding/CppBinding/Project/ApplicationOptions.cs
+++ b/src/AddIns/BackendBindings/CppBinding/CppBinding/Project/ApplicationOptions.cs
@@ -346,11 +346,7 @@ namespace ICSharpCode.CppBinding.Project
void ApplicationIconButton_Click(object sender, RoutedEventArgs e)
{
- string fileName = OptionsHelper.OpenFile(iconsfilter,base.BaseDirectory,this.applicationIconTextBox.Text,TextBoxEditMode.EditRawProperty);
- if (!String.IsNullOrEmpty(fileName))
- {
- this.applicationIconTextBox.Text = fileName;
- }
+ BrowseForFile(ApplicationIcon, iconsfilter);
}
@@ -407,12 +403,7 @@ namespace ICSharpCode.CppBinding.Project
void BrowseForManifest()
{
- applicationManifestComboBox.SelectedIndex = -1;
- var fileName = OptionsHelper.OpenFile(manifestFilter,base.BaseDirectory,ApplicationManifest.Value,TextBoxEditMode.EditRawProperty);
- if (!String.IsNullOrEmpty(fileName)) {
- this.applicationManifestComboBox.Items.Insert(0,fileName);
- this.applicationManifestComboBox.SelectedIndex = 0;
- }
+ BrowseForFile(ApplicationManifest, manifestFilter);
}
void CreateManifest()
diff --git a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonOptionsPanel.xaml.cs b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonOptionsPanel.xaml.cs
index c88c099401..a1743009f1 100644
--- a/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonOptionsPanel.xaml.cs
+++ b/src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonOptionsPanel.xaml.cs
@@ -9,6 +9,7 @@ using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Gui.OptionPanels;
using ICSharpCode.SharpDevelop.Project;
using ICSharpCode.SharpDevelop.Widgets;
+using Microsoft.Win32;
using SDCore = ICSharpCode.Core;
namespace ICSharpCode.PythonBinding
@@ -45,10 +46,12 @@ namespace ICSharpCode.PythonBinding
void Browse()
{
- string str = OptionsHelper.OpenFile ("${res:SharpDevelop.FileFilter.ExecutableFiles}|*.exe","",PythonFileName,TextBoxEditMode.EditRawProperty);
- if (String.IsNullOrEmpty(str))
- return;
- PythonFileName = str;
+ OpenFileDialog dlg = new OpenFileDialog();
+ dlg.DefaultExt = "exe";
+ dlg.Filter = Core.StringParser.Parse("${res:SharpDevelop.FileFilter.ExecutableFiles}|*.exe");
+ if (dlg.ShowDialog() == true) {
+ PythonFileName = dlg.FileName;
+ }
}
public override bool SaveOptions()
diff --git a/src/AddIns/BackendBindings/VBNetBinding/Project/Src/OptionPanels/BuildOptionsXaml.xaml b/src/AddIns/BackendBindings/VBNetBinding/Project/Src/OptionPanels/BuildOptionsXaml.xaml
index a328e00ba8..97dcde87f6 100644
--- a/src/AddIns/BackendBindings/VBNetBinding/Project/Src/OptionPanels/BuildOptionsXaml.xaml
+++ b/src/AddIns/BackendBindings/VBNetBinding/Project/Src/OptionPanels/BuildOptionsXaml.xaml
@@ -9,7 +9,6 @@
xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets">
-
@@ -44,14 +43,14 @@
+ IsChecked="{Binding Optimize.Value}">
+ IsChecked="{Binding RemoveIntegerChecks.Value}">
diff --git a/src/AddIns/BackendBindings/VBNetBinding/Project/Src/OptionPanels/BuildOptionsXaml.xaml.cs b/src/AddIns/BackendBindings/VBNetBinding/Project/Src/OptionPanels/BuildOptionsXaml.xaml.cs
index 9a5b506593..c4c0932e3e 100644
--- a/src/AddIns/BackendBindings/VBNetBinding/Project/Src/OptionPanels/BuildOptionsXaml.xaml.cs
+++ b/src/AddIns/BackendBindings/VBNetBinding/Project/Src/OptionPanels/BuildOptionsXaml.xaml.cs
@@ -25,7 +25,7 @@ namespace ICSharpCode.VBNetBinding.OptionPanels
///
/// Interaction logic for BuildOptionsXaml.xaml
///
- public partial class BuildOptionsXaml : ProjectOptionPanel
+ public partial class BuildOptionsXaml : ProjectOptionPanel
{
public BuildOptionsXaml()
{
@@ -43,21 +43,21 @@ namespace ICSharpCode.VBNetBinding.OptionPanels
OptionCompareItems = new List();
OptionCompareItems.Add(new StringPair("Binary", "Compare Binary"));
- OptionCompareItems.Add(new StringPair("Text", "Compare Text"));
- OptionCompareItem = OptionCompareItems[0];
-
- OptionInferItems = new List();
+ OptionCompareItems.Add(new StringPair("Text", "Compare Text"));
+ OptionCompareItem = OptionCompareItems[0];
+
+ OptionInferItems = new List();
OptionInferItems.Add(new StringPair("Off", "Infer Off"));
- OptionInferItems.Add(new StringPair("On", "Infer On"));
- OptionInferItem = OptionInferItems[0];
+ OptionInferItems.Add(new StringPair("On", "Infer On"));
+ OptionInferItem = OptionInferItems[0];
}
public ProjectProperty DefineConstants {
get { return GetProperty("DefineConstants", "", TextBoxEditMode.EditRawProperty); }
}
- public ProjectProperty Optimize {
- get { return GetProperty("Optimize", "", TextBoxEditMode.EditRawProperty); }
+ public ProjectProperty Optimize {
+ get { return GetProperty("Optimize", false, PropertyStorageLocations.ConfigurationSpecific); }
}
public ProjectProperty RemoveIntegerChecks {
@@ -68,93 +68,93 @@ namespace ICSharpCode.VBNetBinding.OptionPanels
get { return GetProperty("OptionExplicit", "", TextBoxEditMode.EditRawProperty); }
}
- public ProjectProperty OptionStrict {
+ public ProjectProperty OptionStrict {
get { return GetProperty("OptionStrict", "", TextBoxEditMode.EditRawProperty); }
}
- public ProjectProperty OptionCompare {
+ public ProjectProperty OptionCompare {
get { return GetProperty("OptionCompare", "", TextBoxEditMode.EditRawProperty); }
}
- public ProjectProperty OptionInfer {
+ public ProjectProperty OptionInfer {
get { return GetProperty("OptionInfer", "", TextBoxEditMode.EditRawProperty); }
}
#region OptionItems
- List optionExplicitItems;
-
- public List OptionExplicitItems {
- get { return optionExplicitItems; }
- set { optionExplicitItems = value;
- base.RaisePropertyChanged(() => OptionExplicitItems);
- }
+ List optionExplicitItems;
+
+ public List OptionExplicitItems {
+ get { return optionExplicitItems; }
+ set { optionExplicitItems = value;
+ base.RaisePropertyChanged(() => OptionExplicitItems);
}
-
- private StringPair optionExplicitItem;
-
- public KeyValuePair OptionExplicitItem {
- get { return optionExplicitItem; }
- set { optionExplicitItem = value;
- base.RaisePropertyChanged(() => OptionExplicitItem);
- }
+ }
+
+ private StringPair optionExplicitItem;
+
+ public KeyValuePair OptionExplicitItem {
+ get { return optionExplicitItem; }
+ set { optionExplicitItem = value;
+ base.RaisePropertyChanged(() => OptionExplicitItem);
}
-
-
- List optionStrictItems;
-
- public List> OptionStrictItems {
- get { return optionStrictItems; }
- set { optionStrictItems = value;
- base.RaisePropertyChanged(() => OptionStrictItems);
- }
+ }
+
+
+ List optionStrictItems;
+
+ public List> OptionStrictItems {
+ get { return optionStrictItems; }
+ set { optionStrictItems = value;
+ base.RaisePropertyChanged(() => OptionStrictItems);
}
-
- private StringPair optionStrictItem;
-
- public KeyValuePair OptionStrictItem {
- get { return optionStrictItem; }
- set { optionStrictItem = value;
- base.RaisePropertyChanged(() => OptionStrictItem);
- }
+ }
+
+ private StringPair optionStrictItem;
+
+ public KeyValuePair OptionStrictItem {
+ get { return optionStrictItem; }
+ set { optionStrictItem = value;
+ base.RaisePropertyChanged(() => OptionStrictItem);
}
-
- private List optionCompareItems;
-
- public List> OptionCompareItems {
- get { return optionCompareItems; }
- set { optionCompareItems = value;
- base.RaisePropertyChanged(() => OptionCompareItems);
- }
+ }
+
+ private List optionCompareItems;
+
+ public List> OptionCompareItems {
+ get { return optionCompareItems; }
+ set { optionCompareItems = value;
+ base.RaisePropertyChanged(() => OptionCompareItems);
}
-
- private StringPair optionCompareItem;
-
- public KeyValuePair OptionCompareItem {
- get { return optionCompareItem; }
- set { optionCompareItem = value;
- base.RaisePropertyChanged(() => OptionCompareItem);
- }
+ }
+
+ private StringPair optionCompareItem;
+
+ public KeyValuePair OptionCompareItem {
+ get { return optionCompareItem; }
+ set { optionCompareItem = value;
+ base.RaisePropertyChanged(() => OptionCompareItem);
}
-
- List optionInferItems;
-
- public List> OptionInferItems {
- get { return optionInferItems; }
- set { optionInferItems = value;
- base.RaisePropertyChanged(()=>OptionInferItems);
- }
+ }
+
+ List optionInferItems;
+
+ public List> OptionInferItems {
+ get { return optionInferItems; }
+ set { optionInferItems = value;
+ base.RaisePropertyChanged(()=>OptionInferItems);
}
-
-
+ }
+
+
private StringPair optionInferItem;
-
- public KeyValuePair OptionInferItem {
- get { return optionInferItem; }
- set { optionInferItem = value;
- base.RaisePropertyChanged(() => OptionInferItem);
- }
+
+ public KeyValuePair OptionInferItem {
+ get { return optionInferItem; }
+ set { optionInferItem = value;
+ base.RaisePropertyChanged(() => OptionInferItem);
}
+ }
#endregion
}
}
\ No newline at end of file
diff --git a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
index 90209ac6f0..44a9dc7e47 100644
--- a/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
+++ b/src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
@@ -281,7 +281,6 @@
-
ReferencePaths.xaml
@@ -329,8 +328,8 @@
-
- ServiceReferenceOptionsPanel..xaml
+
+ ServiceReferenceOptionsPanel.xaml
Code
@@ -920,7 +919,7 @@
-
+
diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ApplicationSettings.xaml b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ApplicationSettings.xaml
index 8ea694e964..2fc812be35 100644
--- a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ApplicationSettings.xaml
+++ b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ApplicationSettings.xaml
@@ -119,8 +119,6 @@
diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ApplicationSettings.xaml.cs b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ApplicationSettings.xaml.cs
index 5311b53d79..dc4df00af8 100644
--- a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ApplicationSettings.xaml.cs
+++ b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ApplicationSettings.xaml.cs
@@ -35,15 +35,14 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
this.DataContext = this;
}
-
- private void Initialize()
+ protected override void Initialize()
{
+ base.Initialize();
+
startupObjectComboBox.Items.Clear();
foreach (IClass c in GetPossibleStartupObjects(base.Project)) {
startupObjectComboBox.Items.Add(c.FullyQualifiedName);
}
-
- this.outputTypeComboBox.SelectedValue = OutputType.Value.ToString();
FillManifestCombo();
@@ -61,16 +60,22 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
RefreshOutputNameTextBox(this, null);
ApplicationIconTextBox_TextChanged(this,null);
- this.startupObjectComboBox.SelectionChanged += (s,e) => {IsDirty = true;};
- this.outputTypeComboBox.SelectionChanged += OutputTypeComboBox_SelectionChanged;
+ //this.startupObjectComboBox.SelectionChanged += (s,e) => {IsDirty = true;};
+ this.outputTypeComboBox.SelectionChanged += RefreshOutputNameTextBox;
+ this.outputTypeComboBox.SelectionChanged += RefreshStartupObjectEnabled;
}
+ public override void Dispose()
+ {
+ base.Project.MinimumSolutionVersionChanged -= project_MinimumSolutionVersionChanged;
+ base.Dispose();
+ }
- private List itemsSource;
+ private List manifestItems;
public List ManifestItems {
- get { return itemsSource; }
- set { itemsSource = value;
+ get { return manifestItems; }
+ set { manifestItems = value;
base.RaisePropertyChanged(() => ManifestItems);
}
}
@@ -78,24 +83,15 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
void FillManifestCombo()
{
- itemsSource = new List();
- itemsSource.Add(StringParser.Parse("${res:Dialog.ProjectOptions.ApplicationSettings.Manifest.EmbedDefault}"));
- itemsSource.Add(StringParser.Parse("${res:Dialog.ProjectOptions.ApplicationSettings.Manifest.DoNotEmbedManifest}"));
+ manifestItems = new List();
+ manifestItems.Add(StringParser.Parse("${res:Dialog.ProjectOptions.ApplicationSettings.Manifest.EmbedDefault}"));
+ manifestItems.Add(StringParser.Parse("${res:Dialog.ProjectOptions.ApplicationSettings.Manifest.DoNotEmbedManifest}"));
foreach (string fileName in Directory.GetFiles(base.BaseDirectory, "*.manifest")) {
- itemsSource.Add(Path.GetFileName(fileName));
+ manifestItems.Add(Path.GetFileName(fileName));
}
- 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;
+ manifestItems.Add(StringParser.Parse("<${res:Global.CreateButtonText}...>"));
+ manifestItems.Add(StringParser.Parse("<${res:Global.BrowseText}...>"));
+ ManifestItems = manifestItems;
}
@@ -110,13 +106,12 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
public ProjectProperty OutputType {
- get {
- return GetProperty("OutputType", ICSharpCode.SharpDevelop.Project.OutputType.Exe); }
+ get { return GetProperty("OutputType", ICSharpCode.SharpDevelop.Project.OutputType.Exe); }
}
public ProjectProperty StartupObject {
- get {return GetProperty("StartupObject", "", TextBoxEditMode.EditRawProperty); }
+ get { return GetProperty("StartupObject", "", TextBoxEditMode.EditRawProperty); }
}
@@ -126,14 +121,12 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
public ProjectProperty ApplicationManifest {
- get {
- return GetProperty("ApplicationManifest", "", TextBoxEditMode.EditRawProperty); }
+ get { return GetProperty("ApplicationManifest", "", TextBoxEditMode.EditRawProperty); }
}
public ProjectProperty NoWin32Manifest {
- get {
- return GetProperty("NoWin32Manifest",false); }
+ get { return GetProperty("NoWin32Manifest", false); }
}
@@ -148,7 +141,6 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
protected override void Load(MSBuildBasedProject project, string configuration, string platform)
{
base.Load(project, configuration, platform);
- Initialize();
if (string.IsNullOrEmpty(this.ApplicationManifest.Value)) {
if (this.NoWin32Manifest.Value) {
applicationManifestComboBox.SelectedIndex = 1;
@@ -208,51 +200,33 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
// 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)
+ void RefreshOutputNameTextBox (object sender, EventArgs e)
{
if (this.outputTypeComboBox.SelectedValue != null) {
- var enmType = (OutputType) Enum.Parse(typeof(OutputType),this.outputTypeComboBox.SelectedValue.ToString());
- this.outputNameTextBox.Text = this.assemblyNameTextBox.Text + CompilableProject.GetExtension(enmType);
+ var outputType = (OutputType)this.outputTypeComboBox.SelectedValue;
+ this.outputNameTextBox.Text = this.assemblyNameTextBox.Text + CompilableProject.GetExtension(outputType);
}
}
-
void RefreshStartupObjectEnabled(object sender, EventArgs e)
{
if (this.outputTypeComboBox.SelectedValue != null) {
- var enmType = (OutputType) Enum.Parse(typeof(OutputType),this.outputTypeComboBox.SelectedValue.ToString());
- bool isLibrary = ICSharpCode.SharpDevelop.Project.OutputType.Library == enmType;
- startupObjectComboBox.IsEnabled = !isLibrary;
+ var outputType = (OutputType)this.outputTypeComboBox.SelectedValue;
+ startupObjectComboBox.IsEnabled = outputType != SharpDevelop.Project.OutputType.Library;
}
}
-
-
- void OutputTypeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
- {
- RefreshOutputNameTextBox(this,null);
- RefreshStartupObjectEnabled(this,null);
- IsDirty = true;
- }
-
-
#endregion
-
+
#region ApplicationIcon
void ApplicationIconButton_Click(object sender, RoutedEventArgs e)
{
- string fileName = OptionsHelper.OpenFile(iconsfilter,base.BaseDirectory,
- ApplicationIcon.Value,TextBoxEditMode.EditRawProperty);
- if (!String.IsNullOrEmpty(fileName))
- {
- this.applicationIconTextBox.Text = fileName;
- }
+ BrowseForFile(ApplicationIcon, iconsfilter);
}
-
void ApplicationIconTextBox_TextChanged(object sender, TextChangedEventArgs e)
{
@@ -262,24 +236,21 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
string appIconPath = Path.Combine(base.BaseDirectory, this.applicationIconTextBox.Text);
if (File.Exists(appIconPath)) {
try {
- MemoryStream memoryStream = new MemoryStream();
+ 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;
+ stream.CopyTo(memoryStream);
}
+ memoryStream.Position = 0;
+
+ 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;
} catch (OutOfMemoryException) {
Image = null;
@@ -300,69 +271,19 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
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;
- MessageService.ShowErrorFormatted("${res:Dialog.ProjectOptions.ApplicationSettings.InvalidIconFile}",
- FileUtility.NormalizePath(appIconPath));
- }
- } else {
- this.applicationIconImage.Source = null;
- }
- }
- }
- }
- */
#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) {
- BrowseForManifest();
+ BrowseForFile(ApplicationManifest, manifestFilter);
}
}
-
- void BrowseForManifest()
- {
- var fileName = OptionsHelper.OpenFile(manifestFilter,base.BaseDirectory,
- ApplicationManifest.Value,TextBoxEditMode.EditRawProperty);
- if (!String.IsNullOrEmpty(fileName)) {
- applicationManifestComboBox.Text = fileName;
- }
- Console.WriteLine("aaa {0}",applicationManifestComboBox.Text);
- Console.WriteLine("bbb {0}",ApplicationManifest.Value);
- }
-
void CreateManifest()
{
string manifestFile = Path.Combine(base.BaseDirectory, "app.manifest");
@@ -386,7 +307,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
ProjectService.AddProjectItem(base.Project, newItem);
ProjectBrowserPad.RefreshViewAsync();
}
-
+
FileService.OpenFile(manifestFile);
// this.applicationManifestComboBox.Items.Insert(0,"app.manifest");
@@ -400,20 +321,9 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
void Win32ResourceComboButton_Click(object sender, RoutedEventArgs e)
{
- string fileName = OptionsHelper.OpenFile(win32filter,base.BaseDirectory,
- Win32Resource.Value,TextBoxEditMode.EditRawProperty);
- if (!String.IsNullOrEmpty(fileName))
- {
- this.win32ResourceFileTextBox.Text = fileName;
- }
- }
-
- void ApplicationManifestComboBox_LostFocus(object sender, RoutedEventArgs e)
- {
- Console.WriteLine("ComboBox_LostFocus {0}",applicationManifestComboBox.Text);
+ BrowseForFile(Win32Resource, win32filter);
}
-
- #endregion
+ #endregion
}
}
diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/DebugOptions.xaml b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/DebugOptions.xaml
index 1c599af762..020013e223 100644
--- a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/DebugOptions.xaml
+++ b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/DebugOptions.xaml
@@ -127,7 +127,7 @@
Text="{Binding StartWorkingDirectory.Value, UpdateSourceTrigger=PropertyChanged}">
diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/DebugOptions.xaml.cs b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/DebugOptions.xaml.cs
index 40f192650a..d1f4e75a86 100644
--- a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/DebugOptions.xaml.cs
+++ b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/DebugOptions.xaml.cs
@@ -42,18 +42,18 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
get { return GetProperty("StartProgram", "", TextBoxEditMode.EditRawProperty, PropertyStorageLocations.ConfigurationSpecific);}
}
-
+
public ProjectProperty StartURL
{
get{ return GetProperty("StartURL", "", TextBoxEditMode.EditRawProperty, PropertyStorageLocations.ConfigurationSpecific);}
}
-
+
public ProjectProperty StartArguments
{
get{ return GetProperty("StartArguments", "", TextBoxEditMode.EditRawProperty, PropertyStorageLocations.ConfigurationSpecific);}
}
-
+
public ProjectProperty StartWorkingDirectory
{
@@ -63,21 +63,12 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
void ExternalProgramButton_Click(object sender, System.Windows.RoutedEventArgs e)
{
string fileFilter = "${res:SharpDevelop.FileFilter.ExecutableFiles}|*.exe;*.com;*.pif;*.bat;*.cmd";
- this.StartProgram.Value = this.FileDialog(fileFilter);
- }
-
-
- void BrwoseForFolder_Click(object sender, System.Windows.RoutedEventArgs e)
- {
- StartWorkingDirectory.Value = OptionsHelper.BrowseForFolder("${res:Dialog.ProjectOptions.SelectFolderTitle}",
- base.BaseDirectory,String.Empty,TextBoxEditMode.EditRawProperty);
+ BrowseForFile(this.StartProgram, fileFilter);
}
-
- private string FileDialog (string filter)
+ void BrowseForFolder_Click(object sender, System.Windows.RoutedEventArgs e)
{
- return OptionsHelper.OpenFile(filter,base.BaseDirectory,
- StartProgram.Value,TextBoxEditMode.EditRawProperty);
+ BrowseForFolder(StartWorkingDirectory, "${res:Dialog.ProjectOptions.SelectFolderTitle}");
}
}
}
\ No newline at end of file
diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/KeyValuePair.cs b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/KeyValuePair.cs
index 301d4ebfa5..2a7c789025 100644
--- a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/KeyValuePair.cs
+++ b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/KeyValuePair.cs
@@ -7,7 +7,7 @@
*/
using System;
-namespace Gui.Dialogs.OptionPanels.ProjectOptions
+namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
{
///
/// Description of KeyValuePair.
diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/OptionsHelper.cs b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/OptionsHelper.cs
deleted file mode 100644
index aa7ff6c610..0000000000
--- a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/OptionsHelper.cs
+++ /dev/null
@@ -1,87 +0,0 @@
-// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
-// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
-
-
-using System;
-using ICSharpCode.Core;
-using ICSharpCode.SharpDevelop.Project;
-using Microsoft.Win32;
-
-namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
-{
- ///
- /// Description of OptionsHelper.
- ///
- public class OptionsHelper
- {
-
-
- public static string BrowseForFolder(string description,string startLocation,
- string relativeLocation,
- TextBoxEditMode textBoxEditMode)
- {
-
- string startAt = CreateStartPath(startLocation, relativeLocation);
-
- using (System.Windows.Forms.FolderBrowserDialog fdiag = FileService.CreateFolderBrowserDialog(description,startAt))
- {
- if (fdiag.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
- string path = fdiag.SelectedPath;
- if (!String.IsNullOrEmpty(startLocation)) {
- path = FileUtility.GetRelativePath(startLocation, path);
- }
- if (!path.EndsWith("\\") && !path.EndsWith("/"))
- path += "\\";
- if (textBoxEditMode == TextBoxEditMode.EditEvaluatedProperty) {
- return path;
- } else {
- return MSBuildInternals.Escape(path);
- }
- }
- }
- return startLocation;
- }
-
-
- ///
- /// Open File
- ///
- ///
- ///
- public static string OpenFile (string filter,string startLocation,string relativeLocation, TextBoxEditMode textBoxEditMode)
- {
-
- string startAt = CreateStartPath(startLocation, relativeLocation);
- var dialog = new OpenFileDialog();
- dialog.InitialDirectory = startAt;
-
- if (!String.IsNullOrEmpty(filter)) {
- dialog.Filter = StringParser.Parse(filter);
- }
-
- if (dialog.ShowDialog() ?? false) {
- string fileName = dialog.FileName;
-
- if (!String.IsNullOrEmpty(startLocation)) {
- fileName = FileUtility.GetRelativePath(startLocation, fileName);
- }
- if (textBoxEditMode == TextBoxEditMode.EditEvaluatedProperty) {
- return fileName;
- } else {
- return MSBuildInternals.Escape(fileName);
- }
- }
- 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;
- }
- }
-}
diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ProjectOptionPanel.cs b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ProjectOptionPanel.cs
index 0d5227aae8..8637011a90 100644
--- a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ProjectOptionPanel.cs
+++ b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ProjectOptionPanel.cs
@@ -13,20 +13,14 @@ using System.Windows.Shapes;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Project;
-
-//using System.Windows.Forms;
-
-
-
-
-
+using Microsoft.Win32;
namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
{
///
/// Base class for project option panels with configuration picker.
///
- public class ProjectOptionPanel : UserControl, IOptionPanel, ICanBeDirty,INotifyPropertyChanged
+ public class ProjectOptionPanel : UserControl, IOptionPanel, ICanBeDirty, INotifyPropertyChanged, IDisposable
{
static ProjectOptionPanel()
@@ -39,6 +33,19 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
this.DataContext = this;
}
+ ///
+ /// Initializes the project option panel.
+ /// This method is called after the project property was initialized,
+ /// immediately before the first Load() call.
+ ///
+ protected virtual void Initialize()
+ {
+ }
+
+ public virtual void Dispose()
+ {
+ }
+
ComboBox configurationComboBox;
ComboBox platformComboBox;
MSBuildBasedProject project;
@@ -115,6 +122,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
platformComboBox.SelectedItem = project.ActivePlatform;
platformComboBox.SelectionChanged += comboBox_SelectionChanged;
}
+ Initialize();
Load();
}
@@ -252,6 +260,10 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
this.location = defaultLocation;
}
+ public TextBoxEditMode TextBoxEditMode {
+ get { return treatPropertyValueAsLiteral ? TextBoxEditMode.EditEvaluatedProperty : TextBoxEditMode.EditRawProperty; }
+ }
+
public string PropertyName {
get { return propertyName; }
}
@@ -369,6 +381,102 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
#endregion
-
+ #region Browse Helper
+ ///
+ /// Shows the 'Browse for folder' dialog.
+ ///
+ protected void BrowseForFolder(ProjectProperty property, string description)
+ {
+ string newValue = BrowseForFile(description, property.Value, property.TextBoxEditMode);
+ if (newValue != null)
+ property.Value = newValue;
+ }
+
+ ///
+ /// Shows the 'Browse for folder' dialog.
+ ///
+ /// A description shown inside the dialog.
+ /// Start location, relative to the
+ /// The TextBoxEditMode used for the text box containing the file name
+ /// Returns the location of the folder; or null if the dialog was cancelled.
+ protected string BrowseForFolder(string description, string startLocation, TextBoxEditMode textBoxEditMode)
+ {
+ string startAt = GetInitialDirectory(startLocation, textBoxEditMode);
+ using (var fdiag = FileService.CreateFolderBrowserDialog(description, startAt))
+ {
+ if (fdiag.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
+ string path = fdiag.SelectedPath;
+ if (!String.IsNullOrEmpty(startLocation)) {
+ path = FileUtility.GetRelativePath(startLocation, path);
+ }
+ if (!path.EndsWith("\\", StringComparison.Ordinal) && !path.EndsWith("/", StringComparison.Ordinal))
+ path += "\\";
+ if (textBoxEditMode == TextBoxEditMode.EditEvaluatedProperty) {
+ return path;
+ } else {
+ return MSBuildInternals.Escape(path);
+ }
+ }
+ }
+ return null;
+ }
+
+ ///
+ /// Shows an 'Open File' dialog.
+ ///
+ protected void BrowseForFile(ProjectProperty property, string filter)
+ {
+ string newValue = BrowseForFile(filter, property.Value, property.TextBoxEditMode);
+ if (newValue != null)
+ property.Value = newValue;
+ }
+
+ ///
+ /// Shows an 'Open File' dialog.
+ ///
+ /// The filter string that determines which files are displayed.
+ /// Start location, relative to the
+ /// The TextBoxEditMode used for the text box containing the file name
+ /// Returns the location of the file; or null if the dialog was cancelled.
+ protected string BrowseForFile(string filter, string startLocation, TextBoxEditMode textBoxEditMode)
+ {
+ var dialog = new OpenFileDialog();
+ dialog.InitialDirectory = GetInitialDirectory(startLocation, textBoxEditMode);
+
+ if (!String.IsNullOrEmpty(filter)) {
+ dialog.Filter = StringParser.Parse(filter);
+ }
+
+ if (dialog.ShowDialog() == true) {
+ string fileName = dialog.FileName;
+ if (!String.IsNullOrEmpty(this.BaseDirectory)) {
+ fileName = FileUtility.GetRelativePath(this.BaseDirectory, fileName);
+ }
+ if (textBoxEditMode == TextBoxEditMode.EditEvaluatedProperty) {
+ return fileName;
+ } else {
+ return MSBuildInternals.Escape(fileName);
+ }
+ }
+ return null;
+ }
+
+ string GetInitialDirectory(string relativeLocation, TextBoxEditMode textBoxEditMode)
+ {
+ if (textBoxEditMode == TextBoxEditMode.EditRawProperty)
+ relativeLocation = MSBuildInternals.Unescape(relativeLocation);
+ if (string.IsNullOrEmpty(relativeLocation))
+ return this.BaseDirectory;
+
+ try {
+ string path = FileUtility.GetAbsolutePath(this.BaseDirectory, relativeLocation);
+ if (FileUtility.IsValidPath(path))
+ return path;
+ } catch (ArgumentException) {
+ // can happen in GetAbsolutePath if the path contains invalid characters
+ }
+ return string.Empty;
+ }
+ #endregion
}
}
diff --git a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/Signing.xaml b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/Signing.xaml
index 05c931dbc7..d93fd4e317 100644
--- a/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/Signing.xaml
+++ b/src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/Signing.xaml
@@ -7,11 +7,6 @@
xmlns:local="clr-namespace:ICSharpCode.SharpDevelop.Gui.OptionPanels"
xmlns:core="http://icsharpcode.net/sharpdevelop/core">
-
-
-
-
-
@@ -66,7 +61,7 @@
+ IsChecked="{Binding DelaySign.Value}">