public void AddHistoryItem(HistoryItem item) { AllHistoryList.Add(item); if (item.FolderId == CurrentSelectedFolder.Id) { DisplayHistoryCollection.Add(item); } DurationText = "00:00:00"; BeginStamp = DateTime.MinValue; ShowPopup(LanguageName.HasAddedHistoryItem); IsHistoryListChanged = true; }
public async Task Init() { var folderList = await App._instance.IO.GetLocalDataAsync <List <FolderItem> >(StaticString.FolderListFileName); var historyList = await App._instance.IO.GetLocalDataAsync <List <HistoryItem> >(StaticString.HistoryListFileName); FolderCollection.Clear(); DisplayHistoryCollection.Clear(); if (!folderList.IsNullOrEmpty()) { folderList.ForEach(p => FolderCollection.Add(p)); } else { var folderItem = new FolderItem(App._instance.App.GetLocalizationTextFromResource(LanguageName.Default), FeatherSymbol.Activity); FolderCollection.Add(folderItem); await SaveFolderList(); } string lastSelectedFolderId = App._instance.App.GetLocalSetting(Settings.LastSelectFolderId, ""); if (!FolderCollection.Any(p => p.Id == lastSelectedFolderId)) { lastSelectedFolderId = FolderCollection.First().Id; } CurrentSelectedFolder = FolderCollection.Where(p => p.Id == lastSelectedFolderId).First(); if (!historyList.IsNullOrEmpty()) { AllHistoryList = historyList; historyList.Where(p => p.FolderId == lastSelectedFolderId).ToList().ForEach(p => DisplayHistoryCollection.Add(p)); HistoryChanged?.Invoke(this, EventArgs.Empty); } }