当前位置: 首页>>代码示例>>C#>>正文


C# ProgressBar.Refresh方法代码示例

本文整理汇总了C#中ProgressBar.Refresh方法的典型用法代码示例。如果您正苦于以下问题:C# ProgressBar.Refresh方法的具体用法?C# ProgressBar.Refresh怎么用?C# ProgressBar.Refresh使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ProgressBar的用法示例。


在下文中一共展示了ProgressBar.Refresh方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: should_still_update_progress_even_when_writing_lines_after_progress_bar

        public void should_still_update_progress_even_when_writing_lines_after_progress_bar()
        {
            var console = new MockConsole(40,10);
            console.WriteLine("line 1");
            var pb = new ProgressBar(10, console);
            pb.Refresh(0, "loading");
            console.WriteLine("line 2");
            pb.Refresh(1, "cats");
            console.WriteLine("line 3");
            pb.Refresh(10, "dogs");
            console.WriteLine("line 4");

            Console.WriteLine(console.Buffer);
            Console.WriteLine();
            Approvals.Verify(console.Buffer);
        }
开发者ID:goblinfactory,项目名称:progress-bar,代码行数:16,代码来源:ProgressBarAcceptanceTests.cs

示例2: refresh_should_show_progress_title_and_progress_bar

 public void refresh_should_show_progress_title_and_progress_bar()
 {
     var testoutput = new StringBuilder();
     var console = new MockConsole(80,20);
     var pb = new ProgressBar(10, console);
     
     for (int i = 1; i < 5; i++)
     {
         Console.WriteLine(" --- test " + i + "-----");
         pb.Refresh(i, "ITEM " + i);
         Console.WriteLine(console.Buffer);
         testoutput.AppendLine(console.Buffer);
     }
     Console.WriteLine();
     Approvals.Verify(testoutput.ToString());
 }
开发者ID:goblinfactory,项目名称:progress-bar,代码行数:16,代码来源:ProgressBarAcceptanceTests.cs

示例3: EditValue

        // Edit a Selected value.
        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            // Get the editor service.
            IWindowsFormsEditorService editor_service = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (editor_service == null)
                return value;

            ProgressBar Instance = new ProgressBar();
            if (object.ReferenceEquals(context.Instance.GetType(), typeof(ProgressBar))) {
                Instance = (ProgressBar)context.Instance;
            } else {
                Instance = ((ProgressBarActionList)context.Instance).CurrProgressBar;
            }

            FocalPointsDialog dlg = new FocalPointsDialog();

            // Prepare the editing dialog.
            var _with8 = dlg;
            float ratio = 0;
            int BarWidth = 0;
            int BarHeight = 0;
            if (Instance.BarType == ProgressBar.eBarType.CylonBar) {
                if (Instance.Orientation == ProgressBar.eOrientation.Horizontal) {
                    BarWidth = Instance.BarLengthValue;
                    BarHeight = Instance.Height;
                } else {
                    BarWidth = Instance.Width;
                    BarHeight = Instance.BarLengthValue;
                }
            } else {
                BarWidth = Instance.Width;
                BarHeight = Instance.Height;
            }


            if (BarWidth > BarHeight) {
                _with8.TheShape.Height = Convert.ToInt32(_with8.TheShape.Width * (BarHeight / BarWidth));
                _with8.TheShape.Top = Convert.ToInt32((_with8.panShapeHolder.Height - _with8.TheShape.Height) / 2);
                ratio = Convert.ToSingle(_with8.TheShape.Height / BarHeight);
            } else {
                _with8.TheShape.Width = Convert.ToInt32(_with8.TheShape.Height * (BarWidth / BarHeight));
                _with8.TheShape.Left = Convert.ToInt32((_with8.panShapeHolder.Width - _with8.TheShape.Width) / 2);
                ratio = Convert.ToSingle(_with8.TheShape.Width / BarWidth);
            }

            _with8.TheShape.Shape = Instance.Shape;
            _with8.TheShape.BarStyleFill = Instance.BarStyleFill;
            _with8.TheShape.BarStyleLinear = Instance.BarStyleLinear;
            _with8.TheShape.BarColorSolid = Instance.BarColorSolid;
            _with8.TheShape.BorderWidth = Instance.BorderWidth;
            _with8.TheShape.BorderColor = Instance.BorderColor;
            _with8.TheShape.BorderStyle = Instance.BorderStyle;
            _with8.TheShape.BarColorBlend = Instance.BarColorBlend;
            _with8.TheShape.Corners = new CornersProperty(Convert.ToInt16(Instance.Corners.LowerLeft * ratio), Convert.ToInt16(Instance.Corners.LowerRight * ratio), Convert.ToInt16(Instance.Corners.UpperLeft * ratio), Convert.ToInt16(Instance.Corners.UpperRight * ratio));
            _with8.TheShape.FocalPoints = new cFocalPoints(Instance.FocalPoints.CenterPoint, Instance.FocalPoints.FocusScales);

            // Display the dialog.
            editor_service.ShowDialog(dlg);
            Instance.Refresh();
            // Return the new value.
            return dlg.TheShape.FocalPoints;
        }
开发者ID:mlnlover11,项目名称:IExtendFramework,代码行数:63,代码来源:ProgressBar.cs


注:本文中的ProgressBar.Refresh方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。