public void FivePhase_ProgressesNormally() { var globalIndicator = new SimpleProgressIndicator(); var progress = new MultiPhaseProgressIndicator(globalIndicator , 5); progress.Initialize(); // phase 1 Assert.That(globalIndicator.Value, Is.EqualTo(0)); progress.PercentCompleted = 50; Assert.That(globalIndicator.Value, Is.EqualTo(10)); progress.Finish(); Assert.That(globalIndicator.PercentCompleted, Is.EqualTo(20)); progress.Initialize(); // phase 2 Assert.That(progress.PercentCompleted, Is.EqualTo(0)); Assert.That(globalIndicator.PercentCompleted, Is.EqualTo(20)); progress.PercentCompleted = 50; Assert.That(globalIndicator.PercentCompleted, Is.EqualTo(30)); progress.Finish(); Assert.That(progress.PercentCompleted, Is.EqualTo(100)); Assert.That(globalIndicator.PercentCompleted, Is.EqualTo(40)); progress.Initialize(); // phase 3 progress.Finish(); Assert.That(globalIndicator.PercentCompleted, Is.EqualTo(60)); progress.Initialize(); // phase 4 progress.PercentCompleted = 10; Assert.That(globalIndicator.PercentCompleted, Is.EqualTo(62)); progress.Finish(); progress.Initialize(); // phase 5 progress.Finish(); }
/// <summary> /// Make folder-browsing controls invisible, and add in some progress controls for the MakeClone procedure: /// </summary> private void SwitchControlsForCloning() { panel.Visible = false; progressBar.Visible = false; var logBox = new LogBox { Location = new Point(panel.Location.X, panel.Location.Y + 50), Width = panel.Width, Height = panel.Height - 50, Anchor = panel.Anchor, ShowCopyToClipboardMenuItem = true, ShowDetailsMenuItem = true, ShowDiagnosticsMenuItem = true, ShowFontMenuItem = true }; var progressIndicator = new SimpleProgressIndicator { Location = new Point(panel.Location.X, panel.Location.Y + 35), Width = panel.Width, Height = 10, Style = ProgressBarStyle.Marquee, Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top, MarqueeAnimationSpeed = 50 }; #if MONO progressIndicator.MarqueeAnimationSpeed = 3000; #else #endif progressIndicator.IndicateUnknownProgress(); _clonerStatusLabel = new TextBox { Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right, BackColor = SystemColors.Control, BorderStyle = BorderStyle.None, Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point, ((0))), Location = panel.Location, Multiline = true, Name = "_clonerStatusLabel", ReadOnly = true, Size = new Size(panel.Width, 25) }; Controls.Add(logBox); Controls.Add(progressIndicator); Controls.Add(_clonerStatusLabel); _clonerMultiProgess = new MultiProgress(); _clonerMultiProgess.AddMessageProgress(logBox); logBox.ProgressIndicator = progressIndicator; _clonerMultiProgess.ProgressIndicator = progressIndicator; _clonerStatusLabel.Text = string.Format(LocalizationManager.GetString("Messages.Getting", "Getting {0}..."), RepositoryKindLabel); }
/// <summary> /// Make folder-browsing controls invisible, and add in some progress controls for the MakeClone procedure: /// </summary> private void SwitchControlsForCloning() { panel.Visible = false; progressBar.Visible = false; var logBox = new LogBox { Location = new Point(panel.Location.X, panel.Location.Y + 50), Width = panel.Width, Height = panel.Height - 50, Anchor = panel.Anchor, ShowCopyToClipboardMenuItem = true, ShowDetailsMenuItem = true, ShowDiagnosticsMenuItem = true, ShowFontMenuItem = true }; var progressIndicator = new SimpleProgressIndicator { Location = new Point(panel.Location.X, panel.Location.Y + 35), Width = panel.Width, Height = 10, Style = ProgressBarStyle.Marquee, Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top, MarqueeAnimationSpeed = 50 }; #if MONO progressIndicator.MarqueeAnimationSpeed = 3000; #else #endif progressIndicator.IndicateUnknownProgress(); _clonerStatusLabel = new TextBox { Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right, BackColor = SystemColors.Control, BorderStyle = BorderStyle.None, Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point, ((0))), Location = panel.Location, Multiline = true, Name = "_clonerStatusLabel", ReadOnly = true, Size = new Size(panel.Width, 25) }; Controls.Add(logBox); Controls.Add(progressIndicator); Controls.Add(_clonerStatusLabel); _clonerMultiProgess = new MultiProgress(); _clonerMultiProgess.AddMessageProgress(logBox); logBox.ProgressIndicator = progressIndicator; _clonerMultiProgess.ProgressIndicator = progressIndicator; _clonerStatusLabel.Text = string.Format(LocalizationManager.GetString("Messages.Getting","Getting {0}..."),RepositoryKindLabel); }
/// <summary> /// Make folder-browsing controls invisible, and add in some progress controls for the MakeClone procedure: /// </summary> private void SwitchControlsForCloning() { panel.Visible = false; progressBar.Visible = false; var logBox = new LogBox(); logBox.Location = new Point(panel.Location.X, panel.Location.Y + 50); logBox.Width = panel.Width; logBox.Height = panel.Height - 50; logBox.Anchor = panel.Anchor; logBox.ShowCopyToClipboardMenuItem = true; logBox.ShowDetailsMenuItem = true; logBox.ShowDiagnosticsMenuItem = true; logBox.ShowFontMenuItem = true; var progressIndicator = new SimpleProgressIndicator(); progressIndicator.Location = new Point(panel.Location.X, panel.Location.Y + 35); progressIndicator.Width = panel.Width; progressIndicator.Height = 10; progressIndicator.Style = ProgressBarStyle.Marquee; progressIndicator.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top; #if MONO progressIndicator.MarqueeAnimationSpeed = 3000; #else progressIndicator.MarqueeAnimationSpeed = 50; #endif progressIndicator.IndicateUnknownProgress(); _clonerStatusLabel = new TextBox(); _clonerStatusLabel.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; _clonerStatusLabel.BackColor = SystemColors.Control; _clonerStatusLabel.BorderStyle = BorderStyle.None; _clonerStatusLabel.Font = new Font("Microsoft Sans Serif", 12F, FontStyle.Regular, GraphicsUnit.Point, ((0))); _clonerStatusLabel.Location = panel.Location; _clonerStatusLabel.Multiline = true; _clonerStatusLabel.Name = "_clonerStatusLabel"; _clonerStatusLabel.ReadOnly = true; _clonerStatusLabel.Size = new Size(panel.Width, 25); Controls.Add(logBox); Controls.Add(progressIndicator); Controls.Add(_clonerStatusLabel); _clonerMultiProgess = new MultiProgress(); _clonerMultiProgess.AddMessageProgress(logBox); logBox.ProgressIndicator = progressIndicator; _clonerMultiProgess.ProgressIndicator = progressIndicator; _clonerStatusLabel.Text = string.Format("Getting {0}...",RepositoryKindLabel); }