internal void updateProgress(int current, int total, string caption)
        {
            caption += "...";
            if (label1.Text != caption)
            {
                label1.Text = caption;
                return;
            }
            if (progressBar1.Maximum != total)
            {
                progressBar1.Maximum = total;
            }
            progressBar1.Value = current;
            if (progressBar1.Visible == false)
            {
                progressBar1.Visible = true;
            }

            if (taskHwnd == null)
            {
                taskHwnd = Windows7Taskbar.GetTaskBarForm(this);
            }

            if (taskHwnd.Value != IntPtr.Zero)
            {
                Windows7Taskbar.SetProgressValue(taskHwnd.Value, (uint)current, (uint)total);
            }
        }
Ejemplo n.º 2
0
        internal void updateProgress(long current, long total, string caption, int subCurrent = -1, int subTotal = -1)
        {
            caption += "...";
            if (label1.Text != caption)
            {
                label1.Text = caption;
            }
            if (current > total)
            {
                return;
            }
            int useTotal;
            int useCurrent;

            if (total > int.MaxValue)
            {
                useTotal   = (int)(total / 0x10000);
                useCurrent = (int)(current / 0x10000);
            }
            else
            {
                useTotal   = (int)total;
                useCurrent = (int)current;
            }
            if (progressBar1.Maximum != useTotal)
            {
                progressBar1.Maximum = useTotal;
            }
            if (progressBar1.Value != useCurrent)
            {
                progressBar1.Value = useCurrent;
            }
            if (progressBar1.Visible == false && progressBar1.Maximum > 0)
            {
                progressBar1.Visible = true;
            }
            if (subTotal > -1)
            {
                if (progressBar2.Maximum != subTotal)
                {
                    progressBar2.Maximum = subTotal;
                }
                progressBar2.Value = subCurrent;
                if (progressBar2.Visible == false && progressBar2.Maximum > 0)
                {
                    progressBar2.Visible = true;
                }
            }
            else
            {
                progressBar2.Visible = false;
            }

            if (taskHwnd == null)
            {
                taskHwnd = Windows7Taskbar.GetTaskBarForm(this);
            }

            if (taskHwnd.Value != IntPtr.Zero)
            {
                Windows7Taskbar.SetProgressValue(taskHwnd.Value, (uint)current, (uint)total);
            }
        }