示例#1
0
        /// <summary>
        /// Remove key from list of completed update tasks
        /// </summary>
        /// <param name="oldKey">Key to remove</param>
        /// <returns></returns>
        public async Task RemoveKeyAsync(string oldKey)
        {
            if (!(await GetKeyListAsync()).Contains(item: oldKey))
            {
                return;
            }

            UpdateList.Remove(item: UpdateList.FirstOrDefault(x => x.Key == oldKey));

            await SaveDataAsync();
        }
示例#2
0
        /// <summary>
        /// Add new key into list of completed update tasks or update existing key
        /// </summary>
        /// <param name="newKey">Name of new key</param>
        /// <param name="updateDone">State of key</param>
        /// <returns></returns>
        public async Task AddKeyAsync(string newKey, bool updateDone = false)
        {
            if ((await GetKeyListAsync()).Contains(item: newKey))
            {
                UpdateList.FirstOrDefault(predicate: x => x.Key == newKey).UpdateDone = updateDone;
            }
            else
            {
                UpdateList.Add(item: new UpdateItem()
                {
                    Key = newKey, UpdateDone = updateDone
                });
            }

            await SaveDataAsync();
        }
示例#3
0
 /// <summary>
 /// Get selected key by name
 /// </summary>
 /// <param name="key">Name of key</param>
 /// <returns>Selcted key</returns>
 public UpdateItem GetItem(string key) => UpdateList.FirstOrDefault(x => x.Key == key);