Exemple #1
0
        /// <summary>
        ///     might want to look at the following for double buffering:
        ///     http://stackoverflow.com/questions/3718380/winforms-double-buffering
        /// </summary>
        public AnimatedProgressBar() : base()
        {
            launcherState = LauncherStates.NOTSEEDING;

            init             = false;
            animation        = new System.Windows.Forms.PictureBox();
            head             = new System.Windows.Forms.PictureBox();
            animation.Parent = this;
            head.Parent      = this;

            animation.Visible = false;
            head.Visible      = false;

            head.Height = 7;
            head.BackgroundImageLayout = ImageLayout.Stretch;

            animation.Width = 12;
            animationX      = 0.0;

            animationTimer = new Timer();
            // 30ish frames per second
            animationTimer.Interval = 35;
            animationTimer.Tick    += UpdateAnimation;
            animationTimer.Enabled  = true;
        }
Exemple #2
0
 /// <summary>
 /// Update the state in the ui.
 /// This can be called on any thread.
 /// </summary>
 public void SetState(LauncherStates state, string error)
 {
     if (closing || IsDisposed)
         return;
     if (InvokeRequired)
     {
         Invoke(new Action<LauncherStates, string>(DoSetState), state, error);
     }
     else
     {
         DoSetState(state, error);
     }
 }
Exemple #3
0
 /// <summary>
 /// Update the state in the ui.
 /// This can be called on any thread.
 /// </summary>
 public void SetState(LauncherStates state, string error)
 {
     if (closing || IsDisposed)
     {
         return;
     }
     if (InvokeRequired)
     {
         Invoke(new Action <LauncherStates, string>(DoSetState), state, error);
     }
     else
     {
         DoSetState(state, error);
     }
 }
Exemple #4
0
        /// <summary>
        /// Update the state in the ui.
        /// This can be called only on the gui thread.
        /// </summary>
        private void DoSetState(LauncherStates state, string error)
        {
            switch (state)
            {
            case LauncherStates.Deploying:
                pbDeploy.Image = Icons32.ArrowRight;
                pbStart.Image  = Icons16.MediaPause;
                pbAttach.Image = debug ? Icons16.MediaPause : Icons16.MediaPauseDisabled;
                break;

            case LauncherStates.Starting:
                pbDeploy.Image = Icons32.Check;
                pbStart.Image  = Icons32.ArrowRight;
                pbAttach.Image = debug ? Icons16.MediaPause : Icons16.MediaPauseDisabled;
                break;

            case LauncherStates.Started:
                pbDeploy.Image = Icons32.Check;
                pbStart.Image  = Icons32.Check;
                pbAttach.Image = debug ? Icons16.MediaPause : Icons16.MediaPauseDisabled;
                if (!debug)
                {
                    Close();
                }
                break;

            case LauncherStates.Attaching:
                pbDeploy.Image = Icons32.Check;
                pbStart.Image  = Icons32.Check;
                pbAttach.Image = Icons32.ArrowRight;
                break;

            case LauncherStates.Attached:
                pbDeploy.Image = Icons32.Check;
                pbStart.Image  = Icons32.Check;
                pbAttach.Image = Icons32.Check;
                Close();
                break;

            case LauncherStates.Error:
                pbDeploy.Image = Icons32.Check;
                pbStart.Image  = Icons32.Check;
                pbAttach.Image = Icons32.Check;
                MessageBox.Show("A launch error occurred: " + error, Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Close();
                break;
            }
        }
Exemple #5
0
 /// <summary>
 /// Update the state in the ui.
 /// This can be called only on the gui thread.
 /// </summary>
 private void DoSetState(LauncherStates state, string error)
 {
     switch (state)
     {
         case LauncherStates.Deploying:
             pbDeploy.Image = Icons32.ArrowRight;
             pbStart.Image = Icons16.MediaPause;
             pbAttach.Image = debug ? Icons16.MediaPause : Icons16.MediaPauseDisabled;
             break;
         case LauncherStates.Starting:
             pbDeploy.Image = Icons32.Check;
             pbStart.Image = Icons32.ArrowRight;
             pbAttach.Image = debug ? Icons16.MediaPause : Icons16.MediaPauseDisabled;
             break;
         case LauncherStates.Started:
             pbDeploy.Image = Icons32.Check;
             pbStart.Image = Icons32.Check;
             pbAttach.Image = debug ? Icons16.MediaPause : Icons16.MediaPauseDisabled;
             if (!debug) Close();
             break;
         case LauncherStates.Attaching:
             pbDeploy.Image = Icons32.Check;
             pbStart.Image = Icons32.Check;
             pbAttach.Image = Icons32.ArrowRight;
             break;
         case LauncherStates.Attached:
             pbDeploy.Image = Icons32.Check;
             pbStart.Image = Icons32.Check;
             pbAttach.Image = Icons32.Check;
             Close();
             break;
         case LauncherStates.Error:
             pbDeploy.Image = Icons32.Check;
             pbStart.Image = Icons32.Check;
             pbAttach.Image = Icons32.Check;
             MessageBox.Show("A launch error occurred: " + error, Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
             Close();
             break;
     }
 }
Exemple #6
0
        public void setState(LauncherStates ls)
        {
            switch (ls)
            {
            case LauncherStates.DOWNLOADING:
                this.BackgroundImage      = Properties.Resources.Progress_Bar_Downloading;
                animation.BackgroundImage = Properties.Resources.Progress_Bar_Downloading_Animation;
                head.BackgroundImage      = Properties.Resources.Progress_Bar_Downloading_Head;
                animation.Visible         = true;
                head.Visible = true;
                break;

            case LauncherStates.SEEDING:
                this.BackgroundImage      = Properties.Resources.Progress_Bar_Seeding;
                animation.BackgroundImage = Properties.Resources.Progress_Bar_Seeding_Animation;
                animation.Visible         = true;
                head.Visible = false;
                break;

            case LauncherStates.NOTSEEDING:
                this.BackgroundImage = Properties.Resources.Progress_Bar_Not_Seeding;
                animation.Visible    = false;
                head.Visible         = false;
                break;

            case LauncherStates.UPDATING:
                this.BackgroundImage      = Properties.Resources.Progress_Bar_Updating;
                animation.BackgroundImage = Properties.Resources.Progress_Bar_Updating_Animation;
                head.BackgroundImage      = Properties.Resources.Progress_Bar_Updating_Head;
                animation.Visible         = true;
                head.Visible = true;
                break;

            default:
                return;
            }

            launcherState = ls;
        }