private void ReplaceValueGloballyInternal(string oldValue, string newValue) { var editGroup = new DictionaryEditGroup(_dictionary) { }; try { List <string> keys = KeysContaining(oldValue); foreach (var key in keys) { var replaced = _dictionary[key].Replace(oldValue, newValue); EditSingleValueInternal(key, newValue, editGroup); } } catch (Exception e) { // Undoing any edits so far to avoid the application of a partial global edit. editGroup.Undo(); Debug.WriteLine(Complaints.PROBLEM_WITH_GLOBAL_REPLACEMENT + e.Message); return; } // If there is an error, this history entry is not added. _historyManager.Add(editGroup); }
public void Add(DictionaryEdit dictionaryEdit) { var dictionaryEditGroup = new DictionaryEditGroup(_dictionary); dictionaryEditGroup.Add(dictionaryEdit); RegisterEdit(dictionaryEditGroup); }
public void Add(string key, string oldValue, string newValue) { var dictionaryEditGroup = new DictionaryEditGroup(_dictionary); dictionaryEditGroup.Add(new DictionaryEdit(_dictionary, key, oldValue, newValue)); RegisterEdit(dictionaryEditGroup); }
private void EditSingleValueInternal(string key, string newValue, DictionaryEditGroup dictionaryEditGroup) { dictionaryEditGroup.Add(key, _dictionary[key], newValue); _dictionary[key] = newValue; }
private void RegisterEdit(DictionaryEditGroup dictionaryEditGroup) { _undoableEdits.Push(dictionaryEditGroup); _unsavedChanges.Push(dictionaryEditGroup); }
public void Add(DictionaryEditGroup dictionaryEditGroup) { RegisterEdit(dictionaryEditGroup); }