Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
 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;
 }
Beispiel #3
0
        public async Task RemoveHistory(HistoryItem item)
        {
            var confirmDialog = new ConfirmDialog(LanguageName.ConfirmRemoveHistory);

            confirmDialog.PrimaryButtonClick += (_s, _e) =>
            {
                AllHistoryList.Remove(item);
                DisplayHistoryCollection.Remove(item);
                IsHistoryListChanged = true;
            };
            await confirmDialog.ShowAsync();
        }
Beispiel #4
0
 public void MoveHistory(HistoryItem source, string newFolderId)
 {
     foreach (var item in AllHistoryList)
     {
         if (item.Id == source.Id)
         {
             item.FolderId = newFolderId;
             break;
         }
     }
     DisplayHistoryCollection.Remove(source);
     IsHistoryListChanged = true;
 }