Browse Source

Redactor to use OptionHelper

pull/30/head
PeterForstmeier 13 years ago
parent
commit
03b5bbf023
  1. 22
      src/AddIns/BackendBindings/CppBinding/CppBinding/Project/ApplicationOptions.cs
  2. 6
      src/AddIns/BackendBindings/CppBinding/CppBinding/Project/LinkerOptions.xaml.cs
  3. 4
      src/AddIns/BackendBindings/CppBinding/CppBinding/Project/PreprocessorOptions.xaml.cs
  4. 2
      src/AddIns/BackendBindings/Python/PythonBinding/Project/Src/PythonOptionsPanel.xaml.cs
  5. 2
      src/Main/Base/Project/Src/Gui/Dialogs/OptionPanels/ProjectOptions/OptionsHelper.cs

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

@ -347,8 +347,7 @@ namespace ICSharpCode.CppBinding.Project
void ApplicationIconButton_Click(object sender, RoutedEventArgs e) void ApplicationIconButton_Click(object sender, RoutedEventArgs e)
{ {
var filter = StringParser.Parse(iconsfilter); string fileName = OptionsHelper.OpenFile(iconsfilter);
string fileName = BrowseForFile(filter);
if (!String.IsNullOrEmpty(fileName)) if (!String.IsNullOrEmpty(fileName))
{ {
this.applicationIconTextBox.Text = fileName; this.applicationIconTextBox.Text = fileName;
@ -410,7 +409,7 @@ namespace ICSharpCode.CppBinding.Project
void BrowseForManifest() void BrowseForManifest()
{ {
applicationManifestComboBox.SelectedIndex = -1; applicationManifestComboBox.SelectedIndex = -1;
var fileName = BrowseForFile(manifestFilter); var fileName = OptionsHelper.OpenFile(manifestFilter);
if (!String.IsNullOrEmpty(fileName)) { if (!String.IsNullOrEmpty(fileName)) {
this.applicationManifestComboBox.Items.Insert(0,fileName); this.applicationManifestComboBox.Items.Insert(0,fileName);
this.applicationManifestComboBox.SelectedIndex = 0; this.applicationManifestComboBox.SelectedIndex = 0;
@ -448,22 +447,5 @@ namespace ICSharpCode.CppBinding.Project
} }
#endregion #endregion
#region openFile
string BrowseForFile (string filter)
{
OpenFileDialog fileDialog = new OpenFileDialog {
Filter = filter,
Multiselect = false
};
if (fileDialog.ShowDialog() != true || fileDialog.FileNames.Length == 0)
return String.Empty;
return fileDialog.FileName;
}
#endregion
} }
} }

6
src/AddIns/BackendBindings/CppBinding/CppBinding/Project/LinkerOptions.xaml.cs

@ -23,7 +23,6 @@ namespace ICSharpCode.CppBinding.Project
{ {
private const string metaElement ="Link"; private const string metaElement ="Link";
private MSBuildBasedProject project; private MSBuildBasedProject project;
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
public LinkerOptions() public LinkerOptions()
{ {
@ -35,7 +34,6 @@ namespace ICSharpCode.CppBinding.Project
{ {
var msDefGroup = new MSBuildItemDefinitionGroup(project, project.ActiveConfiguration, project.ActivePlatform); var msDefGroup = new MSBuildItemDefinitionGroup(project, project.ActiveConfiguration, project.ActivePlatform);
this.additionalLibsTextBox.Text = GetElementMetaData(msDefGroup,"AdditionalDependencies"); this.additionalLibsTextBox.Text = GetElementMetaData(msDefGroup,"AdditionalDependencies");
this.addModuleTextBox.Text = GetElementMetaData(msDefGroup,"AddModuleNamesToAssembly"); this.addModuleTextBox.Text = GetElementMetaData(msDefGroup,"AddModuleNamesToAssembly");
@ -70,9 +68,8 @@ namespace ICSharpCode.CppBinding.Project
set set
{ {
checkBoxChecked = value; checkBoxChecked = value;
if (PropertyChanged != null)
PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs("UnCheck"));
IsDirty = true; IsDirty = true;
base.RaisePropertyChanged(() => CheckBoxChecked);
} }
} }
@ -175,7 +172,6 @@ namespace ICSharpCode.CppBinding.Project
string[] strings = textBox.Text.Split(';'); string[] strings = textBox.Text.Split(';');
stringListDialog.LoadList (strings); stringListDialog.LoadList (strings);
stringListDialog.ShowDialog(); stringListDialog.ShowDialog();
// if (stringListDialog.DialogResult.HasValue && stringListDialog.DialogResult.Value)
if (stringListDialog.DialogResult ?? false) { if (stringListDialog.DialogResult ?? false) {
textBox.Text = String.Join(";",stringListDialog.GetList()); textBox.Text = String.Join(";",stringListDialog.GetList());
} }

4
src/AddIns/BackendBindings/CppBinding/CppBinding/Project/PreprocessorOptions.xaml.cs

@ -23,7 +23,6 @@ namespace ICSharpCode.CppBinding.Project
{ {
private const string metaElement ="ClCompile"; private const string metaElement ="ClCompile";
private MSBuildBasedProject project; private MSBuildBasedProject project;
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
public PreprocessorOptions() public PreprocessorOptions()
{ {
@ -65,9 +64,8 @@ namespace ICSharpCode.CppBinding.Project
set set
{ {
checkBoxChecked = value; checkBoxChecked = value;
if (PropertyChanged != null)
PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs("UnCheck"));
IsDirty = true; IsDirty = true;
base.RaisePropertyChanged(() => CheckBoxChecked);
} }
} }

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

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

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

@ -41,7 +41,7 @@ namespace ICSharpCode.SharpDevelop.Gui.OptionPanels
public static string OpenFile (string filter) public static string OpenFile (string filter)
{ {
var dialog = new OpenFileDialog(); var dialog = new OpenFileDialog();
dialog.Filter = filter; dialog.Filter = StringParser.Parse(filter);
if (dialog.ShowDialog() ?? false) { if (dialog.ShowDialog() ?? false) {
return dialog.FileName; return dialog.FileName;
} }

Loading…
Cancel
Save