public async Task <bool> LoadNew(int id) { var name = PlaylistStatic.RetrieveNameById(id); if (name == null) { return(false); } Name = name; Id = id; List <PlaylistItem> items = await PlaylistItemStatic.RetrievePlaylistItemsByPlaylistId(id); foreach (var item in items) { Add(item); } if (Shuffle) { GenerateRandomIndexes(); } if (Items.Count() > 0) { HasItems = true; if (SelectedIndex == -1) { SelectedIndex = 0; } } else { HasItems = false; } return(true); }
// Loading From DB public async Task <bool> LoadDefault() { var id = PlaylistStatic.GetDefaultPlaylistId(); bool loaded = await ClearAndLoadNew(id); Name = null; Id = -1; return(loaded); }
public void SaveDefault() { var currentId = Id; var currentName = Name; Id = PlaylistStatic.GetDefaultPlaylistId(); Name = PlaylistStatic.DefaultDBName; Save(Name); Id = currentId; currentName = Name; }
// Saving public int Save(string name) { return(PlaylistStatic.Save(this, name)); }