Browse Source

Merge branch 'xmlForms' of github.com:icsharpcode/SharpDevelop into xmlForms

pull/30/head
PeterForstmeier 13 years ago
parent
commit
9119ef39e4
  1. 9
      src/AddIns/Analysis/CodeAnalysis/Src/AnalysisIdeOptionsPanel.xaml.cs
  2. 1
      src/AddIns/Analysis/CodeAnalysis/Src/AnalysisProjectOptionsPanelXaml.xaml.cs
  3. 11
      src/AddIns/Analysis/SourceAnalysis/Src/AnalysisIdeOptionsPanel.xaml.cs
  4. 5
      src/AddIns/Analysis/SourceAnalysis/Src/AnalysisOptionsPanel.xaml.cs
  5. 16
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/BuildOptions.xaml.cs
  6. 13
      src/AddIns/BackendBindings/CppBinding/CppBinding/Project/ApplicationOptions.cs
  7. 11
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonOptionsPanel.xaml.cs
  8. 5
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/OptionPanels/BuildOptionsXaml.xaml
  9. 152
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/OptionPanels/BuildOptionsXaml.xaml.cs
  10. 7
      src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
  11. 2
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ApplicationSettings.xaml
  12. 188
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ApplicationSettings.xaml.cs
  13. 2
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/DebugOptions.xaml
  14. 21
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/DebugOptions.xaml.cs
  15. 2
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/KeyValuePair.cs
  16. 87
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/OptionsHelper.cs
  17. 126
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/ProjectOptionPanel.cs
  18. 7
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/Signing.xaml
  19. 84
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/Signing.xaml.cs
  20. 0
      src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/ServiceReference/ServiceReferenceOptionsPanel.xaml
  21. 6
      src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/ServiceReference/ServiceReferenceOptionsPanel.xaml.cs

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

@ -11,6 +11,7 @@ using ICSharpCode.Core; @@ -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 @@ -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 {

1
src/AddIns/Analysis/CodeAnalysis/Src/AnalysisProjectOptionsPanelXaml.xaml.cs

@ -21,7 +21,6 @@ using System.Windows.Documents; @@ -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;

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

@ -21,6 +21,7 @@ using ICSharpCode.Core; @@ -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 @@ -50,7 +51,7 @@ namespace ICSharpCode.SourceAnalysis
EnableModifyStyleCopSettings = true;
}
}
public bool EnableModifyStyleCopSettings {
get { return enableModifyStyleCopSettings; }
@ -62,9 +63,11 @@ namespace ICSharpCode.SourceAnalysis @@ -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 {

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

@ -50,10 +50,7 @@ namespace ICSharpCode.SourceAnalysis @@ -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, "");
}

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

@ -11,7 +11,6 @@ using System.Diagnostics; @@ -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 @@ -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 @@ -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 @@ -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

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

@ -346,11 +346,7 @@ namespace ICSharpCode.CppBinding.Project @@ -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 @@ -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()

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

@ -9,6 +9,7 @@ using ICSharpCode.SharpDevelop.Gui; @@ -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 @@ -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()

5
src/AddIns/BackendBindings/VBNetBinding/Project/Src/OptionPanels/BuildOptionsXaml.xaml

@ -9,7 +9,6 @@ @@ -9,7 +9,6 @@
xmlns:widgets="http://icsharpcode.net/sharpdevelop/widgets">
<optionpanels:ProjectOptionPanel.Resources>
<optionpanels:StringToBoolConverter x:Key="strToBool"></optionpanels:StringToBoolConverter>
<optionpanels:StorageLocationConverter x:Key="locationConverter" />
</optionpanels:ProjectOptionPanel.Resources>
@ -44,14 +43,14 @@ @@ -44,14 +43,14 @@
<CheckBox x:Name="optimizeCodeCheckBox"
Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" VerticalAlignment="Center"
Content="{core:Localize Dialog.ProjectOptions.BuildOptions.OptimizeCode}"
IsChecked="{Binding Optimize.Value,Converter={StaticResource strToBool}}">
IsChecked="{Binding Optimize.Value}">
</CheckBox>
<optionpanels:StorageLocationPicker Grid.Row="3" Location="{Binding RemoveIntegerChecks.Location}" />
<CheckBox x:Name="removeOverflowCheckBox"
Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2" VerticalAlignment="Center"
Content="{core:Localize Dialog.ProjectOptions.BuildOptions.RemoveOverflowChecks}"
IsChecked="{Binding RemoveIntegerChecks.Value,Converter={StaticResource strToBool}}">
IsChecked="{Binding RemoveIntegerChecks.Value}">
</CheckBox>
<optionpanels:StorageLocationPicker Grid.Row="5" VerticalAlignment="Center" >

152
src/AddIns/BackendBindings/VBNetBinding/Project/Src/OptionPanels/BuildOptionsXaml.xaml.cs

@ -25,7 +25,7 @@ namespace ICSharpCode.VBNetBinding.OptionPanels @@ -25,7 +25,7 @@ namespace ICSharpCode.VBNetBinding.OptionPanels
/// <summary>
/// Interaction logic for BuildOptionsXaml.xaml
/// </summary>
public partial class BuildOptionsXaml : ProjectOptionPanel
public partial class BuildOptionsXaml : ProjectOptionPanel
{
public BuildOptionsXaml()
{
@ -43,21 +43,21 @@ namespace ICSharpCode.VBNetBinding.OptionPanels @@ -43,21 +43,21 @@ namespace ICSharpCode.VBNetBinding.OptionPanels
OptionCompareItems = new List<StringPair>();
OptionCompareItems.Add(new StringPair("Binary", "Compare Binary"));
OptionCompareItems.Add(new StringPair("Text", "Compare Text"));
OptionCompareItem = OptionCompareItems[0];
OptionInferItems = new List<StringPair>();
OptionCompareItems.Add(new StringPair("Text", "Compare Text"));
OptionCompareItem = OptionCompareItems[0];
OptionInferItems = new List<StringPair>();
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<string> DefineConstants {
get { return GetProperty("DefineConstants", "", TextBoxEditMode.EditRawProperty); }
}
public ProjectProperty<string> Optimize {
get { return GetProperty("Optimize", "", TextBoxEditMode.EditRawProperty); }
public ProjectProperty<bool> Optimize {
get { return GetProperty("Optimize", false, PropertyStorageLocations.ConfigurationSpecific); }
}
public ProjectProperty<string> RemoveIntegerChecks {
@ -68,93 +68,93 @@ namespace ICSharpCode.VBNetBinding.OptionPanels @@ -68,93 +68,93 @@ namespace ICSharpCode.VBNetBinding.OptionPanels
get { return GetProperty("OptionExplicit", "", TextBoxEditMode.EditRawProperty); }
}
public ProjectProperty<string> OptionStrict {
public ProjectProperty<string> OptionStrict {
get { return GetProperty("OptionStrict", "", TextBoxEditMode.EditRawProperty); }
}
public ProjectProperty<string> OptionCompare {
public ProjectProperty<string> OptionCompare {
get { return GetProperty("OptionCompare", "", TextBoxEditMode.EditRawProperty); }
}
public ProjectProperty<string> OptionInfer {
public ProjectProperty<string> OptionInfer {
get { return GetProperty("OptionInfer", "", TextBoxEditMode.EditRawProperty); }
}
#region OptionItems
List<StringPair> optionExplicitItems;
public List<StringPair> OptionExplicitItems {
get { return optionExplicitItems; }
set { optionExplicitItems = value;
base.RaisePropertyChanged(() => OptionExplicitItems);
}
List<StringPair> optionExplicitItems;
public List<StringPair> OptionExplicitItems {
get { return optionExplicitItems; }
set { optionExplicitItems = value;
base.RaisePropertyChanged(() => OptionExplicitItems);
}
private StringPair optionExplicitItem;
public KeyValuePair<string, string> OptionExplicitItem {
get { return optionExplicitItem; }
set { optionExplicitItem = value;
base.RaisePropertyChanged(() => OptionExplicitItem);
}
}
private StringPair optionExplicitItem;
public KeyValuePair<string, string> OptionExplicitItem {
get { return optionExplicitItem; }
set { optionExplicitItem = value;
base.RaisePropertyChanged(() => OptionExplicitItem);
}
List<StringPair> optionStrictItems;
public List<KeyValuePair<string, string>> OptionStrictItems {
get { return optionStrictItems; }
set { optionStrictItems = value;
base.RaisePropertyChanged(() => OptionStrictItems);
}
}
List<StringPair> optionStrictItems;
public List<KeyValuePair<string, string>> OptionStrictItems {
get { return optionStrictItems; }
set { optionStrictItems = value;
base.RaisePropertyChanged(() => OptionStrictItems);
}
private StringPair optionStrictItem;
public KeyValuePair<string, string> OptionStrictItem {
get { return optionStrictItem; }
set { optionStrictItem = value;
base.RaisePropertyChanged(() => OptionStrictItem);
}
}
private StringPair optionStrictItem;
public KeyValuePair<string, string> OptionStrictItem {
get { return optionStrictItem; }
set { optionStrictItem = value;
base.RaisePropertyChanged(() => OptionStrictItem);
}
private List<StringPair> optionCompareItems;
public List<KeyValuePair<string, string>> OptionCompareItems {
get { return optionCompareItems; }
set { optionCompareItems = value;
base.RaisePropertyChanged(() => OptionCompareItems);
}
}
private List<StringPair> optionCompareItems;
public List<KeyValuePair<string, string>> OptionCompareItems {
get { return optionCompareItems; }
set { optionCompareItems = value;
base.RaisePropertyChanged(() => OptionCompareItems);
}
private StringPair optionCompareItem;
public KeyValuePair<string, string> OptionCompareItem {
get { return optionCompareItem; }
set { optionCompareItem = value;
base.RaisePropertyChanged(() => OptionCompareItem);
}
}
private StringPair optionCompareItem;
public KeyValuePair<string, string> OptionCompareItem {
get { return optionCompareItem; }
set { optionCompareItem = value;
base.RaisePropertyChanged(() => OptionCompareItem);
}
List<StringPair> optionInferItems;
public List<KeyValuePair<string, string>> OptionInferItems {
get { return optionInferItems; }
set { optionInferItems = value;
base.RaisePropertyChanged(()=>OptionInferItems);
}
}
List<StringPair> optionInferItems;
public List<KeyValuePair<string, string>> OptionInferItems {
get { return optionInferItems; }
set { optionInferItems = value;
base.RaisePropertyChanged(()=>OptionInferItems);
}
}
private StringPair optionInferItem;
public KeyValuePair<string, string> OptionInferItem {
get { return optionInferItem; }
set { optionInferItem = value;
base.RaisePropertyChanged(() => OptionInferItem);
}
public KeyValuePair<string, string> OptionInferItem {
get { return optionInferItem; }
set { optionInferItem = value;
base.RaisePropertyChanged(() => OptionInferItem);
}
}
#endregion
}
}

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

@ -281,7 +281,6 @@ @@ -281,7 +281,6 @@
</Compile>
<Compile Include="Src\Gui\Dialogs\OptionPanels\ProjectOptions\HexValidator.cs" />
<Compile Include="Src\Gui\Dialogs\OptionPanels\ProjectOptions\KeyValuePair.cs" />
<Compile Include="Src\Gui\Dialogs\OptionPanels\ProjectOptions\OptionsHelper.cs" />
<Compile Include="Src\Gui\Dialogs\OptionPanels\ProjectOptions\ProjectOptionPanel.cs" />
<Compile Include="Src\Gui\Dialogs\OptionPanels\ProjectOptions\ReferencePaths.xaml.cs">
<DependentUpon>ReferencePaths.xaml</DependentUpon>
@ -329,8 +328,8 @@ @@ -329,8 +328,8 @@
<Compile Include="Src\Gui\Dialogs\ReferenceDialog\ServiceReference\ServiceReferenceMapFileProjectItem.cs" />
<Compile Include="Src\Gui\Dialogs\ReferenceDialog\ServiceReference\ServiceReferenceMapGenerator.cs" />
<Compile Include="Src\Gui\Dialogs\ReferenceDialog\ServiceReference\ServiceReferenceOptions.cs" />
<Compile Include="Src\Gui\Dialogs\ReferenceDialog\ServiceReference\ServiceReferenceOptionsPanel..xaml.cs">
<DependentUpon>ServiceReferenceOptionsPanel..xaml</DependentUpon>
<Compile Include="Src\Gui\Dialogs\ReferenceDialog\ServiceReference\ServiceReferenceOptionsPanel.xaml.cs">
<DependentUpon>ServiceReferenceOptionsPanel.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Src\Gui\Dialogs\ReferenceDialog\ServiceReference\ServiceReferenceProxyGenerator.cs" />
@ -920,7 +919,7 @@ @@ -920,7 +919,7 @@
<Page Include="Src\Gui\Dialogs\OptionPanels\ProjectOptions\Signing.xaml" />
<Page Include="Src\Gui\Dialogs\ReferenceDialog\ServiceReference\AddServiceReferenceDialog.xaml" />
<Page Include="Src\Gui\Dialogs\ReferenceDialog\ServiceReference\AdvancedServiceDialog.xaml" />
<Page Include="Src\Gui\Dialogs\ReferenceDialog\ServiceReference\ServiceReferenceOptionsPanel..xaml" />
<Page Include="Src\Gui\Dialogs\ReferenceDialog\ServiceReference\ServiceReferenceOptionsPanel.xaml" />
<Page Include="Src\Project\PortableLibrary\SelectProfileDialog.xaml" />
<Page Include="Src\Services\RefactoringService\ContextActions\ContextActionsBulbControl.xaml" />
<Page Include="Src\Services\RefactoringService\ContextActions\ContextActionsControl.xaml" />

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

@ -119,8 +119,6 @@ @@ -119,8 +119,6 @@
<ComboBox x:Name="applicationManifestComboBox" VerticalAlignment="Center" Width="200"
IsEditable="True"
ItemsSource="{Binding ManifestItems}"
LostFocus="ApplicationManifestComboBox_LostFocus"
SelectionChanged="ApplicationManifestComboBox_SelectionChanged" >
</ComboBox>

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

@ -35,15 +35,14 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -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 @@ -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<String> itemsSource;
private List<String> manifestItems;
public List<string> 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 @@ -78,24 +83,15 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
void FillManifestCombo()
{
itemsSource = new List<string>();
itemsSource.Add(StringParser.Parse("${res:Dialog.ProjectOptions.ApplicationSettings.Manifest.EmbedDefault}"));
itemsSource.Add(StringParser.Parse("${res:Dialog.ProjectOptions.ApplicationSettings.Manifest.DoNotEmbedManifest}"));
manifestItems = new List<string>();
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 @@ -110,13 +106,12 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
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); }
get { return GetProperty("StartupObject", "", TextBoxEditMode.EditRawProperty); }
}
@ -126,14 +121,12 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -126,14 +121,12 @@ 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); }
get { return GetProperty("NoWin32Manifest", false); }
}
@ -148,7 +141,6 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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
}
}

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

@ -127,7 +127,7 @@ @@ -127,7 +127,7 @@
Text="{Binding StartWorkingDirectory.Value, UpdateSourceTrigger=PropertyChanged}"></TextBox>
<Button Grid.Row="1" Grid.Column="3" Margin="5" Padding="9,1" VerticalAlignment="Center"
Click="BrwoseForFolder_Click"
Click="BrowseForFolder_Click"
Content="..."></Button>
</Grid>
</GroupBox>

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

@ -42,18 +42,18 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -42,18 +42,18 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
get { return GetProperty("StartProgram", "", TextBoxEditMode.EditRawProperty, PropertyStorageLocations.ConfigurationSpecific);}
}
public ProjectProperty<string> StartURL
{
get{ return GetProperty("StartURL", "", TextBoxEditMode.EditRawProperty, PropertyStorageLocations.ConfigurationSpecific);}
}
public ProjectProperty<string> StartArguments
{
get{ return GetProperty("StartArguments", "", TextBoxEditMode.EditRawProperty, PropertyStorageLocations.ConfigurationSpecific);}
}
public ProjectProperty<string> StartWorkingDirectory
{
@ -63,21 +63,12 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -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}");
}
}
}

2
src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/KeyValuePair.cs

@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
*/
using System;
namespace Gui.Dialogs.OptionPanels.ProjectOptions
namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
{
/// <summary>
/// Description of KeyValuePair.

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

@ -1,87 +0,0 @@ @@ -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
{
/// <summary>
/// Description of OptionsHelper.
/// </summary>
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;
}
/// <summary>
/// Open File
/// </summary>
/// <param name="filter" or String.Empty></param>
/// <returns FileName></returns>
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;
}
}
}

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

@ -13,20 +13,14 @@ using System.Windows.Shapes; @@ -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
{
/// <summary>
/// Base class for project option panels with configuration picker.
/// </summary>
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 @@ -39,6 +33,19 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
this.DataContext = this;
}
/// <summary>
/// Initializes the project option panel.
/// This method is called after the project property was initialized,
/// immediately before the first Load() call.
/// </summary>
protected virtual void Initialize()
{
}
public virtual void Dispose()
{
}
ComboBox configurationComboBox;
ComboBox platformComboBox;
MSBuildBasedProject project;
@ -115,6 +122,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -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 @@ -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 @@ -369,6 +381,102 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
#endregion
#region Browse Helper
/// <summary>
/// Shows the 'Browse for folder' dialog.
/// </summary>
protected void BrowseForFolder(ProjectProperty<string> property, string description)
{
string newValue = BrowseForFile(description, property.Value, property.TextBoxEditMode);
if (newValue != null)
property.Value = newValue;
}
/// <summary>
/// Shows the 'Browse for folder' dialog.
/// </summary>
/// <param name="description">A description shown inside the dialog.</param>
/// <param name="startLocation">Start location, relative to the <see cref="BaseDirectory"/></param>
/// <param name="textBoxEditMode">The TextBoxEditMode used for the text box containing the file name</param>
/// <returns>Returns the location of the folder; or null if the dialog was cancelled.</returns>
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;
}
/// <summary>
/// Shows an 'Open File' dialog.
/// </summary>
protected void BrowseForFile(ProjectProperty<string> property, string filter)
{
string newValue = BrowseForFile(filter, property.Value, property.TextBoxEditMode);
if (newValue != null)
property.Value = newValue;
}
/// <summary>
/// Shows an 'Open File' dialog.
/// </summary>
/// <param name="filter">The filter string that determines which files are displayed.</param>
/// <param name="startLocation">Start location, relative to the <see cref="BaseDirectory"/></param>
/// <param name="textBoxEditMode">The TextBoxEditMode used for the text box containing the file name</param>
/// <returns>Returns the location of the file; or null if the dialog was cancelled.</returns>
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
}
}

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

@ -7,11 +7,6 @@ @@ -7,11 +7,6 @@
xmlns:local="clr-namespace:ICSharpCode.SharpDevelop.Gui.OptionPanels"
xmlns:core="http://icsharpcode.net/sharpdevelop/core">
<optionpanels:ProjectOptionPanel.Resources>
<local:StringToBoolConverter x:Key="strToBool"></local:StringToBoolConverter>
<optionpanels:StorageLocationConverter x:Key="locationConverter" />
</optionpanels:ProjectOptionPanel.Resources>
<ScrollViewer VerticalScrollBarVisibility="Auto">
<StackPanel
Orientation="Vertical">
@ -66,7 +61,7 @@ @@ -66,7 +61,7 @@
<CheckBox x:Name="delaySignOnlyCheckBox" Grid.Row="3" Grid.Column="1" VerticalAlignment="Center"
IsEnabled="{Binding ElementName=signAssemblyCheckBox, Path=IsChecked}"
Content="{core:Localize Dialog.ProjectOptions.Signing.DelaySignOnly}"
IsChecked="{Binding DelaySign.Value,Converter={StaticResource strToBool}}">
IsChecked="{Binding DelaySign.Value}">
</CheckBox>
<Label Grid.Row="4" Grid.Column="1" VerticalAlignment="Center"

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

@ -53,12 +53,12 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -53,12 +53,12 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
public ProjectProperty<string> AssemblyOriginatorKeyFile {
get { return GetProperty("AssemblyOriginatorKeyFile","", TextBoxEditMode.EditEvaluatedProperty); }
get { return GetProperty("AssemblyOriginatorKeyFile","", TextBoxEditMode.EditRawProperty); }
}
public ProjectProperty<string> DelaySign {
get { return GetProperty("DelaySign","", TextBoxEditMode.EditEvaluatedProperty); }
public ProjectProperty<bool> DelaySign {
get { return GetProperty("DelaySign", false); }
}
@ -82,7 +82,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -82,7 +82,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
helper.SetProperty("AssemblyOriginatorKeyMode", "File", true, signAssemblyBinding.Location);
}
};
*/
*/
if (signAssemblyCheckBox.IsChecked == true) {
this.AssemblyOriginatorKeyFile.Value = "File";
}
@ -142,7 +142,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -142,7 +142,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
var cbo = (ComboBox) sender;
if (cbo.SelectedIndex == keyFile.Count - 1) {
BrowseKeyFile();
BrowseForFile(this.AssemblyOriginatorKeyFile, "${res:SharpDevelop.FileFilter.KeyFiles} (" + KeyFileExtensions + ")|" + KeyFileExtensions + "|${res:SharpDevelop.FileFilter.AllFiles}|*.*");
}
if (cbo.SelectedIndex == keyFile.Count - 2) {
CreateKeyFile();
@ -150,18 +150,6 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -150,18 +150,6 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
}
void BrowseKeyFile()
{
string fileName = OptionsHelper.OpenFile("${res:SharpDevelop.FileFilter.KeyFiles} (" + KeyFileExtensions + ")|" + KeyFileExtensions + "|${res:SharpDevelop.FileFilter.AllFiles}|*.*",
base.BaseDirectory,
this.AssemblyOriginatorKeyFile.Value,
TextBoxEditMode.EditRawProperty);
if (!String.IsNullOrEmpty(fileName)) {
this.AssemblyOriginatorKeyFile.Value = fileName;
}
}
private void CreateKeyFile()
{
if (File.Exists(StrongNameTool)) {
@ -177,47 +165,47 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels @@ -177,47 +165,47 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
KeyFile.Add(generated);
SelectedKey = generated;
this.keyFileComboBox.SelectionChanged += KeyFileComboBox_SelectionChanged;
}
}
} else {
MessageService.ShowMessage("${res:Dialog.ProjectOptions.Signing.SNnotFound}");
}
}
}
#endregion
#endregion
/// <summary>
/// Gets the path of the "strong named" executable. This is used to create keys for strongly signing
/// .NET assemblies.
/// </summary>
/// <summary>
/// Gets the path of the "strong named" executable. This is used to create keys for strongly signing
/// .NET assemblies.
/// </summary>
private static string StrongNameTool {
get {
return FileUtility.GetSdkPath("sn.exe");
return FileUtility.GetSdkPath("sn.exe");
}
}
/// <summary>
/// Creates a key with the sn.exe utility.
/// </summary>
/// <param name="keyPath">The path of the key to create.</param>
/// <returns>True if the key was created correctly.</returns>
private static bool CreateKey(string keyPath)
{
if (File.Exists(keyPath)) {
string question = "${res:ICSharpCode.SharpDevelop.Internal.Templates.ProjectDescriptor.OverwriteQuestion}";
question = StringParser.Parse(question, new StringTagPair("fileNames", keyPath));
if (!MessageService.AskQuestion(question, "${res:ICSharpCode.SharpDevelop.Internal.Templates.ProjectDescriptor.OverwriteQuestion.InfoName}")) {
return false;
}
}
Process p = Process.Start(StrongNameTool, "-k \"" + keyPath + "\"");
p.WaitForExit();
if (p.ExitCode != 0) {
MessageService.ShowMessage("${res:Dialog.ProjectOptions.Signing.ErrorCreatingKey}");
return false;
}
return true;
}
/// <summary>
/// Creates a key with the sn.exe utility.
/// </summary>
/// <param name="keyPath">The path of the key to create.</param>
/// <returns>True if the key was created correctly.</returns>
private static bool CreateKey(string keyPath)
{
if (File.Exists(keyPath)) {
string question = "${res:ICSharpCode.SharpDevelop.Internal.Templates.ProjectDescriptor.OverwriteQuestion}";
question = StringParser.Parse(question, new StringTagPair("fileNames", keyPath));
if (!MessageService.AskQuestion(question, "${res:ICSharpCode.SharpDevelop.Internal.Templates.ProjectDescriptor.OverwriteQuestion.InfoName}")) {
return false;
}
}
Process p = Process.Start(StrongNameTool, "-k \"" + keyPath + "\"");
p.WaitForExit();
if (p.ExitCode != 0) {
MessageService.ShowMessage("${res:Dialog.ProjectOptions.Signing.ErrorCreatingKey}");
return false;
}
return true;
}
}
}

0
src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/ServiceReference/ServiceReferenceOptionsPanel..xaml → src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/ServiceReference/ServiceReferenceOptionsPanel.xaml

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

@ -29,9 +29,9 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels.ServiceReference @@ -29,9 +29,9 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels.ServiceReference
void Browse()
{
string fileName = OptionsHelper.OpenFile(string.Empty,String.Empty,String.Empty,TextBoxEditMode.EditRawProperty);
if (!String.IsNullOrEmpty(fileName)) {
SvcUtilPath = fileName;
var dialog = new OpenFileDialog();
if (dialog.ShowDialog() ?? false) {
SvcUtilPath = dialog.FileName;
}
}
Loading…
Cancel
Save