Пример #1
0
        /// <summary>
        /// 重新调整布局
        /// </summary>
        /// <param name="style"></param>
        private void ReLayoutFrm(ProgressStyle style)
        {
            switch (style)
            {
            case ProgressStyle.SingleCancel:
                SingleProgessFrm();
                break;

            case ProgressStyle.SingleDetail:
                SingleDetailProgressFrm();
                break;

            case ProgressStyle.SingleNone:
                SingleNoneProgressFrm();
                break;

            case ProgressStyle.DoubleNone:
                DoubleNoneProgressFrm();
                break;

            case ProgressStyle.DoubleCancel:
                DoubleCancelProgressFrm();
                break;

            case ProgressStyle.DoubleDetail:
                DoubleDetailProgressFrm();
                break;
            }
        }
Пример #2
0
 public static void PrintProgressBar(ProgressStyle style, uint width, int xCoord, uint yCoord, int value, bool indeterminate = false)
 {
     try {
         if (value < 0 || (long)value >= (long)width)
         {
             return;
         }
         Coord         coordinates   = GetCoordinates(Console.CursorLeft, Console.CursorTop);
         int           num           = (int)width - 2 - value;
         StringBuilder stringBuilder = new StringBuilder().Append('[').Append((char)style, value);
         if (num > 0)
         {
             stringBuilder.Append(' ', (int)width - 2 - value);
         }
         stringBuilder.Append(']');
         if (xCoord < 0)
         {
             PrintCentre(stringBuilder.ToString(), (int)yCoord);
         }
         else
         {
             Print(xCoord, (int)yCoord, stringBuilder.ToString());
         }
         SetCursorPosition(coordinates);
     } catch {
     }
 }
Пример #3
0
        /// <summary>
        /// 进度条的默认范围为0-100
        /// </summary>
        /// <param name="title"></param>
        /// <param name="style"></param>
        public FrmProgressBar(string title, ProgressStyle style) : this()
        {
            this.Text  = title;
            this.style = style;

            ReLayoutFrm(style);
            handler = ChangeMainProgess;
        }
Пример #4
0
        private void CreateAttrElements()
        {
            ///////////////////////////////////////////////Create by attributes//////////////////////////////////////////////////////////
            board[2] = new TextLabel();
            board[2].WidthSpecification  = 380;
            board[2].HeightSpecification = 70;
            board[2].PointSize           = 20;
            board[2].HorizontalAlignment = HorizontalAlignment.Center;
            board[2].VerticalAlignment   = VerticalAlignment.Center;
            board[2].BackgroundColor     = Color.Magenta;
            board[2].Text = "Attribute construction";
            layout[3].Add(board[2]);
            board[2].Focusable    = true;
            board[2].FocusGained += Board_FocusGained;
            board[2].FocusLost   += Board_FocusLost;

            ProgressStyle attr = new ProgressStyle
            {
                Track = new ImageViewStyle
                {
                    BackgroundColor = new Selector <Color>
                    {
                        All = Color.Cyan
                    }
                },
                Progress = new ImageViewStyle
                {
                    BackgroundColor = new Selector <Color>
                    {
                        All = Color.Red
                    }
                },
                Buffer = new ImageViewStyle
                {
                    BackgroundColor = new Selector <Color>
                    {
                        All = Color.Green
                    }
                }
            };

            progressBar[2] = new Progress(attr);
            progressBar[2].WidthSpecification  = 240;
            progressBar[2].HeightSpecification = 4;
            progressBar[2].MaxValue            = 100;
            progressBar[2].MinValue            = 0;
            progressBar[2].CurrentValue        = 30;
            layout[3].Add(progressBar[2]);
        }
Пример #5
0
 /// <summary>
 /// Create a new progress bar
 /// </summary>
 /// <param name="parent">A parent object to pass events to</param>
 /// <param name="spriteBatch">A spritebatch used for drawing</param>
 /// <param name="content">A Contentmanager used for loading resources</param>
 /// <param name="displayRect">The area of the progress bar</param>
 /// <param name="style">The design of the progress bar</param>
 /// <param name="total">A maximum amount to be displayed on the progress bar</param>
 /// <param name="start">The start value</param>
 /// <param name="color">The color of the progress bar</param>
 public ProgressBar(Backend.IHandleEvent parent, SpriteBatch spriteBatch, ContentManager content, Rectangle displayRect, ProgressStyle style = ProgressStyle.Default, int total = 100, int start = 0)
     : base(parent, spriteBatch, content, displayRect)
 {
     this.total = total;
     _value = start;
     _style = style;
     _color = color;
     _background = _content.Load<Texture2D>("Minimap");
     _font = _content.Load<SpriteFont>("SmallFont");
     _fontHeight = (int)_font.MeasureString("1234567890").Y;
 }
Пример #6
0
 /// <summary>
 /// Constructor for Extended Bar
 /// </summary>
 /// <param name="m_Edge">The m edge.</param>
 /// <param name="m_EdgeColor">Color of the m edge.</param>
 /// <param name="m_EdgeLightColor">Color of the m edge light.</param>
 /// <param name="m_EdgeWidth">Width of the m edge.</param>
 /// <param name="m_FloodStyle">The m flood style.</param>
 /// <param name="m_float_BarFlood">The m float bar flood.</param>
 /// <param name="m_int_BarOffset">The m int bar offset.</param>
 /// <param name="m_int_DashWidth">Width of the m int dash.</param>
 /// <param name="m_int_DashSpace">The m int dash space.</param>
 /// <param name="m_Style">The m style.</param>
 /// <param name="m_Color1">The m color1.</param>
 /// <param name="m_Color2">The m color2.</param>
 /// <param name="m_color_Back">The m color back.</param>
 /// <param name="m_int_Step">The m int step.</param>
 /// <param name="m_bool_Shadow">if set to <c>true</c> [m bool shadow].</param>
 /// <param name="m_int_ShadowOffset">The m int shadow offset.</param>
 /// <param name="m_bool_Antialias">if set to <c>true</c> [m bool antialias].</param>
 /// <param name="m_color_Shadow">The m color shadow.</param>
 /// <param name="m_color_Caption">The m color caption.</param>
 /// <param name="m_CaptionMode">The m caption mode.</param>
 /// <param name="m_str_Caption">The m string caption.</param>
 /// <param name="m_bool_ChangeByMouse">if set to <c>true</c> [m bool change by mouse].</param>
 /// <param name="m_bool_Invert">if set to <c>true</c> [m bool invert].</param>
 /// <param name="m_Direction">The m direction.</param>
 /// <param name="m_int_Minimum">The m int minimum.</param>
 /// <param name="ExtendedProgress_interval">The extended progress interval.</param>
 public ProgressInput(
     //ProgressType progressType,
     //ProgressBar solidBars,
     ProgressBarEdge m_Edge,
     Color m_EdgeColor,
     Color m_EdgeLightColor,
     int m_EdgeWidth,
     ProgressFloodStyle m_FloodStyle,
     float m_float_BarFlood,
     int m_int_BarOffset,
     int m_int_DashWidth,
     int m_int_DashSpace,
     ProgressStyle m_Style,
     Color m_Color1,
     Color m_Color2,
     Color m_color_Back,
     int m_int_Step,
     bool m_bool_Shadow,
     int m_int_ShadowOffset,
     bool m_bool_Antialias,
     Color m_color_Shadow,
     Color m_color_Caption,
     ProgressCaptionMode m_CaptionMode,
     String m_str_Caption,
     bool m_bool_ChangeByMouse,
     bool m_bool_Invert,
     ProgressBarDirection m_Direction,
     int m_int_Minimum,
     int ExtendedProgress_interval
     ) : this(
         //ProgressType.Bar,
         //CircularProgress.SupremeCircle,
         ProgressBar.RPExtendedProgress,
         //ProgressIndicator.CircularIndeterminate,
         SmoothingMode.HighQuality,
         TextRenderingHint.AntiAlias,
         PeaceAnimatorEasing.BounceEaseIn,
         transparencyEasingType.BounceEaseIn,
         ZeroitThematicProgress.HatchBrushType.ForwardDiagonal,
         false,
         false,
         false,
         false,
         false,
         "%",
         Color.FromArgb(254, 84, 84),
         Color.DeepPink,
         0,
         100,
         5000,
         10,
         10,
         270)
 {
     //this.progressType = progressType;
     //this.solidBars = solidBars;
     this.m_Edge                    = m_Edge;
     this.m_EdgeColor               = m_EdgeColor;
     this.m_EdgeLightColor          = m_EdgeLightColor;
     this.m_EdgeWidth               = m_EdgeWidth;
     this.m_FloodStyle              = m_FloodStyle;
     this.m_float_BarFlood          = m_float_BarFlood;
     this.m_int_BarOffset           = m_int_BarOffset;
     this.m_int_DashWidth           = m_int_DashWidth;
     this.m_int_DashSpace           = m_int_DashSpace;
     this.m_Style                   = m_Style;
     this.m_Color1                  = m_Color1;
     this.m_Color2                  = m_Color2;
     this.m_color_Back              = m_color_Back;
     this.m_int_Step                = m_int_Step;
     this.m_bool_Shadow             = m_bool_Shadow;
     this.m_int_ShadowOffset        = m_int_ShadowOffset;
     this.m_bool_Antialias          = m_bool_Antialias;
     this.m_color_Shadow            = m_color_Shadow;
     this.m_color_Caption           = m_color_Caption;
     this.m_CaptionMode             = m_CaptionMode;
     this.m_str_Caption             = m_str_Caption;
     this.m_bool_ChangeByMouse      = m_bool_ChangeByMouse;
     this.m_bool_Invert             = m_bool_Invert;
     this.m_Direction               = m_Direction;
     this.m_int_Minimum             = m_int_Minimum;
     this.ExtendedProgress_interval = ExtendedProgress_interval;
 }
Пример #7
0
        public void Activate()
        {
            Window window = NUIApplication.GetDefaultWindow();

            root = new View()
            {
                Size2D = new Size2D(1920, 1080),
            };

            CreateBoardAndButtons();

            //button1.ClickEvent += bar1Add;
            //button2.ClickEvent += bar1Minus;
            //button3.ClickEvent += circle1Add;
            //button4.ClickEvent += circle1Minus;
            //button5.ClickEvent += circleStatusChanged;

            progressBar1_1              = new Progress();
            progressBar1_1.Position2D   = new Position2D(80, 350);
            progressBar1_1.Size2D       = new Size2D(140, 4);
            progressBar1_1.MaxValue     = 100;
            progressBar1_1.MinValue     = 0;
            progressBar1_1.CurrentValue = 45;
            progressBar1_1.Style.Track.BackgroundColor    = Color.Green;
            progressBar1_1.Style.Progress.BackgroundColor = Color.Black;
            root.Add(progressBar1_1);

            progressBar1_2              = new Progress();
            progressBar1_2.Position2D   = new Position2D(80, 420);
            progressBar1_2.Size2D       = new Size2D(140, 4);
            progressBar1_2.MaxValue     = 100;
            progressBar1_2.MinValue     = 0;
            progressBar1_2.CurrentValue = 15;
            progressBar1_2.Style.Track.BackgroundColor    = Color.Green;
            progressBar1_2.Style.Progress.BackgroundColor = Color.Black;

            root.Add(progressBar1_2);

            ProgressStyle attr = new ProgressStyle
            {
                Track = new ImageViewStyle
                {
                    BackgroundColor = new Selector <Color>
                    {
                        All = Color.Cyan,
                    }
                },
                Progress = new ImageViewStyle
                {
                    BackgroundColor = new Selector <Color>
                    {
                        All = Color.Black,
                    }
                },
            };

            progressBar2_1              = new Progress(attr);
            progressBar2_1.Position2D   = new Position2D(380, 350);
            progressBar2_1.Size2D       = new Size2D(140, 4);
            progressBar2_1.MaxValue     = 100;
            progressBar2_1.MinValue     = 0;
            progressBar2_1.CurrentValue = 30;
            root.Add(progressBar2_1);

            //progressBar2_2 = new Progress(att);
            //progressBar2_2.Position2D = new Position2D(80, 560);
            //progressBar2_2.Size2D = new Size2D(140, 4);
            //progressBar2_2.MaxValue = 100;
            //progressBar2_2.MinValue = 0;
            //progressBar2_2.CurrentValue = 75;
            //progressBar2_2.UpdateValue();
            //progressBar2_2.Direction = Progress.DirectionType.Horizontal;
            //root.Add(progressBar2_2);

            board.UpFocusableView = button1;
            window.Add(root);
            FocusManager.Instance.SetCurrentFocusView(button1);
        }
Пример #8
0
 public ProgressBar(string title, ProgressStyle style)
 {
     progressbarFrm = new FrmProgressBar(title, style);
     thread         = new Thread(ShowProgress);
 }