Пример #1
0
	public MainForm ()
	{
		// 
		// _statusStrip
		// 
		_statusStrip = new StatusStrip ();
		Controls.Add (_statusStrip);
		// 
		// _progressBar
		// 
		_progressBar = new ToolStripProgressBar ();
		_statusStrip.Items.Add (_progressBar);
		// 
		// _statusLabel
		// 
		_statusLabel = new ToolStripStatusLabel ("Begin");
		_statusStrip.Items.Add (_statusLabel);
		// 
		// _startButton
		// 
		_startButton = new ToolStripButton ();
		_startButton.Text = "Start";
		_startButton.Click += new EventHandler (StartButton_Click);
		_statusStrip.Items.Insert (0, _startButton);
		// 
		// MainForm
		// 
		ClientSize = new Size (300, 60);
		Location = new Point (250, 100);
		StartPosition = FormStartPosition.Manual;
		Text = "bug #82481";
		Load += new EventHandler (MainForm_Load);
	}
Пример #2
0
    public StatusStripExam()
    {
        this.Text = "StatusStrip 예제";

        ImageList imglst = new ImageList();
        imglst.TransparentColor = Color.Black;
        imglst.Images.Add("Color", new Bitmap(GetType(), "StatusStripExam.ColorHS.BMP"));
        imglst.Images.Add("Comment", new Bitmap(GetType(), "StatusStripExam.CommentHS.bmp"));

        StatusStrip status = new StatusStrip();
        status.Parent = this;
        status.ImageList = imglst;

        color_btn = new ToolStripButton();
        color_btn.Image = imglst.Images[0];
        color_btn.Click += EventProc;
        status.Items.Add(color_btn);

        comment_btn = new ToolStripButton();
        comment_btn.ImageKey = "Comment";
        comment_btn.Click += EventProc;
        status.Items.Add(comment_btn);

        // 메뉴 구분선 넣기
        ToolStripSeparator item_sep = new ToolStripSeparator();
        status.Items.Add(item_sep);

        txt_box = new ToolStripComboBox();
        txt_box.ToolTipText = "글꼴 선택";
        txt_box.Text = "글꼴 선택";
        txt_box.Items.Add("궁서체");
        txt_box.Items.Add("돋움체");
        txt_box.Items.Add("바탕체");
        status.Items.Add(txt_box);

        label = new ToolStripLabel();
        label.Size = new Size(100, 10);
        status.Items.Add(label);

        // 프로그래스바 설정
        prog_bar = new ToolStripProgressBar();

        prog_bar.Size = new Size(100, 10);
        prog_bar.Maximum = 100;
        prog_bar.Minimum = 0;
        status.Items.Add(prog_bar);

        Timer timer = new Timer();
        timer.Tick += new EventHandler(TimerProc);
        timer.Interval = 1000;
        timer.Start();
    }
Пример #3
0
        /// <summary>
        /// Notify item progress maximum has been changed
        /// </summary>
        /// <param name="item">target item</param>
        internal int OnProgressItemMaximumChanged(TrayMenuProgressItem item)
        {
            ToolStripProgressBar targetStrip = Find(item) as ToolStripProgressBar;

            if (null != targetStrip)
            {
                try
                {
                    targetStrip.Maximum = item.Maximum;
                }
                catch
                {
                    ;
                }
            }
            return(targetStrip.Maximum);
        }
Пример #4
0
        public void LoadGOONS(ToolStripProgressBar pb)
        {
            try
            {
                using (WebClient client = new WebClient())
                {
                    for (char c = 'A'; c <= 'Z'; c++)
                    {
                        string filename = Path.GetTempFileName();
                        string website  = "http://www.one-name.org/index_" + c.ToString() + ".html";
                        client.DownloadFile(website, filename);

                        HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
                        doc.Load(filename);
                        HtmlNode table = doc.DocumentNode.SelectSingleNode("//table");

                        List <HtmlNode> nodes = table.Descendants("a").ToList();
                        foreach (HtmlNode node in nodes)
                        {
                            string       surname = node.InnerText.Trim();
                            SurnameStats stat    = surnames.Find(x => x.Surname.Equals(surname));
                            if (stat != null)
                            {
                                stat.URI = new Uri("http://www.one-name.org" + node.GetAttributeValue("href", ""));
                            }
                        }
                        // now add links for those that are on GOONS but as a default page
                        nodes = table.Descendants("td").ToList();
                        foreach (HtmlNode node in nodes)
                        {
                            string       surname = node.InnerText.Trim();
                            SurnameStats stat    = surnames.Find(x => x.Surname.Equals(surname));
                            if (stat != null && stat.URI == null)
                            {
                                stat.URI = new Uri(website);
                            }
                        }
                        pb.Value += 10;
                        Application.DoEvents();
                    }
                }
            }
            catch (Exception)
            { // silently fail
            }
        }
Пример #5
0
 // ********************************************************************
 /// <summary>
 /// Generic routine to show progress in a number of different controls
 /// </summary>
 /// <param name="c">Control to use</param>
 /// <param name="min">minimum value</param>
 /// <param name="max">maximum value</param>
 /// <param name="value">progress value</param>
 public static void ShowProgress(ToolStripItem c, int min, int max, int value)
 {
     try
     {
         if (c is ToolStripProgressBar)
         {
             ToolStripProgressBar p = c as ToolStripProgressBar;
             p.Minimum = min;
             p.Maximum = max;
             p.Value   = value;
         }
     }
     catch (Exception e)
     {
         throw new NeoException("Error in progress update", e);
     }
 }
Пример #6
0
        /// <summary>
        /// Notify item progress value has been changed
        /// </summary>
        /// <param name="item">target item</param>
        internal int OnProgressItemValueChanged(TrayMenuProgressItem item)
        {
            ToolStripProgressBar targetStrip = Find(item) as ToolStripProgressBar;

            if (null != targetStrip)
            {
                try
                {
                    targetStrip.Value = item.Value;
                }
                catch
                {
                    ;
                }
            }
            return(targetStrip.Value);
        }
Пример #7
0
 /// <summary>
 /// Sets the progress bar value, without using 'Windows Aero' animation.
 /// This is to work around a known WinForms issue where the progress bar
 /// is slow to update.
 /// </summary>
 public static void SetProgressNoAnimation(this ToolStripProgressBar pb, int value)
 {
     // To get around the progressive animation, we need to move the
     // progress bar backwards.
     if (value == pb.Maximum)
     {
         // Special case as value can't be set greater than Maximum.
         pb.Maximum = value + 1;     // Temporarily Increase Maximum
         pb.Value   = value + 1;     // Move past
         pb.Maximum = value;         // Reset maximum
     }
     else
     {
         pb.Value = value + 1;       // Move past
     }
     pb.Value = value;               // Move to correct value
 }
Пример #8
0
        public void SetControls(ToolStripStatusLabel sbText, ToolStripProgressBar pbProgress)
        {
            m_sbText     = sbText;
            m_pbProgress = pbProgress;

            if (m_pbProgress != null)
            {
                if (m_pbProgress.Minimum != 0)
                {
                    m_pbProgress.Minimum = 0;
                }
                if (m_pbProgress.Maximum != 100)
                {
                    m_pbProgress.Maximum = 100;
                }
            }
        }
Пример #9
0
        public LoginWorker(Account account, CustomHttpClient client, HtmlReader htmlReader, WebBrowser webBrowser, ToolStripStatusLabel progressLabel, ToolStripProgressBar progressBar)
        {
            PlayerAccount = account;
            Client        = client;
            HtmlReader    = htmlReader;

            WebBrowser    = webBrowser;
            ProgressLabel = progressLabel;
            ProgressBar   = progressBar;

            Worker = new BackgroundWorker();
            Worker.WorkerReportsProgress = true;

            Worker.DoWork             += ExecuteWork;
            Worker.ProgressChanged    += ProgressChanged;
            Worker.RunWorkerCompleted += Completed;
        }
Пример #10
0
        public EditCount(Form f, Count_tab_Untity count, DataGridView datagridview, ToolStripProgressBar pshouru, ToolStripProgressBar pzhichu, ToolStripLabel lab, Label shouru, Label zhichu, Label zongjine, Label jingshouru, string flag)
        {
            InitializeComponent();
            SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.SupportsTransparentBackColor, true);

            this.f            = f;
            this.datagridview = datagridview;
            this.pshouru      = pshouru;
            this.pzhichu      = pzhichu;
            this.lab          = lab;
            this.shouru       = shouru;
            this.zhichu       = zhichu;
            this.zongjine     = zongjine;
            this.jingshouru   = jingshouru;
            this.flag         = flag;
            this.count        = count;
        }
Пример #11
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="laFormaPrincipal">La Forma principal.</param>
        /// <param name="elComponenteDelTextoDeEstatus">El componente del Texto de Estatus.</param>
        /// <param name="elComponenteDeLaBarraDeProgreso">El componente de la Barra de Progreso.</param>
        /// <param name="elComponenteDelTextoDeCoordenadas">El componente del Texto de Coordenadas.</param>
        public EscuchadorDeEstatus(
            Form laFormaPrincipal,
            ToolStripStatusLabel elComponenteDelTextoDeEstatus,
            ToolStripProgressBar elComponenteDeLaBarraDeProgreso,
            ToolStripStatusLabel elComponenteDelTextoDeCoordenadas)
        {
            miFormaPrincipal = laFormaPrincipal;
            miTextoInicialDeLaFormaPrincipal = miFormaPrincipal.Text;
            miTextoDeEstatus     = elComponenteDelTextoDeEstatus;
            miBarraDeProgreso    = elComponenteDeLaBarraDeProgreso;
            miTextoDeCoordenadas = elComponenteDelTextoDeCoordenadas;

            // Siempre el progreso empieza en zero.
            miBarraDeProgreso.Minimum = 0;

            // Desabilitar la barra de progreso al comienzo.
            miBarraDeProgreso.Enabled = false;
        }
Пример #12
0
 private void SetProgressBarParams(ToolStripProgressBar pb, int minimum, int maximum, int step)
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (statusStrip1.InvokeRequired)
     {
         SetProgressBarParamsCallback d = new SetProgressBarParamsCallback(SetProgressBarParams);
         statusStrip1.BeginInvoke(d, new object[] { pb, minimum, maximum, step });
     }
     else
     {
         ProgressBarFillTimes = 0;
         pb.Minimum           = minimum;
         pb.Maximum           = maximum;
         pb.Step = step;
     }
 }
Пример #13
0
        void UpdateProgBar(ToolStripProgressBar progBar, int progress)
        {
            if (InvokeRequired)
            {
                Invoke((o, args) => UpdateProgBar(progBar, progress));
                return;
            }

            if (progress > 0)
            {
                progBar.Style = ProgressBarStyle.Blocks;
                progBar.Value = progress;
            }
            else
            {
                progBar.Style = ProgressBarStyle.Marquee;
            }
        }
Пример #14
0
        private void btnImportar_Click(object sender, EventArgs e)
        {
            lblStripImportar = new ToolStripLabel();
            BarraProgresso   = new ToolStripProgressBar();
            arquivo          = Arquivo();

            if (arquivo != "cancelado")
            {
                bgwImportaExcel.RunWorkerAsync(arquivo);

                lblStripImportar.Text = "Importando Planilha:";
                frmPrincipal.statusStrip1.Items.Add(lblStripImportar);

                BarraProgresso.Style = ProgressBarStyle.Marquee;
                BarraProgresso.MarqueeAnimationSpeed = 4;
                frmPrincipal.statusStrip1.Items.Add(BarraProgresso);
            }
        }
Пример #15
0
        public void Constructor()
        {
            ToolStripProgressBar tsi = new ToolStripProgressBar();

            Assert.AreEqual(100, tsi.MarqueeAnimationSpeed, "A1");
            Assert.AreEqual(100, tsi.Maximum, "A2");
            Assert.AreEqual(0, tsi.Minimum, "A3");
            Assert.AreEqual("System.Windows.Forms.ProgressBar", tsi.ProgressBar.GetType().ToString(), "A4");
            Assert.AreEqual(false, tsi.RightToLeftLayout, "A5");
            Assert.AreEqual(10, tsi.Step, "A6");
            Assert.AreEqual(ProgressBarStyle.Blocks, tsi.Style, "A7");
            Assert.AreEqual(string.Empty, tsi.Text, "A8");
            Assert.AreEqual(0, tsi.Value, "A9");

            tsi = new ToolStripProgressBar("Bob");
            Assert.AreEqual("Bob", tsi.Name, "A10");
            Assert.AreEqual(string.Empty, tsi.Control.Name, "A11");
        }
        public static void ForceUnpackNarcs(List <int> IDs, ToolStripProgressBar progress)
        {
            string[] narcPaths         = RomInfo.narcPaths;
            string[] extractedNarcDirs = RomInfo.extractedNarcDirs;

            foreach (int id in IDs)
            {
                var tuple = Tuple.Create(narcPaths[id], extractedNarcDirs[id]);
                Narc.Open(workDir + tuple.Item1).ExtractToFolder(tuple.Item2);

                if (progress != null)
                {
                    try {
                        progress.Value++;
                    } catch (ArgumentOutOfRangeException) { }
                }
            }
        }
Пример #17
0
        public static void ForceUnpackNarcs(List <int> IDs, ToolStripProgressBar progress)
        {
            string[] narcPaths         = RomInfo.narcPaths;
            string[] extractedNarcDirs = RomInfo.extractedNarcDirs;

            foreach (int id in IDs)
            {
                (string pathToPacked, string pathToExtracted) = (narcPaths[id], extractedNarcDirs[id]);
                Narc.Open(RomInfo.workDir + pathToPacked).ExtractToFolder(pathToExtracted);

                if (progress != null)
                {
                    try {
                        progress.Value++;
                    } catch (ArgumentOutOfRangeException) { }
                }
            }
        }
Пример #18
0
        internal static bool SaveFileOnDropbox(Form1 form1, Form form, String fileName, String directoryName)
        {
            XtraTabControl       pagesTabControl      = form1.pagesTabControl;
            ToolStripStatusLabel toolStripStatusLabel = form1.toolStripStatusLabel;
            ToolStripProgressBar toolStripProgressBar = form1.toolStripProgressBar;

            ICloudDirectoryEntry directory = DropboxManager.GetDirectory(form1, directoryName);

            try
            {
                Application.DoEvents();
                toolStripProgressBar.Value   = 0;
                toolStripProgressBar.Visible = true;
                toolStripProgressBar.PerformStep();

                if (DropboxManager.ExistsChildOnDropbox(directory, fileName))
                {
                    if (WindowManager.ShowQuestionBox(form, LanguageUtil.GetCurrentLanguageString("OverwriteFileOnDropbox", className)) != DialogResult.Yes)
                    {
                        return(false);
                    }
                }

                //Encoding fileEncoding = TabUtil.GetTabTextEncoding(pagesTabControl.SelectedTabPage);
                toolStripProgressBar.PerformStep();

                DropboxManager.SaveFileOnDropbox(form1, directory, fileName, ProgramUtil.GetPageTextBox(pagesTabControl.SelectedTabPage).Text); //, fileEncoding);
                toolStripProgressBar.PerformStep();

                form1.LastDropboxFolder   = directoryName;
                toolStripStatusLabel.Text = String.Format("{0} \"{1}\" {2}", LanguageUtil.GetCurrentLanguageString("File", className), Path.GetFileName(fileName), LanguageUtil.GetCurrentLanguageString("SavedOnDropbox", className));
                toolStripProgressBar.PerformStep();

                toolStripProgressBar.Visible = false;
            }
            catch (Exception exception)
            {
                toolStripProgressBar.Visible = false;
                WindowManager.ShowErrorBox(form, exception.Message, exception);
                return(false);
            }

            return(true);
        }
Пример #19
0
        private void KartForm_Load(object sender, EventArgs e)
        {
            ((MainForm)this.MdiParent).statusStrip.Items.Clear();

            toolStripProgressBar         = new ToolStripProgressBar();
            toolStripProgressBar.Enabled = false;
            toolStripStatusLabel         = new ToolStripStatusLabel();
            ((MainForm)this.MdiParent).statusStrip.Items.Add(toolStripProgressBar);
            ((MainForm)this.MdiParent).statusStrip.Items.Add(toolStripStatusLabel);

            backgroundWorker = new BackgroundWorker();
            backgroundWorker.WorkerReportsProgress = true;
            backgroundWorker.DoWork             += new DoWorkEventHandler(backgroundWorker1_DoWork);
            backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(backgroundWorker1_RunWorkerCompleted);
            backgroundWorker.ProgressChanged    += new ProgressChangedEventHandler(backgroundWorker1_ProgressChanged);

            toolStripProgressBar.Enabled = true;
            backgroundWorker.RunWorkerAsync();
        }
        /// <summary>
        /// Sets the progress bar value, without using Windows Aero animation.
        /// </summary>
        /// <remarks>This is kind of a hack, but it works.</remarks>
        public static void SetProgressNoAnimation(this ToolStripProgressBar pb, int value)
        {
            // To get around this animation, we need to move the progress bar backwards.
            if (value == pb.Maximum)
            {
                // Special case (can't set value > Maximum).
                // Set the value THEN move it backwards one.
                pb.Value = value;
                pb.Value = value - 1;
            }
            else
            {
                // Move past
                pb.Value = value + 1;
            }

            // Move to correct value
            pb.Value = value;
        }
Пример #21
0
        public void WorkerStart(BackgroundWorker backgroundWorker, ToolStripProgressBar progressBar, ToolStripLabel label, string path, List <Anime> animeList, TextBox AnimeListBox, CheckedListBox checkedListBox1, TextBox AnimeInfoBox)
        {
            methods.Logger("Inicjacja workera", null);
            this.backgroundWorker = backgroundWorker;
            this.progressBar      = progressBar;
            this.label            = label;
            this.path             = path;
            this.animeList        = animeList;
            this.AnimeListBox     = AnimeListBox;
            this.checkedListBox1  = checkedListBox1;
            this.AnimeInfoBox     = AnimeInfoBox;

            this.label.Text = "Zajęty...";
            string[] files = Directory.GetFiles(this.path, "*.mp3", SearchOption.AllDirectories);
            methods.Logger("Obliczono liczbę plików mp3 w folderze", files.Length.ToString());
            this.progressBar.Maximum = files.Length;
            this.progressBar.Value   = 0;
            this.backgroundWorker.RunWorkerAsync();
        }
Пример #22
0
 public Form2()
 {
     InitializeComponent();
     datelabe1             = new ToolStripLabel();
     timelabe1             = new ToolStripLabel();
     infolabe1             = new ToolStripLabel();
     toolStripProgressBar2 = new ToolStripProgressBar();
     infolabe1.Text        = "текущая дата и время";
     statusStrip1.Items.Add(datelabe1);
     statusStrip1.Items.Add(timelabe1);
     statusStrip1.Items.Add(infolabe1);
     statusStrip1.Items.Add(toolStripProgressBar2);
     Timer = new Timer()
     {
         Interval = 10
     };
     Timer.Tick += Timer_Tick;
     Timer.Start();
 }
Пример #23
0
        private void InitializeComponent()
        {
            ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(ucMeisteSRAIs));

            this.toolStripTop             = new ToolStrip();
            this.toolStripButtonRefresh   = new ToolStripButton();
            this.toolStripProgressBar     = new ToolStripProgressBar();
            this.dataGridViewBesteSRAIs   = new DataGridView();
            this.categoryCollectionLister = new CategoryCollectionLister();
            this.toolStripTop.SuspendLayout();
            ((ISupportInitialize)this.dataGridViewBesteSRAIs).BeginInit();
            this.SuspendLayout();
            this.toolStripTop.Items.AddRange(new ToolStripItem[2]
            {
                (ToolStripItem)this.toolStripButtonRefresh,
                (ToolStripItem)this.toolStripProgressBar
            });
            componentResourceManager.ApplyResources((object)this.toolStripTop, "toolStripTop");
            this.toolStripTop.Name            = "toolStripTop";
            this.toolStripButtonRefresh.Image = (Image)Resources.sync;
            componentResourceManager.ApplyResources((object)this.toolStripButtonRefresh, "toolStripButtonRefresh");
            this.toolStripButtonRefresh.Name   = "toolStripButtonRefresh";
            this.toolStripButtonRefresh.Click += new EventHandler(this.toolStripButtonRefresh_Click);
            this.toolStripProgressBar.Name     = "toolStripProgressBar";
            componentResourceManager.ApplyResources((object)this.toolStripProgressBar, "toolStripProgressBar");
            this.dataGridViewBesteSRAIs.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            componentResourceManager.ApplyResources((object)this.dataGridViewBesteSRAIs, "dataGridViewBesteSRAIs");
            this.dataGridViewBesteSRAIs.Name = "dataGridViewBesteSRAIs";
            componentResourceManager.ApplyResources((object)this.categoryCollectionLister, "categoryCollectionLister");
            this.categoryCollectionLister.Name = "categoryCollectionLister";
            componentResourceManager.ApplyResources((object)this, "$this");
            this.AutoScaleMode = AutoScaleMode.Font;
            this.Controls.Add((Control)this.categoryCollectionLister);
            this.Controls.Add((Control)this.dataGridViewBesteSRAIs);
            this.Controls.Add((Control)this.toolStripTop);
            this.Name  = nameof(ucMeisteSRAIs);
            this.Load += new EventHandler(this.ucBesteSRAIZiele_Load);
            this.toolStripTop.ResumeLayout(false);
            this.toolStripTop.PerformLayout();
            ((ISupportInitialize)this.dataGridViewBesteSRAIs).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="StatusBarToProgressToggler"/> class.
        /// </summary>
        /// <param name="statusStripToToggle">The StatusStrip to toggle.</param>
        /// <param name="panelToDisable">The (optional) Panel to disable.</param>
        public StatusBarToProgressToggler(
            StatusStrip statusStripToToggle, Panel panelToDisable)
        {
            if (statusStripToToggle == null)
            {
                throw new ArgumentNullException("statusStripToToggle",
                                                "The reference to the status-bar to be toggled should not be null");
            }

            m_statusProgressBar = new ToolStripProgressBar();

            // set the default values for the properties
            this.ProgressBarHeight      = 15;
            this.ProgressBarWidthExtent = 2.0 / 3.0;
            this.ProgressBarStyle       = ProgressBarStyle.Marquee;

            m_statusStrip    = statusStripToToggle;
            m_panelToDisable = panelToDisable;
        }
Пример #25
0
        public void SetControls(ToolStripStatusLabel sbText, ToolStripProgressBar pbProgress)
        {
            Debug.Assert(!m_bActive);

            m_sbText = sbText;

            m_pbProgress = pbProgress;
            if (pbProgress != null)
            {
                if (pbProgress.Minimum != 0)
                {
                    pbProgress.Minimum = 0;
                }
                if (pbProgress.Maximum != 100)
                {
                    pbProgress.Maximum = 100;
                }
            }
        }
Пример #26
0
 private static void SetProgress(ref ToolStripProgressBar pbar, int value)
 {
     if (pbar == null)
     {
         return;
     }
     if (value > pbar.Maximum)
     {
         pbar.Value = pbar.Maximum;
     }
     else if (value < pbar.Minimum)
     {
         pbar.Value = pbar.Minimum;
     }
     else
     {
         pbar.Value = value;
     }
 }
Пример #27
0
        void AddTaskStatusBar(Task task)
        {
            if (InvokeRequired)
            {
                Invoke((o, args) => AddTaskStatusBar(task));
                return;
            }

            // Status strip
            StatusStrip taskStatusStrip = new StatusStrip();

            statusStrips[task.TaskID] = taskStatusStrip;
            taskStatusStrip.Anchor    = AnchorStyles.Top | AnchorStyles.Left |
                                        AnchorStyles.Right;
            taskStatusStrip.AutoSize    = true;
            taskStatusStrip.LayoutStyle = ToolStripLayoutStyle.HorizontalStackWithOverflow;
            taskStatusStrip.SizingGrip  = false;

            // Status label
            ToolStripStatusLabel statusLabel = new ToolStripStatusLabel(task.Status);

            statusLabel.Name     = "status";
            statusLabel.AutoSize = true;
            task.StatusChange   += (o, args) => UpdateStatusLabel(statusLabel, args.Status);
            statusLabel.Text     = task.Status;
            statusLabel.Visible  = true;
            taskStatusStrip.Items.Add(statusLabel);

            // Progress bar
            ToolStripProgressBar progBar = new ToolStripProgressBar("progress");

            progBar.Alignment    = ToolStripItemAlignment.Right;
            progBar.Size         = new Size(100, 16);
            task.ProgressChange += (o, args) => UpdateProgBar(progBar, args.Progress);
            UpdateProgBar(progBar, task.Progress);
            progBar.Visible = true;
            taskStatusStrip.Items.Add(progBar);

            // Add the status bar
            toolStripContainer.BottomToolStripPanel.Controls.Add(taskStatusStrip);
            taskStatusStrip.Visible = true;
        }
 private void InitializeComponent()
 {
     this.statusStrip          = new System.Windows.Forms.StatusStrip();
     this.toolStripProgressBar = new System.Windows.Forms.ToolStripProgressBar();
     this.toolStripStatusLabel = new System.Windows.Forms.ToolStripStatusLabel();
     this.statusStrip.SuspendLayout();
     this.SuspendLayout();
     //
     // statusStrip
     //
     this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
         this.toolStripProgressBar,
         this.toolStripStatusLabel
     });
     this.statusStrip.Location = new System.Drawing.Point(0, 242);
     this.statusStrip.Name     = "statusStrip";
     this.statusStrip.Size     = new System.Drawing.Size(284, 22);
     this.statusStrip.TabIndex = 11;
     this.statusStrip.Text     = "statusStrip";
     //
     // toolStripProgressBar
     //
     this.toolStripProgressBar.Name    = "toolStripProgressBar";
     this.toolStripProgressBar.Size    = new System.Drawing.Size(100, 16);
     this.toolStripProgressBar.Visible = false;
     //
     // toolStripStatusLabel
     //
     this.toolStripStatusLabel.Name     = "toolStripStatusLabel";
     this.toolStripStatusLabel.Overflow = System.Windows.Forms.ToolStripItemOverflow.Always;
     this.toolStripStatusLabel.Size     = new System.Drawing.Size(0, 17);
     //
     // FormWithStatusDisplay
     //
     this.ClientSize = new System.Drawing.Size(284, 264);
     this.Controls.Add(this.statusStrip);
     this.Name = "FormWithStatusDisplay";
     this.statusStrip.ResumeLayout(false);
     this.statusStrip.PerformLayout();
     this.ResumeLayout(false);
     this.PerformLayout();
 }
        // note that AsyncScan is Scan implemented through a backgroundWorker so as not to hang the program
        // can we add a progress bar here??? try it...
        public int AsyncScan(ref ToolStripProgressBar progressBar, ref ToolStripStatusLabel statusLabelPercentCompleted,
                             ref BackgroundWorker bw, ref PNA analyzer, ref DataDisplay dataDisplay)
        {
            int i = 0, i_xy = 0, i_z = 0;

            progressBar.Minimum   = 0;
            progressBar.Maximum   = this.probePoints.Count * this.probeZPoints.Count;
            progressBar.Visible   = true;
            progressBar.ForeColor = Color.DarkRed; // try to change the progressbar colour
            for (i_xy = 0; i_xy < this.probePoints.Count; i_xy++)
            {
                for (i_z = 0; i_z < this.probeZPoints.Count; i_z++)
                {
                    i = i_xy * this.probeZPoints.Count + i_z;
                    progressBar.Value = i;
                    progressBar.Invalidate();
                    statusLabelPercentCompleted.Text = String.Format("{0}%", (progressBar.Value * 100) / progressBar.Maximum);
                    if (bw.CancellationPending)
                    {
                        progressBar.Visible = false;
                        statusLabelPercentCompleted.Text = "";
                        return(0);
                    }
                    dataDisplay.SetActivePoint(i_xy);
                    PointF point  = this.probePoints[i_xy];
                    float  zpoint = this.probeZPoints[i_z];
                    Translator.Move((decimal)point.X, (decimal)point.Y, (decimal)zpoint);
                    DataPoint dbpt = new DataPoint(analyzer.Points);
                    // Let the probe settle
                    Thread.Sleep(200);
                    dbpt.Data      = analyzer.Measure();
                    dbpt.Location  = this.probePoints[i_xy];
                    dbpt.LocationZ = this.probeZPoints[i_z];
                    dbpt.Index     = i;
                    dataPoints.Add(dbpt);
                }
            }
            dataDisplay.SetActivePoint(-1);
            progressBar.Visible = false;
            statusLabelPercentCompleted.Text = "";
            return(1);
        }
Пример #30
0
                protected override void Dispose(bool disposing)
                {
                    if (!_disposed)
                    {
                        if (_label != null)
                        {
                            _label.Owner.Items.Remove(_label);
                            _label = null;
                        }
                        if (_progressBar != null)
                        {
                            _progressBar.Owner.Items.Remove(_progressBar);
                            _progressBar = null;
                        }

                        _disposed = true;
                    }

                    base.Dispose(disposing);
                }
Пример #31
0
        public int DeepMatchListViews(ListView lvFilesLeft, ListView lvFilesRight, ToolStripProgressBar pbProgres, ComboBox cbRegexes)
        {
            int matchCounter = 0;

            pbProgres.Value = 0;
            LogUtils.AddLogTextLine("Deep matching operation started.");

            RenameUtils.ClearMathingLeftRight(lvFilesLeft, lvFilesRight);

            foreach (var item in cbRegexes.Items)
            {
                string regex = item.GetType().GetProperty("Value").GetValue(item, null).ToString();
                matchCounter += AutoMatchListViews(lvFilesLeft, lvFilesRight, pbProgres, true, regex, true, false);
            }

            matchCounter += AutoMatchListViews(lvFilesLeft, lvFilesRight, pbProgres, false, "", true, false);

            pbProgres.Value = 100;
            return(matchCounter);
        }
Пример #32
0
        /// <summary>
        /// Update the ToolStripProgressBar with the status report
        /// </summary>
        /// <remarks>Run this method in the context of the GUI's thread</remarks>
        /// <param name="control"></param>
        /// <param name="sr"></param>
        public static void UpdateStatusReport(/*this*/ ToolStripProgressBar control, StatusReport sr)
        {
            if (control == null)
            {
                return;
            }

            if (!sr.IsProgressBarInitialized && sr.Min >= 0 && sr.Max >= 0)
            {
                sr.IsProgressBarInitialized = true;
                control.Minimum             = sr.Min;
                control.Maximum             = sr.Max;
                control.Value   = sr.Value;
                control.Visible = true;
            }
            if (sr.Value >= 0)
            {
                control.Value = sr.Value;
            }
        }
Пример #33
0
    private void setupStatusStrip()
    {
        statusStrip = new StatusStrip();

        ToolStripStatusLabel statusLabel = new ToolStripStatusLabel();
        statusLabel.Text = "Well?";

        ToolStripProgressBar progressBar = new ToolStripProgressBar();
        progressBar.Maximum = 100;
        progressBar.Value = 50;

        //statusStrip.Items.Add(statusLabel);
        statusStrip.Items.AddRange(new ToolStripStatusLabel[] { statusLabel });
        statusStrip.Items.AddRange(new ToolStripProgressBar[] { progressBar });

        statusStrip.Text = "Status!";

        this.Controls.Add(statusStrip);
    }