Exemple #1
0
        //private int X()
        //{
        //    if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
        //    {
        //        NCurses.GetMouse(out MouseEvent mouseEvent);
        //        return mouseEvent.x;
        //    }
        //    else
        //        return Console.CursorLeft;
        //}

        /// <summary>
        /// 控制台进度条
        /// </summary>
        /// <param name="count">进度条数量</param>
        /// <param name="width">进度条宽度(单位为字符的宽度)</param>
        /// <param name="ProgressBarType">进度条类型</param>
        /// <param name="init">初始化进度条</param>
        /// <param name="left">光标左侧位置(默认使用控制台当前的值)</param>
        /// <param name="top">光标顶部位置(默认使用控制台当前的值)</param>
        public ProgressBar(int count = 1, int width = 50, ProgressBarType ProgressBarType = ProgressBarType.Multicolor, bool init = false, int?left = null, int?top = null)
        {
            Count           = count;
            progressBarType = ProgressBarType;
            if (left.HasValue)
            {
                Left = left.Value;
            }
            Top      = new int?[count];
            Width    = width;
            Ratio    = 100 / width;
            InitFlag = new bool[count];
            Value    = new List <byte?[]>();
            Msg      = new string[count];

            for (int i = 0; i < count; i++)
            {
                InitFlag[i] = false;
                Value.Add(new byte?[100]);
                if (top.HasValue)
                {
                    Top[i] = top.Value + i * 2;
                }
            }

            AutoResize();

            if (init)
            {
                InitAll();
            }
        }
        public static String getStatusCssClassMarkupFromEnum(ProgressBarType pbt)
        {
            switch (pbt)
            {
            case ProgressBarType.Completed_Completed:
                return("completed");

            case ProgressBarType.Completed_Failed:
                return("failed");

            case ProgressBarType.Completed_InProgress:
                return("inProgress");

            case ProgressBarType.Failed_NotStarted:
                return("failed");

            case ProgressBarType.InProgress_NotStarted:
                return("inProgress");

            case ProgressBarType.NotStarted_NotStarted:
                return("notStarted");

            default:
                return(String.Empty);
            }
        }
        public static ProgressBar ShowProgressBar(ProgressBarType type, out Thread thread)
        {
            // start the progress bar in a separate thread
            ProgressBar frmProgress = new ProgressBar();

            // set the display text based on the specified progress bar type
            switch (type)
            {
            case ProgressBarType.Connecting:
//					frmProgress.Text = Utils.CONNECTION_PROGRESS_TITLE;
//					frmProgress.lblMessage.Text = Utils.CONNECTION_PROGRESS_MESSAGE;
// TODO: add proper naming later
                frmProgress.Text            = "Connecting to RoundTable Project Server";
                frmProgress.lblMessage.Text = "Connecting to RoundTable Project Server. Please wait ...";
                break;

            case ProgressBarType.Synchronizing:
//					frmProgress.Text = Utils.CONNECTION_PROGRESS_TITLE;
//					frmProgress.lblMessage.Text = Utils.SYNC_PROGRESS_MESSAGE;
                break;
            }

            thread = new Thread(new ThreadStart(frmProgress.ShowMe));
            thread.Start();

            return(frmProgress);
        }
        public static String getProgressBarCssClassMarkupFromEnum(ProgressBarType pbt)
        {
            switch (pbt)
            {
            case ProgressBarType.Completed_Completed:
                return("<li class='progress-bar c-c'></li>");

            case ProgressBarType.Completed_Failed:
                return("<li class='progress-bar c-f'></li>");

            case ProgressBarType.Completed_InProgress:
                return("<li class='progress-bar c-i'></li>");

            case ProgressBarType.Failed_NotStarted:
                return("<li class='progress-bar f-n'></li>");

            case ProgressBarType.InProgress_NotStarted:
                return("<li class='progress-bar i-n'></li>");

            case ProgressBarType.NotStarted_NotStarted:
                return("<li class='progress-bar n-n'></li>");

            default:
                return(String.Empty);
            }
        }
        public static String getProgressBarTextFromEnum(ProgressBarType pbt)
        {
            switch (pbt)
            {
            case ProgressBarType.Completed_Completed:
                return("Completed");

            case ProgressBarType.Completed_Failed:
                return("Failed");

            case ProgressBarType.Completed_InProgress:
                return("In-Progress");

            case ProgressBarType.Failed_NotStarted:
                return("Failed");

            case ProgressBarType.InProgress_NotStarted:
                return("In-Progress");

            case ProgressBarType.NotStarted_NotStarted:
                return("Not Started");

            default:
                return(String.Empty);
            }
        }
Exemple #6
0
        public JcwProgressBar(ProgressBarType barType)
        {
            InitializeComponent();

            if (barType == ProgressBarType.Cycling)
            {
                MarqueeProgressBarControl bar = new MarqueeProgressBarControl();
                bar.Properties.BeginInit();
                bar.Properties.MarqueeAnimationSpeed = 100;
                bar.Properties.ProgressKind          = DevExpress.XtraEditors.Controls.ProgressKind.Horizontal;
                bar.Properties.ProgressViewStyle     = DevExpress.XtraEditors.Controls.ProgressViewStyle.Solid;
                bar.Properties.EndInit();
                m_progressBar = bar;
            }
            else
            {
                ProgressBarControl bar = new ProgressBarControl();
                bar.Properties.BeginInit();
                bar.Properties.Minimum           = 0;
                bar.Properties.PercentView       = false;
                bar.Properties.ProgressKind      = DevExpress.XtraEditors.Controls.ProgressKind.Horizontal;
                bar.Properties.ProgressViewStyle = DevExpress.XtraEditors.Controls.ProgressViewStyle.Solid;
                bar.Properties.ShowTitle         = true;
                bar.Properties.Step = 10;
                bar.Properties.EndInit();
                m_progressBar = bar;
            }

            m_progressBar.Dock = DockStyle.Fill;
            this.Controls.Add(m_progressBar);
        }
        public ConsoleProgressBar(int left, int top, int width = 50, ProgressBarType progressBarType = ProgressBarType.ColorBrush)
        {
            this.Left            = left;
            this.Top             = top;
            this.Width           = width;
            this.ProgressBarType = progressBarType;

            // 清空显示区域;
            Console.SetCursorPosition(Left, Top);
            for (int i = left; ++i < Console.WindowWidth;)
            {
                Console.Write(" ");
            }

            if (this.ProgressBarType == ProgressBarType.ColorBrush)
            {
                // 绘制进度条背景;
                colorBack = Console.BackgroundColor;
                Console.SetCursorPosition(Left, Top);
                Console.BackgroundColor = ConsoleColor.DarkCyan;
                for (int i = 0; ++i <= width;)
                {
                    Console.Write(" ");
                }
                Console.BackgroundColor = colorBack;
            }
            else
            {
                // 绘制进度条背景;
                Console.SetCursorPosition(left, top);
                Console.Write("[");
                Console.SetCursorPosition(left + width - 1, top);
                Console.Write("]");
            }
        }
Exemple #8
0
        public ProgressBar(int left, int top, ProgressBarType type, float maxValue, int width = 50)
        {
            this.Left            = left;
            this.Top             = top;
            this.Width           = width;
            this.ProgressBarType = type;
            MaxValue             = maxValue;


            Console.SetCursorPosition(Left, Top);
            for (int i = left; ++i < Console.WindowWidth;)
            {
                Console.Write(" ");
            }

            if (this.ProgressBarType == ProgressBarType.Multicolor)
            {
                colorBack = Console.BackgroundColor;
                Console.SetCursorPosition(Left, Top);
                Console.BackgroundColor = ConsoleColor.Gray;
                for (int i = 0; ++i <= width;)
                {
                    Console.Write(" ");
                }
                Console.BackgroundColor = colorBack;
            }
            else
            {
                Console.SetCursorPosition(left, top);
                Console.Write("[");
                Console.SetCursorPosition(left + width - 1, top);
                Console.Write("]");
            }
        }
Exemple #9
0
        public IProgressBarProperties Add(ProgressBarType type, string topic)
        {
            IProgressBarProperties           progressBar  = null;
            IPercentageProgressBarProperties pprogressBar = null;

            if (progressBars.ContainsKey(topic))
            {
                throw new Exception(string.Format("Duplicated work topic: {topic}"));
            }
            switch (type)
            {
            case ProgressBarType.CIRCULAR_PROGRESS_BAR:
                progressBar = new CircularProgressBar();
                break;

            case ProgressBarType.CIRCULAR_PERCENTAGE_PROGRESS_BAR:
                //create percentage circular bar
                pprogressBar = new PercentageCircularProgressBar();
                //               progressBarUpdate[topic] = ((IPercentageProgressBarProperties)progressBar).CurrentProgressValue;
                pprogressBar.Topic            = topic;
                PercentageProgressBars[topic] = pprogressBar;
                AddProgressBarToGUI(pprogressBar);
                return(pprogressBar);
            }
            progressBar.Topic   = topic;
            progressBars[topic] = progressBar;
            AddProgressBarToGUI(progressBar);
            return(progressBar);
        }
 public SBProgressBarComponent(float xOffset, float yOffset, float width, float height, Color color, ProgressBarType type)
 {
     name = "progress bar component";
     componentType = ComponentType.ProgressBar;
     progressBar = new SBProgressBar(width, height, color, type);
     progressBar.x = xOffset;
     progressBar.y = yOffset;
 }
Exemple #11
0
 private void UpdateProgress(int progressValue, ProgressBarType progressBarType)
 {
     if (GlobalData.backgroundWorker != null)
     {
         if (progressBarType == ProgressBarType.CurrentTaskProgress)
         {
             currentTaskProgressBar.BeginInvoke(new UpdateCurrentProgressBarCallback(this.UpdateCurrentProgressBar), new object[] { progressValue });
         }
         else if (progressBarType == ProgressBarType.OverAllProgress)
         {
             totalProgressBar.BeginInvoke(new UpdateTotalProgressBarCallback(this.UpdateTotalProgressBar), new object[] { progressValue });
         }
     }
 }
Exemple #12
0
        void InitializeProgressControl(ProgressBarType barType, Color backgroundColor,
                                       Color foregroundColor, Color borderColor, Bitmap foregroundBitmap, Bitmap backgroundBitmap, Color gradientStartColor,
                                       Color gradientMiddleColor, Color gradientEndColor)
        {
            // Setup Double buffering
            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.DoubleBuffer, true);

            this.barType             = barType;
            this.backgroundColor     = backgroundColor;
            this.foregroundColor     = foregroundColor;
            this.borderColor         = borderColor;
            this.foregroundBitmap    = foregroundBitmap;
            this.backgroundBitmap    = backgroundBitmap;
            this.gradientStartColor  = gradientStartColor;
            this.gradientMiddleColor = gradientMiddleColor;
            this.gradientEndColor    = gradientEndColor;
        }
    public SBProgressBar(float width, float height, Color color, ProgressBarType type)
    {
        this.type = type;
        this.height = height;
        maxWidth = width;
        percent_ = 1;

        sprite_ = WTSquareMaker.Square(width, height);
        sprite_.color = color;
        if (type == ProgressBarType.FillLeftToRight) {
            sprite_.anchorX = 0;
            sprite_.x = -maxWidth / 2f;
        }
        else if (type == ProgressBarType.FillRightToLeft) {
            sprite_.anchorX = 1;
            sprite_.x = maxWidth / 2f;
        }
        AddChild(sprite_);
    }
Exemple #14
0
        /// <summary>
        /// Displays a loading screen presenting the user with a message and progress bar.
        /// </summary>
        /// <param name="message">The label text displayed above the progress bar.</param>
        /// <param name="type">The type of progress bar to use in the loading screen.</param>
        public LoadingScreen(string message, ProgressBarType type)
        {
            InitializeComponent();
            this.TopMost  = true;
            this.TopLevel = true;
            label1.Text   = "Loading " + message + "...";

            this.StartPosition = FormStartPosition.CenterScreen;

            if (type == ProgressBarType.Marquee)
            {
                progressBar1.Style = ProgressBarStyle.Marquee;
            }
            else if (type == ProgressBarType.Block)
            {
                progressBar1.Style = ProgressBarStyle.Blocks;
            }
            else
            {
                progressBar1.Style = ProgressBarStyle.Continuous;
            }
        }
Exemple #15
0
        public static ProgressBar ShowProgressBar(ProgressBarType type, out Thread thread)
        {
            // start the progress bar in a separate thread
            ProgressBar frmProgress = new ProgressBar();

            // set the display text based on the specified progress bar type
            switch (type)
            {
            case ProgressBarType.Connecting:
                frmProgress.Text            = Utils.CONNECTION_PROGRESS_TITLE;
                frmProgress.lblMessage.Text = Utils.CONNECTION_PROGRESS_MESSAGE;
                break;

            case ProgressBarType.Synchronizing:
                frmProgress.Text            = Utils.CONNECTION_PROGRESS_TITLE;
                frmProgress.lblMessage.Text = Utils.SYNC_PROGRESS_MESSAGE;
                break;
            }

            thread = new Thread(new ThreadStart(frmProgress.ShowMe));
            thread.Start();

            return(frmProgress);
        }
        public static ProgressBar ShowProgressBar(ProgressBarType type)
        {
            Thread thread;

            return(ShowProgressBar(type, out thread));
        }
        DataTable getBindableTable(TaggedExtractorConfigArrays tecas, Dictionary <String, EtlDownstreamStageTO> etlStageBySite)
        {
            Dictionary <String, String> siteIdsAndNames = DataBindingUtils.getSiteIdAndNameDict();
            Dictionary <String, IList <ExtractorConfigurationTO> > active    = getConfigsByKeyAndSite("Active", tecas);
            Dictionary <String, IList <ExtractorConfigurationTO> > queued    = getConfigsByKeyAndSite("Queued", tecas);
            Dictionary <String, IList <ExtractorConfigurationTO> > errored   = getConfigsByKeyAndSite("Errored", tecas);
            Dictionary <String, IList <ExtractorConfigurationTO> > completed = getConfigsByKeyAndSite("Completed", tecas);

            DataTable mock = new DataTable();

            mock.Columns.Add("site");
            mock.Columns.Add("progressBarMarkup");
            mock.Columns.Add("status");
            mock.Columns.Add("statusMarkup");
            mock.Columns.Add("adtStatus");
            mock.Columns.Add("adtFinishedTimestamp");
            mock.Columns.Add("labStatus");
            mock.Columns.Add("labFinishedTimestamp");
            mock.Columns.Add("vitalsStatus");
            mock.Columns.Add("vitalsFinishedTimestamp");
            mock.Columns.Add("bcmaStatus");
            mock.Columns.Add("bcmaFinishedTimestamp");
            mock.Columns.Add("pharmaStatus");
            mock.Columns.Add("pharmaFinishedTimestamp");

            for (int i = 0; i < siteIdsAndNames.Count; i++)
            {
                String currentSite = siteIdsAndNames.ElementAt(i).Key;

                String dateTimeFormatString = "M/d h:mm tt";

                // if any config has been marked errored for this site - show failure
                if (errored.ContainsKey(currentSite) && errored[currentSite] != null && errored[currentSite].Count > 0)
                {
                    String controlsText = DataBindingUtils.getProgressBarTextFromEnum(ProgressBarType.Failed_NotStarted);
                    String statusMarkup = DataBindingUtils.getStatusCssClassMarkupFromEnum(ProgressBarType.Failed_NotStarted);
                    mock.Rows.Add(new object[] { siteIdsAndNames.ElementAt(i).Value, DataBindingUtils.getProgressBarCssClassMarkupFromEnum(ProgressBarType.Failed_NotStarted), controlsText, statusMarkup,
                                                 controlsText, DateTime.Now.ToString(dateTimeFormatString), // ADT
                                                 controlsText, DateTime.Now.ToString(dateTimeFormatString), // labs
                                                 controlsText, DateTime.Now.ToString(dateTimeFormatString), // vitals
                                                 controlsText, DateTime.Now.ToString(dateTimeFormatString), // BCMA
                                                 controlsText, DateTime.Now.ToString(dateTimeFormatString), // pharma
                                  });

                    continue;
                }

                // if all jobs for a site are in queued and no other collections contain site ID, then mark as not started
                if (!errored.ContainsKey(currentSite) && !active.ContainsKey(currentSite) && !completed.ContainsKey(currentSite) && queued.ContainsKey(currentSite))
                {
                    String controlsText = DataBindingUtils.getProgressBarTextFromEnum(ProgressBarType.NotStarted_NotStarted);
                    String statusMarkup = DataBindingUtils.getStatusCssClassMarkupFromEnum(ProgressBarType.NotStarted_NotStarted);
                    mock.Rows.Add(new object[] { siteIdsAndNames.ElementAt(i).Value, DataBindingUtils.getProgressBarCssClassMarkupFromEnum(ProgressBarType.NotStarted_NotStarted), controlsText, statusMarkup,
                                                 controlsText, DateTime.Now.ToString(dateTimeFormatString), // ADT
                                                 controlsText, DateTime.Now.ToString(dateTimeFormatString), // labs
                                                 controlsText, DateTime.Now.ToString(dateTimeFormatString), // vitals
                                                 controlsText, DateTime.Now.ToString(dateTimeFormatString), // BCMA
                                                 controlsText, DateTime.Now.ToString(dateTimeFormatString), // pharma
                                  });

                    continue;
                }

                // if any config for this site is running or queued - show in progress
                if ((queued.ContainsKey(currentSite) && queued[currentSite] != null && queued[currentSite].Count > 0) ||
                    (active.ContainsKey(currentSite) && active[currentSite] != null && active[currentSite].Count > 0))
                {
                    String controlsText = DataBindingUtils.getProgressBarTextFromEnum(ProgressBarType.InProgress_NotStarted);
                    String statusMarkup = DataBindingUtils.getStatusCssClassMarkupFromEnum(ProgressBarType.InProgress_NotStarted);
                    mock.Rows.Add(new object[] { siteIdsAndNames.ElementAt(i).Value, DataBindingUtils.getProgressBarCssClassMarkupFromEnum(ProgressBarType.InProgress_NotStarted), controlsText, statusMarkup,
                                                 controlsText, DateTime.Now.ToString(dateTimeFormatString), // ADT
                                                 controlsText, DateTime.Now.ToString(dateTimeFormatString), // labs
                                                 controlsText, DateTime.Now.ToString(dateTimeFormatString), // vitals
                                                 controlsText, DateTime.Now.ToString(dateTimeFormatString), // BCMA
                                                 controlsText, DateTime.Now.ToString(dateTimeFormatString), // pharma
                                  });

                    continue;
                }

                // if we show at least one job completed for this site and no configs found in active or queued or errored, consider it complete!
                if (completed.ContainsKey(currentSite) && completed[currentSite] != null && completed[currentSite].Count > 0)
                {
                    String          controlsText = "";
                    String          statusMarkup = "";
                    ProgressBarType currentType  = 0;

                    if (etlStageBySite.ContainsKey(currentSite))
                    {
                        EtlBatchStage etlStage = (EtlBatchStage)Enum.Parse(typeof(EtlBatchStage), etlStageBySite[currentSite].stage);

                        if (etlStage == EtlBatchStage.COMPLETED_WORKFLOW)
                        {
                            controlsText = DataBindingUtils.getProgressBarTextFromEnum(ProgressBarType.Completed_Completed);
                            statusMarkup = DataBindingUtils.getStatusCssClassMarkupFromEnum(ProgressBarType.Completed_Completed);
                            currentType  = ProgressBarType.Completed_Completed;
                        }
                        else if (etlStage == EtlBatchStage.NOT_STARTED)
                        {
                            controlsText = DataBindingUtils.getProgressBarTextFromEnum(ProgressBarType.Completed_InProgress);
                            statusMarkup = DataBindingUtils.getStatusCssClassMarkupFromEnum(ProgressBarType.Completed_InProgress);
                            currentType  = ProgressBarType.Completed_InProgress;
                        }
                        else if (etlStage >= EtlBatchStage.START_WORKFLOW)
                        {
                            controlsText = DataBindingUtils.getProgressBarTextFromEnum(ProgressBarType.Completed_InProgress);
                            statusMarkup = DataBindingUtils.getStatusCssClassMarkupFromEnum(ProgressBarType.Completed_InProgress);
                            currentType  = ProgressBarType.Completed_InProgress;
                        }
                        // TBD - how do we show failed ETL?????
                    }
                    else // didn't find site ID in ETL stages
                    {
                        controlsText = DataBindingUtils.getProgressBarTextFromEnum(ProgressBarType.Completed_InProgress); // TBD - should there be a Completed_notStarted  status??? seems like there should be...
                        statusMarkup = DataBindingUtils.getStatusCssClassMarkupFromEnum(ProgressBarType.Completed_InProgress);
                        currentType  = ProgressBarType.Completed_InProgress;
                    }
                    mock.Rows.Add(new object[] { siteIdsAndNames.ElementAt(i).Value, DataBindingUtils.getProgressBarCssClassMarkupFromEnum(currentType), controlsText, statusMarkup,
                                                 controlsText, DateTime.Now.ToString(dateTimeFormatString), // ADT
                                                 controlsText, DateTime.Now.ToString(dateTimeFormatString), // labs
                                                 controlsText, DateTime.Now.ToString(dateTimeFormatString), // vitals
                                                 controlsText, DateTime.Now.ToString(dateTimeFormatString), // BCMA
                                                 controlsText, DateTime.Now.ToString(dateTimeFormatString), // pharma
                                  });

                    continue;
                }
            }

            return(mock);
        }
Exemple #18
0
 public ProgressBar(ProgressBarType type, float maxValue)
     : this(Console.CursorLeft, Console.CursorTop, type, maxValue)
 {
 }
 private void UpdateProgress(int progressValue, ProgressBarType progressBarType)
 {
     if (GlobalData.backgroundWorker != null)
     {
         if (progressBarType == ProgressBarType.CurrentTaskProgress)
         {
             currentTaskProgressBar.BeginInvoke(new UpdateCurrentProgressBarCallback(this.UpdateCurrentProgressBar), new object[] { progressValue });
         }
         else if (progressBarType == ProgressBarType.OverAllProgress)
         {
             totalProgressBar.BeginInvoke(new UpdateTotalProgressBarCallback(this.UpdateTotalProgressBar), new object[] { progressValue });
         }
     }
 }
 public ProgressObject(ProgressBarType type, String text, int maximum)
 {
     this.Type    = type;
     this.Text    = text;
     this.Maximum = maximum;
 }
Exemple #21
0
		void InitializeProgressControl(ProgressBarType barType, Color backgroundColor,
			Color foregroundColor, Color borderColor, Bitmap foregroundBitmap, Bitmap backgroundBitmap, Color gradientStartColor,
			Color gradientMiddleColor, Color gradientEndColor)
		{
			// Setup Double buffering
			SetStyle(ControlStyles.AllPaintingInWmPaint|ControlStyles.UserPaint|ControlStyles.DoubleBuffer, true);

			this.barType = barType;
			this.backgroundColor = backgroundColor;
			this.foregroundColor = foregroundColor;
			this.borderColor = borderColor;
			this.foregroundBitmap = foregroundBitmap;
			this.backgroundBitmap = backgroundBitmap;
			this.gradientStartColor = gradientStartColor;
			this.gradientMiddleColor = gradientMiddleColor;
			this.gradientEndColor = gradientEndColor;
		}
Exemple #22
0
        /// <summary>
        /// Specifies the type of the ProgressBar
        /// </summary>
        /// <param name="type">ProgressBarType enumeration specifying the type</param>
        /// <example>
        /// <code lang="CS">
        /// &lt;%= Html.Kendo().ProgressBar()
        ///     .Name(&quot;progressBar&quot;)
        ///     .Type(ProgressBarType.Percent)
        /// %&gt;
        /// </code>
        /// </example>
        public ProgressBarBuilder Type(ProgressBarType type)
        {
            Component.Type = type;

            return(this);
        }
 public ProgressObject(ProgressBarType type, String text) : this(type, text, -1)
 {
 }