private void SaveHistoryItem() { var mostRecent = HistoryItems.Count > 0 ? HistoryItems[0] : null; if (mostRecent == null || (mostRecent.Name != _hubName || mostRecent.ConnectionString != _connectionString)) { HistoryItems.Insert(0, new Models.HistoryItem { ConnectionString = _connectionString, Name = _hubName }); var json = JsonConvert.SerializeObject(HistoryItems); File.WriteAllText(_historyFileName, json); } }
private void AddHistoryEntry(string content, string expression) { if (HistoryItems.Count > 0) { // check to see if the content has changed var lastEntry = HistoryItems[0]; if (lastEntry.ResourceContent == content && lastEntry.Expression == expression) { return; // (no need to add a new entry) } } HistoryItems.Insert(0, new HistoryItemDetails(content, expression)); // trim the history to only 100 items while (HistoryItems.Count > 100) { HistoryItems.Remove(HistoryItems.Last()); } }
private void Push(WindowHistoryControlViewModel hc) { HistoryItems.Insert(0, hc); }
public void Push(HistoryItemViewModel hc) { HistoryItems.Insert(0, hc); //Manager.PushCurrentState() }