This class is used to post updated progress to the TaskForm, allowing the form's progressbar and text fields to be changed as progress updates.
Example #1
0
        /// <summary>
        /// Updates the TaskForm controls after a Progress.Report() has been recieved
        /// </summary>
        /// <param name="e">The TaskProgressUpdate object with the update information</param>
        private void ProgressChanged(TaskProgressUpdate e)
        {
            // Prevent null exception
            if (!IsOpen)
            {
                return;
            }

            // Wrap this in an invoke t
            if (e.HeaderText.Length > 0)
            {
                labelInstructionText.Text = e.HeaderText;
            }

            // Update message
            if (e.MessageText.Length > 0)
            {
                labelContent.Text = e.MessageText;
            }

            // Update window title
            if (e.WindowTitle.Length > 0)
            {
                Text = e.WindowTitle;
            }

            // Only increment progress bar if the style is not marguee, and we have progress
            if (progressBar.Style != ProgressBarStyle.Marquee && e.ProgressPercent > 0)
            {
                if (e.IncrementProgress)
                {
                    progressBar.Increment(e.ProgressPercent);
                }
                else
                {
                    progressBar.ValueFast(e.ProgressPercent);
                }

                progressBar.Update();
            }
        }
Example #2
0
        /// <summary>
        /// Updates the TaskForm controls after a Progress.Report() has been recieved
        /// </summary>
        /// <param name="e">The TaskProgressUpdate object with the update information</param>
        private void ProgressChanged(TaskProgressUpdate e)
        {
            // Prevent null exception
            if (!IsOpen) return;

            // Wrap this in an invoke t
            if (e.HeaderText.Length > 0)
                labelInstructionText.Text = e.HeaderText;

            // Update message
            if (e.MessageText.Length > 0)
                labelContent.Text = e.MessageText;

            // Update window title
            if (e.WindowTitle.Length > 0)
                Text = e.WindowTitle;

            // Only increment progress bar if the style is not marguee, and we have progress
            if (progressBar.Style != ProgressBarStyle.Marquee && e.ProgressPercent > 0)
            {
                if (e.IncrementProgress)
                    progressBar.Increment(e.ProgressPercent);
                else
                    progressBar.ValueFast(e.ProgressPercent);

                progressBar.Update();
            }
        }