diff --git a/src/AddIns/DisplayBindings/FormsDesigner/Project/Resources/WindowsFormsGeneralOptions.xfrm b/src/AddIns/DisplayBindings/FormsDesigner/Project/Resources/WindowsFormsGeneralOptions.xfrm index 9cc63ff9e0..7020b4e631 100644 --- a/src/AddIns/DisplayBindings/FormsDesigner/Project/Resources/WindowsFormsGeneralOptions.xfrm +++ b/src/AddIns/DisplayBindings/FormsDesigner/Project/Resources/WindowsFormsGeneralOptions.xfrm @@ -5,10 +5,10 @@ - + - + @@ -25,10 +25,18 @@ + - + + + + + + + + @@ -73,4 +81,4 @@ - + \ No newline at end of file diff --git a/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/OptionPanels/GeneralOptions.cs b/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/OptionPanels/GeneralOptions.cs index dc434a3b77..2f7d231470 100644 --- a/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/OptionPanels/GeneralOptions.cs +++ b/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Gui/OptionPanels/GeneralOptions.cs @@ -25,6 +25,7 @@ namespace ICSharpCode.FormsDesigner.Gui.OptionPanels ((CheckBox)ControlDictionary["inPlaceEditCheckBox"]).Checked = PropertyService.Get("FormsDesigner.DesignerOptions.EnableInSituEditing", true); ((CheckBox)ControlDictionary["useSmartTagsCheckBox"]).Checked = UseSmartTags; ((CheckBox)ControlDictionary["insertTodoCommentCheckBox"]).Checked = InsertTodoComment; + ((CheckBox)ControlDictionary["generateVSStyleHandlersCheckBox"]).Checked = GenerateVisualStudioStyleEventHandlers; } public static bool UseSmartTags { @@ -54,6 +55,15 @@ namespace ICSharpCode.FormsDesigner.Gui.OptionPanels } } + public static bool GenerateVisualStudioStyleEventHandlers { + get { + return PropertyService.Get("FormsDesigner.DesignerOptions.GenerateVisualStudioStyleEventHandlers", false); + } + set { + PropertyService.Set("FormsDesigner.DesignerOptions.GenerateVisualStudioStyleEventHandlers", value); + } + } + public override bool StorePanelContents() { PropertyService.Set("FormsDesigner.DesignerOptions.PropertyGridSortAlphabetical", ((CheckBox)ControlDictionary["sortAlphabeticalCheckBox"]).Checked); @@ -62,6 +72,7 @@ namespace ICSharpCode.FormsDesigner.Gui.OptionPanels PropertyService.Set("FormsDesigner.DesignerOptions.EnableInSituEditing", ((CheckBox)ControlDictionary["inPlaceEditCheckBox"]).Checked); UseSmartTags = ((CheckBox)ControlDictionary["useSmartTagsCheckBox"]).Checked; InsertTodoComment = ((CheckBox)ControlDictionary["insertTodoCommentCheckBox"]).Checked; + GenerateVisualStudioStyleEventHandlers = ((CheckBox)ControlDictionary["generateVSStyleHandlersCheckBox"]).Checked; return true; } diff --git a/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Services/EventBindingService.cs b/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Services/EventBindingService.cs index 0ac8cda700..fa334577ed 100644 --- a/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Services/EventBindingService.cs +++ b/src/AddIns/DisplayBindings/FormsDesigner/Project/Src/Services/EventBindingService.cs @@ -8,7 +8,7 @@ using System; using System.Collections; using System.ComponentModel; - +using ICSharpCode.FormsDesigner.Gui.OptionPanels; using ICSharpCode.SharpDevelop.Gui; namespace ICSharpCode.FormsDesigner.Services @@ -26,7 +26,28 @@ namespace ICSharpCode.FormsDesigner.Services protected override string CreateUniqueMethodName(IComponent component, EventDescriptor e) { - return String.Format("{0}{1}", Char.ToUpper(component.Site.Name[0]) + component.Site.Name.Substring(1), e.DisplayName); + string componentName = GetComponentName(component); + return GetEventHandlerName(componentName, e.DisplayName); + } + + string GetComponentName(IComponent component) + { + string siteName = component.Site.Name; + return Char.ToUpper(siteName[0]) + siteName.Substring(1); + } + + string GetEventHandlerName(string componentName, string eventName) + { + string eventHandlerNameFormat = GetEventHandlerNameFormat(); + return String.Format(eventHandlerNameFormat, componentName, eventName); + } + + string GetEventHandlerNameFormat() + { + if (GeneralOptionsPanel.GenerateVisualStudioStyleEventHandlers) { + return "{0}_{1}"; + } + return "{0}{1}"; } // sohuld look around in form class for compatiable methodes