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 @@ -347,8 +347,7 @@ namespace ICSharpCode.CppBinding.Project
void ApplicationIconButton_Click(object sender, RoutedEventArgs e)
{
var filter = StringParser.Parse(iconsfilter);
string fileName = BrowseForFile(filter);
string fileName = OptionsHelper.OpenFile(iconsfilter);
if (!String.IsNullOrEmpty(fileName))
{
this.applicationIconTextBox.Text = fileName;
@ -410,7 +409,7 @@ namespace ICSharpCode.CppBinding.Project @@ -410,7 +409,7 @@ namespace ICSharpCode.CppBinding.Project
void BrowseForManifest()
{
applicationManifestComboBox.SelectedIndex = -1;
var fileName = BrowseForFile(manifestFilter);
var fileName = OptionsHelper.OpenFile(manifestFilter);
if (!String.IsNullOrEmpty(fileName)) {
this.applicationManifestComboBox.Items.Insert(0,fileName);
this.applicationManifestComboBox.SelectedIndex = 0;
@ -448,22 +447,5 @@ namespace ICSharpCode.CppBinding.Project @@ -448,22 +447,5 @@ namespace ICSharpCode.CppBinding.Project
}
#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 @@ -23,7 +23,6 @@ namespace ICSharpCode.CppBinding.Project
{
private const string metaElement ="Link";
private MSBuildBasedProject project;
public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
public LinkerOptions()
{
@ -35,7 +34,6 @@ namespace ICSharpCode.CppBinding.Project @@ -35,7 +34,6 @@ namespace ICSharpCode.CppBinding.Project
{
var msDefGroup = new MSBuildItemDefinitionGroup(project, project.ActiveConfiguration, project.ActivePlatform);
this.additionalLibsTextBox.Text = GetElementMetaData(msDefGroup,"AdditionalDependencies");
this.addModuleTextBox.Text = GetElementMetaData(msDefGroup,"AddModuleNamesToAssembly");
@ -70,9 +68,8 @@ namespace ICSharpCode.CppBinding.Project @@ -70,9 +68,8 @@ namespace ICSharpCode.CppBinding.Project
set
{
checkBoxChecked = value;
if (PropertyChanged != null)
PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs("UnCheck"));
IsDirty = true;
base.RaisePropertyChanged(() => CheckBoxChecked);
}
}
@ -175,7 +172,6 @@ namespace ICSharpCode.CppBinding.Project @@ -175,7 +172,6 @@ namespace ICSharpCode.CppBinding.Project
string[] strings = textBox.Text.Split(';');
stringListDialog.LoadList (strings);
stringListDialog.ShowDialog();
// if (stringListDialog.DialogResult.HasValue && stringListDialog.DialogResult.Value)
if (stringListDialog.DialogResult ?? false) {
textBox.Text = String.Join(";",stringListDialog.GetList());
}

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

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

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

@ -44,7 +44,7 @@ namespace ICSharpCode.PythonBinding @@ -44,7 +44,7 @@ namespace ICSharpCode.PythonBinding
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))
return;
PythonFileName = str;

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

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

Loading…
Cancel
Save