Пример #1
0
        protected override async Task <bool> LoadAsync()
        {
            if (IsLoaded || IsBusy)
            {
                return(false);
            }
            IsBusy     = true;
            IsBusyText = "Loading Song History...";
            await Task.Run(async() =>
            {
                var randomSetlist = await WebApiClientService.GetSongsAsync();
                return(randomSetlist);
            })
            .ContinueWith(task =>
            {
                try
                {
                    if (!task.IsFaulted && task.Result != null)
                    {
                        foreach (var song in task.Result.OrderBy(s => s.SongName))
                        {
                            Songs.Add(song);
                            if (song.IsAlias)
                            {
                                Aliases.Add(song);
                            }

                            if (song.IsCover)
                            {
                                Covers.Add(song);
                            }

                            if (song.IsOriginal)
                            {
                                Originals.Add(song);
                            }
                        }
                    }
                    else
                    {
                        AlertManagerService.ShowAlert("Error Occurred Loading Song History", task.Exception.ToString());
                    }
                }
                catch (Exception e)
                {
                    AlertManagerService.ShowAlert("Error Occurred Loading Song History", e.ToString());
                }
                finally
                {
                    IsBusy   = false;
                    IsLoaded = true;
                    task.Dispose();
                }
            }, TaskScheduler.FromCurrentSynchronizationContext());

            return(true);
        }
Пример #2
0
        // Methods :: Public :: SetCover
        /// <summary>
        ///	Store a cover in the database.
        /// </summary>
        /// <param name="key">
        ///	The album key.
        /// </param>
        /// <param name="pix">
        ///	The <see cref="Gdk.Pixbuf" /> to be used for the cover.
        /// </param>
        public void SetCover(string key, Pixbuf pix)
        {
            lock (this) {
                bool replace = Covers.ContainsKey(key);

                if (replace)
                {
                    Covers.Remove(key);
                }

                Covers.Add(key, pix);

                int    data_size;
                IntPtr data = PackCover(pix, out data_size);
                db.Store(key, data, data_size, replace);
            }
        }
Пример #3
0
 private void ZeroPrice(string coverCode)
 {
     Covers.Add(coverCode, new Cover(coverCode, 0M));
 }
 public void AddCover(string code, string name, string description, bool optional, decimal? sumInsured)
 {
     Ensure.That(Status).Equals(ProductStatus.Draft);
     Covers.Add(new Cover(code, name, description, optional, sumInsured));
 }
 public void AddCover(string code, string name, string description, bool optional, decimal?sumInsured)
 {
     EnsureIsDraft();
     Covers.Add(new Cover(code, name, description, optional, sumInsured));
 }