public static void RemoveAt(int index) { if (index >= _history.Count) { return; } _history.RemoveAt(index); Save(); FileHistoryChanged?.Invoke(); }
public static void Load() { try { if (AppData.FileExists(HistoryFile)) { _history = JsonConvert.DeserializeObject <SerializableFileHistory>(AppData.ReadFile(HistoryFile)).Entries.ToList(); } } catch (Exception e) { if (MessageBox.Show("Could not load file history!\nDo you want to reset it?", "Tabbed Editor - History", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { ResetHistory(); } Logger.DumpException(e); } FileHistoryChanged?.Invoke(); }
public static void Add(string path, Type type) { EditorFile editorFile = _history.FirstOrDefault(e => e.Path == path); if (editorFile is null) { _history.Insert(0, new EditorFile(path, type)); while (_history.Count > 10) { _history.RemoveAt(10); } } else { _history.Remove(editorFile); _history.Insert(0, editorFile); } Save(); FileHistoryChanged?.Invoke(); }
public static void ResetHistory() { AppData.DeleteFile(HistoryFile); _history.Clear(); FileHistoryChanged?.Invoke(); }
public static void Remove(EditorFile editorFile) { _history.Remove(editorFile); Save(); FileHistoryChanged?.Invoke(); }