public static void AddHistoryItemAsync(string historyPath, HistoryItem historyItem) { TaskEx.Run(() => { HistoryManager history = new HistoryManager(historyPath); history.AppendHistoryItem(historyItem); }); }
private void RefreshHistoryItems() { if (history == null) { history = new HistoryManager(HistoryPath); } allHistoryItems = GetHistoryItems(); ApplyFiltersAndAdd(); }
private HistoryItem[] GetHistoryItems() { if (history == null) { history = new HistoryManagerJSON(HistoryPath); } List <HistoryItem> historyItems = history.GetHistoryItems(); historyItems.Reverse(); return(historyItems.ToArray()); }
private void RefreshHistoryItems() { if (history == null) { history = new HistoryManager(HistoryPath); } historyItems = GetHistoryItems(); ilvImages.Items.Clear(); ImageListViewItem[] ilvItems = historyItems.Select(historyItem => new ImageListViewItem(historyItem.Filepath) { Tag = historyItem }).ToArray(); ilvImages.Items.AddRange(ilvItems); }
private void RefreshHistoryItems() { SearchText = tstbSearch.Text; if (history == null) { history = new HistoryManager(HistoryPath); } ilvImages.Items.Clear(); ImageListViewItem[] ilvItems = GetHistoryItems().Select(hi => new ImageListViewItem(hi.Filepath) { Tag = hi }).ToArray(); ilvImages.Items.AddRange(ilvItems); }
private HistoryItem[] GetHistoryItems() { if (history == null) { history = new HistoryManager(HistoryPath); } IEnumerable <HistoryItem> tempHistoryItems = history.GetHistoryItems(); tempHistoryItems = tempHistoryItems.Reverse(); if (Settings.MaxItemCount > 0) { tempHistoryItems = tempHistoryItems.Take(Settings.MaxItemCount); } return(tempHistoryItems.ToArray()); }
private IEnumerable <HistoryItem> GetHistoryItems() { if (history == null) { history = new HistoryManagerJSON(HistoryPath); } List <HistoryItem> historyItems = history.GetHistoryItems(); List <HistoryItem> filteredHistoryItems = new List <HistoryItem>(); Regex regex = null; if (!string.IsNullOrEmpty(SearchText)) { string pattern = Regex.Escape(SearchText).Replace("\\?", ".").Replace("\\*", ".*"); regex = new Regex(pattern, RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.CultureInvariant); } for (int i = historyItems.Count - 1; i >= 0; i--) { HistoryItem hi = historyItems[i]; if (!string.IsNullOrEmpty(hi.FilePath) && Helpers.IsImageFile(hi.FilePath) && (regex == null || regex.IsMatch(hi.FileName) || (SearchInTags && hi.Tags != null && hi.Tags.Any(tag => regex.IsMatch(tag.Value)))) && (!Settings.FilterMissingFiles || File.Exists(hi.FilePath))) { filteredHistoryItems.Add(hi); if (Settings.MaxItemCount > 0 && filteredHistoryItems.Count >= Settings.MaxItemCount) { break; } } } UpdateTitle(historyItems.Count, filteredHistoryItems.Count); return(filteredHistoryItems); }