Browse Source

Some improvements to formatting options fix.

pull/487/head
Andreas Weizel 11 years ago
parent
commit
bedbae8b60
  1. 2
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormattingOptionsContainer.cs
  2. 16
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/OptionPanels/CSharpFormattingOptionPanel.xaml.cs
  3. 2
      src/Main/Core/Project/Src/Services/PropertyService/Properties.cs

2
src/AddIns/BackendBindings/CSharpBinding/Project/Src/FormattingStrategy/CSharpFormattingOptionsContainer.cs

@ -127,7 +127,6 @@ namespace CSharpBinding.FormattingStrategy @@ -127,7 +127,6 @@ namespace CSharpBinding.FormattingStrategy
if ((e.PropertyName == "Parent") || (e.PropertyName == null)) {
// All properties might have changed -> update everything
cachedOptions = CreateCachedOptions();
// OnPropertyChanged(e.PropertyName);
} else {
// Some other property has changed, check if we have our own value for it
if (!activeOptions.Contains(e.PropertyName)) {
@ -136,7 +135,6 @@ namespace CSharpBinding.FormattingStrategy @@ -136,7 +135,6 @@ namespace CSharpBinding.FormattingStrategy
if (propertyInfo != null) {
var val = GetEffectiveOption(e.PropertyName);
propertyInfo.SetValue(cachedOptions, val);
// OnPropertyChanged(e.PropertyName);
}
}
}

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

@ -82,17 +82,19 @@ namespace CSharpBinding.OptionPanels @@ -82,17 +82,19 @@ namespace CSharpBinding.OptionPanels
{
base.LoadOptions();
formattingEditor.OptionsContainer = persistenceHelper.StartEditing();
formattingEditor.OptionsContainer.PropertyChanged += (sender, e) => isDirty = true;
formattingEditor.OptionsContainer.PropertyChanged += ContainerPropertyChanged;
}
public override bool SaveOptions()
void ContainerPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (isDirty) {
return persistenceHelper.Save() && base.SaveOptions();
} else {
// Nothing has been changed here, return without action
return true;
isDirty = true;
}
public override bool SaveOptions()
{
// Only save container, if some option really has changed
formattingEditor.OptionsContainer.PropertyChanged -= ContainerPropertyChanged;
return (!isDirty || persistenceHelper.Save()) && base.SaveOptions();
}
}
}

2
src/Main/Core/Project/Src/Services/PropertyService/Properties.cs

@ -430,7 +430,7 @@ namespace ICSharpCode.Core @@ -430,7 +430,7 @@ namespace ICSharpCode.Core
if (result == null) {
result = new Properties(this);
dict[key] = result;
isNewContainer = true;
result.MakeDirty();
}
}
if (isNewContainer)

Loading…
Cancel
Save