public OptionsDialog(StyleDatabase dbArg, Package packageArg) { InitializeComponent(); Global.CallNew(out enumToItem); Global.CallNew(out itemToEnum); db = dbArg; StyleCombo.ItemsSource = db.viewAll (); StyleCombo.SelectedIndex = 0; cw = new CodeWindow(packageArg); package = packageArg; CodeWindowContainer.Content = cw; foreach (var val in Enum.GetValues(typeof(FormatterSettingsScope)).Cast<FormatterSettingsScope>()) { var item = new ComboBoxItem(); enumToItem[val] = item; itemToEnum[item] = val; } regenerateStyleCombo(); foreach (var val in Enum.GetValues(typeof(FormatterSettingsScope)).Cast<FormatterSettingsScope>()) settingsScopeCombo.Items.Add(enumToItem[val]); settingsScopeCombo.SelectedItem = 0; updatePreview(); onActiveSolutionChanged(); db.activeSolutionChanged += onActiveSolutionChanged; }
public StyleCustomizationDialog(Package packageArg, StyleDatabase styleDatabaseArg, CustomStyleInfo initialStyle) { InitializeComponent(); pasteCommand.InputGestures.Add(new KeyGesture(Key.V, ModifierKeys.Control)); CommandBindings.Add(new CommandBinding(pasteCommand, doPaste)); curStyle = new ClangFormatStyle(); styleDatabase = styleDatabaseArg; CustomStyleListCombobox.SelectionChanged += CustomStyleListCombobox_SelectionChanged; CustomStyleListCombobox.ItemsSource = styleDatabase.viewOnlyCustom (); cw = new CodeWindow(packageArg); CodeWindowContainer.Content = cw; if (initialStyle != null) CustomStyleListCombobox.SelectedItem = initialStyle; else CustomStyleListCombobox.SelectedIndex = 0; clangStylePropertyGrid.SelectedObject = curStyle; clangStylePropertyGrid.PropertyValueChanged += clangStylePropertyGrid_PropertyValueChanged; StyleNameTextbox.DataContext = this; updatePreview(); }