public void load(SettingsHelper helper, StyleDatabase db) { var styleName = helper.GetString(SettingsActiveStyle); style = db.styles.FirstOrDefault(s => s.ToString() == styleName); applyOnSave = helper.GetBoolean(SettingsFormatOnSave); }
private void CustomStyleListCombobox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (e.AddedItems.Count == 0 || lastSelectedStyleInfo == selectedStyleInfo ()) return; lastSelectedStyleInfo = selectedStyleInfo(); clangStylePropertyGrid_PropertyValueChanged_disconnector--; curStyle.DisableEvents = true; if (!inRename) { var ev = PropertyChanged; if (ev != null) ev(this, new PropertyChangedEventArgs("StyleNameText")); curStyle.fromJson(selectedStyleInfo().data); updatePreview(); } curStyle.DisableEvents = false; // Lack of RAII makes me cry ~_~ clangStylePropertyGrid.Update(); clangStylePropertyGrid_PropertyValueChanged_disconnector++; }
// Set at least to some possible default values internal void resolve(StyleDatabase db) { if (style == null) style = db.styles[0]; if (applyOnSave == null) applyOnSave = false; }