private void UpdateUI()
 {
     //Instantiate our class
     SoundCloud clsSound = new SoundCloud();
     try
     {
         while (!isDone)
         {
             //Just loop this dispatcher and update the UI
             Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
             {
                 //If we're done then set all the necessary "finished" values
                 if (isDone)
                 {
                     clsSound.count = 0;
                     progressCounter.Value = 100;
                     txtCalculate.Text = Convert.ToString(clsSound.count) + " Songs";
                     EnableButtons();
                 }
                 else
                 {
                     progressCounter.Value = clsSound.dblProgress;
                     txtCalculate.Text = Convert.ToString(clsSound.count) + " Songs";
                 }
             }));
             Thread.Sleep(30);
         }
     }
     catch (Exception ex)
     {
         clsSound = null;
         MessageBox.Show(ex.Message);
     }
 }
        private void btnDownloadFollowers_Click(object sender, RoutedEventArgs e)
        {
            SetUI();

            Task.Factory.StartNew(() =>
                {
                    SoundCloud clsSound = new SoundCloud();
                    try
                    {
                        isDone = false;
                        clsSound.lstUser = null;
                        UpdateUI();

                        foreach (string users in listUsers.Items)
                        {
                            clsSound.lstUser.Add(users);
                        }

                        if (!clsSound.CountResults("followings"))
                        {
                            return;
                        }

                        clsSound.DownloadFollowers();
                        isDone = true;
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                    finally
                    {
                        clsSound = null;
                        EnableButtons();
                    }
                });
        }
        private void btnDownloadLikes_Click(object sender, RoutedEventArgs e)
        {
            SetUI();
            Task.Factory.StartNew(() =>
            {
                //Instantiate our class
                SoundCloud clsSound = new SoundCloud();
                try
                {
                    isDone = false;
                    clsSound.lstUser = null;
                    UpdateUI();

                    foreach (string users in listUsers.Items)
                    {
                        clsSound.lstUser.Add(users);
                    }

                    if(!clsSound.CountResults("favorites"))
                    {
                        return;
                    }

                    clsSound.DownloadLikes();
                    isDone = true;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    clsSound = null;
                    Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
                    {
                        EnableButtons();
                    }));
                }
            });
        }