private void SetState(State state, int downloadProgress)
        {
            Updater.state = state;
            // Make sure someone is listening to event
            if (OnStateChange == null) return;

            UpdateStatusEventArgs args = new UpdateStatusEventArgs(state, downloadProgress);
            OnStateChange(this, args);
        }
        private void SetState(State state, int downloadProgress)
        {
            Updater.state = state;
            // Make sure someone is listening to event
            if (OnStateChange == null)
            {
                return;
            }

            UpdateStatusEventArgs args = new UpdateStatusEventArgs(state, downloadProgress);

            OnStateChange(this, args);
        }
 private void UpdateStateChange(object sender, UpdateStatusEventArgs args)
 {
     if (!this.IsHandleCreated)
     {
         this.HandleCreated += (send, e) =>
         {
             this.UpdateStateChange(sender, args);
         };
         return;
     }
     this.Invoke((MethodInvoker)delegate {
         switch (args.State)
         {
             case State.PENDING:
                 updateStateText.Text = "Up To Date: " + CoreMusicApp.CURRENT_VERSION;
                 break;
             case State.CHECKING:
                 updateStateText.Text = "Checking...";
                 break;
             case State.DOWNLOADING:
                 updateStateText.Text = "Downloading - " + (args.DownloadProgress < 10 ? " " : "") + args.DownloadProgress.ToString() + "%";
                 downloadProgress.Width = (int)((PROGRESS_MAX_WIDTH / 100.0) * (double)args.DownloadProgress);
                 break;
             case State.READY:
                 updateStateText.Text = "Ready to Update";
                 installUpdateButton.Show();
                 break;
         }
         if (args.State != State.READY)
         {
             installUpdateButton.Hide();
         }
         if (args.State != State.DOWNLOADING)
         {
             downloadProgress.Width = 0;
             downloadProgressBorder.Hide();
         } else
         {
             downloadProgressBorder.Show();
         }
     });
 }