private void ChangeRuleAssembliesButtonClick(object sender, RoutedEventArgs e) { var stringListDialog = new StringListEditorDialog(); stringListDialog.BrowseForDirectory = true; stringListDialog.TitleText = StringParser.Parse("${res:ICSharpCode.CodeAnalysis.ProjectOptions.ChooseRuleAssemblyDirectory}"); stringListDialog.LoadList(GetRuleAssemblyList(false)); stringListDialog.ShowDialog(); if (stringListDialog.DialogResult ?? false) { StringBuilder b = new StringBuilder(DefaultRuleAssemblies); foreach (string asm in stringListDialog.GetList()) { b.Append(';'); b.Append(asm); } bool oldInitSuccess = initSuccess; initSuccess = true; try { this.RuleAssemblies = b.ToString(); IsDirty = true; } finally { initSuccess = oldInitSuccess; } } }
void ShowLayoutEditor() { var editor = new StringListEditorDialog(); editor.Owner = ((WpfWorkbench)SD.Workbench).MainWindow; editor.Title = StringParser.Parse("${res:ICSharpCode.SharpDevelop.Commands.ChooseLayoutCommand.EditLayouts.Title}"); editor.TitleText = StringParser.Parse("${res:ICSharpCode.SharpDevelop.Commands.ChooseLayoutCommand.EditLayouts.Label}"); editor.ListCaption = "List:"; editor.AddButtonText = StringParser.Parse("${res:ICSharpCode.SharpDevelop.Commands.ChooseLayoutCommand.EditLayouts.AddLayout}"); editor.ShowDialog(); if (editor.DialogResult ?? false) { IList <string> oldNames = new List <string>(CustomLayoutNames); IList <string> newNames = editor.GetList(); // add newly added layouts foreach (string newLayoutName in newNames) { if (!oldNames.Contains(newLayoutName)) { oldNames.Add(newLayoutName); LayoutConfiguration.CreateCustom(newLayoutName); } } // remove deleted layouts LayoutConfiguration.Layouts.RemoveAll(delegate(LayoutConfiguration lc) { return(lc.Custom && !newNames.Contains(lc.Name)); }); LayoutConfiguration.SaveCustomLayoutConfiguration(); } }
public static void PopulateStringListEditor(string title, string listCaption,TextBox textBox,bool browseForDirectoty) { var stringListDialog = new StringListEditorDialog(); stringListDialog.TitleText = title; stringListDialog.ListCaption = listCaption; stringListDialog.BrowseForDirectory = browseForDirectoty; string[] strings = textBox.Text.Split(';'); stringListDialog.LoadList (strings); stringListDialog.ShowDialog(); if (stringListDialog.DialogResult ?? false) { textBox.Text = String.Join(";",stringListDialog.GetList()); } }