Beispiel #1
0
        public async Task Reload(Context context = null)
        {
            if (context == null)
            {
                context = Context;
            }
            ProgressAlert alert = new ProgressAlert("Refreshing scrobbles", "Please wait...", context);

            alert.Show();
            if (SourceUser != null)
            {
                ReythScrobbles.Clear();
                var res = await client.User.GetRecentScrobbles(SourceUser, null, 1, 100);

                if (res.Success)
                {
                    ReythScrobbles.AddRange(res);
                }
            }
            if (client.Auth.UserSession != null)
            {
                var userRes = await client.User.GetRecentScrobbles(client.Auth.UserSession.Username, null, 1, 100);

                GinaScrobbles.Clear();
                if (userRes.Success)
                {
                    GinaScrobbles.AddRange(userRes);
                }
            }

            if (ReythAdapter == null)
            {
                ReythAdapter = new ScrobbleListAdapter(ReythScrobbles.ToArray(), (e, a) =>
                {
                    var vh = a.View.Tag as ScrobbleListAdapterViewHolder;
                    vh.ChangeChecked();
                });
            }
            else
            {
                ReythAdapter.SetItems(ReythScrobbles);
            }
            if (GinaAdapter == null)
            {
                GinaAdapter = new ScrobbleListAdapter(GinaScrobbles.ToArray());
            }
            else
            {
                GinaAdapter.SetItems(GinaScrobbles);
            }
            alert.Hide();
            if (string.IsNullOrEmpty(SourceUser))
            {
                var msg = new MessageAlert("Source User Not Set!", "Use the 'Set Source' option from the menu to pick the user whose scrobbles you want to sync.", context);
                msg.Show();
            }
        }
Beispiel #2
0
        private async void ReloadScrobbles()
        {
            var progress = await this.ShowProgressAsync("Refreshing...", "Downloading data from Last.FM...");

            headers.DataContext = new
            {
                LeftName  = SourceUser == "" || SourceUser == "" ? "N/A" : SourceUser,
                RightName = client.Auth != null ? client.Auth.UserSession.Username : "******",
            };

            if (SourceUser != null)
            {
                ReythScrobbles.Clear();
                var res = await client.User.GetRecentScrobbles(SourceUser, null, 1, 250);

                if (res.Success)
                {
                    foreach (var s in res)
                    {
                        ReythScrobbles.Add(s);
                    }
                }
            }
            if (client.Auth.UserSession != null)
            {
                var userRes = await client.User.GetRecentScrobbles(client.Auth.UserSession.Username, null, 1, 250);

                GinaScrobbles.Clear();
                if (userRes.Success)
                {
                    foreach (var s in userRes)
                    {
                        GinaScrobbles.Add(s);
                    }
                }
            }
            await progress.CloseAsync();
        }