public void Handle(QueryHistoryEvent message) { QueryHistory.Add(message); while (QueryHistory.Count > _globalOptions.QueryHistoryMaxItems) { QueryHistory.RemoveAt(0); } SaveHistoryFile(message); }
public static void AddQueryHistory(string uid) { if (!QueryHistory.Contains(uid)) { MainWindow.ComboBoxUserId.Items.Add(uid); QueryHistory.Add(uid); if (QueryHistory.Count > MAX_QUERY_HISTORY_COUNT) { MainWindow.ComboBoxUserId.Items.RemoveAt(0); QueryHistory.RemoveAt(0); } } }
public async Task Handle(QueryHistoryEvent message) { // don't add a history record if the query text is empty if (string.IsNullOrWhiteSpace(message.QueryText)) { Log.Debug("{class} {method} {message}", nameof(GlobalQueryHistory), "Handle<QueryHistoryEvent>", "Skipping saving Query History as QueryText is empty"); return; } QueryHistory.Add(message); while (QueryHistory.Count > _globalOptions.QueryHistoryMaxItems) { QueryHistory.RemoveAt(0); } await SaveHistoryFileAsync(message); }