Пример #1
0
        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);
        }
Пример #2
0
        // Loading From DB
        public async Task <bool> LoadDefault()
        {
            var  id     = PlaylistStatic.GetDefaultPlaylistId();
            bool loaded = await ClearAndLoadNew(id);

            Name = null;
            Id   = -1;
            return(loaded);
        }
Пример #3
0
        public void SaveDefault()
        {
            var currentId   = Id;
            var currentName = Name;

            Id   = PlaylistStatic.GetDefaultPlaylistId();
            Name = PlaylistStatic.DefaultDBName;
            Save(Name);
            Id          = currentId;
            currentName = Name;
        }
Пример #4
0
 // Saving
 public int Save(string name)
 {
     return(PlaylistStatic.Save(this, name));
 }