Exemplo n.º 1
0
        // <summary>
        // set the progress to a new value
        // </summary>
        // <param name="Percent">progress in percent</param>
        // <remarks></remarks>
        private void progressUpdate(Int32 Percent)
        {
            try {
                if (ProgressBar1.InvokeRequired)
                {
                    ProgressBar1.Invoke(new del_Sub_PInt32(this.progressUpdate), Percent);
                }
                else
                {
                    ProgressBar1.Value = Percent;
                    if (Percent > 0 && Percent < 100)
                    {
                        ProgressBar1.Value = Percent - 1;
                    }

                    lblProgress.Text = string.Format("{0}%", Percent);
                    ProgressBar1.Refresh();

                    if (m_SelfDoEvents)
                    {
                        Application.DoEvents();
                    }
                }
            }
            catch (Exception ex) {
                throw new Exception("error while setting a new value", ex);
            }
        }