Ejemplo n.º 1
0
Archivo: seems.cs Proyecto: zrolfs/pwiz
        public void Manager_LoadDataSourceProgress(Manager sender, string status, int percentage, CancelEventArgs e)
        {
            if (toolStrip1.InvokeRequired)
            {
                LoadDataSourceProgressEventHandler d = new LoadDataSourceProgressEventHandler(Manager_LoadDataSourceProgress);
                Invoke(d, new object[] { sender, status, percentage, e });
            }
            else
            {
                if (toolStrip1.IsDisposed)
                {
                    e.Cancel = true;
                    return;
                }

                if (status.Length > 0)
                {
                    toolStripStatusLabel1.Text    = status;
                    toolStripStatusLabel1.Visible = true;
                }
                else
                {
                    toolStripStatusLabel1.Visible = false;
                }

                switch (percentage)
                {
                case 100:
                    toolStripProgressBar1.Visible = false;
                    break;

                default:
                    toolStripProgressBar1.Visible = true;
                    toolStripProgressBar1.Minimum = 0;
                    toolStripProgressBar1.Maximum = 100;
                    toolStripProgressBar1.Value   = percentage;
                    break;
                }

                toolStrip1.Refresh();
            }
        }
Ejemplo n.º 2
0
        public void Manager_LoadDataSourceProgress (Manager sender, string status, int percentage, CancelEventArgs e)
        {
            if (toolStrip1.InvokeRequired)
            {
                LoadDataSourceProgressEventHandler d = new LoadDataSourceProgressEventHandler(Manager_LoadDataSourceProgress);
                Invoke(d, new object[] { sender, status, percentage, e });
            }
            else
            {
                if (toolStrip1.IsDisposed)
                {
                    e.Cancel = true;
                    return;
                }

                if (status.Length > 0)
                {
                    toolStripStatusLabel1.Text = status;
                    toolStripStatusLabel1.Visible = true;
                }
                else
                    toolStripStatusLabel1.Visible = false;

                switch (percentage)
                {
                    case 100:
                        toolStripProgressBar1.Visible = false;
                        break;
                    default:
                        toolStripProgressBar1.Visible = true;
                        toolStripProgressBar1.Minimum = 0;
                        toolStripProgressBar1.Maximum = 100;
                        toolStripProgressBar1.Value = percentage;
                        break;
                }

                toolStrip1.Refresh();
            }
        }