Beispiel #1
0
 /// <summary>Initializes a new bar or updates the progress bar with more specific information</summary>
 public void UpdateProgressDetailed(string labelValue, string tagString, string percentVal = "", int barVal = 0, int barMax = 100, int marqSpeed = 0
                                    , string labelTop        = "", bool isLeftHidden = false, bool isTopHidden = false, bool isPercentHidden     = false
                                    , ProgBarStyle progStyle = ProgBarStyle.Blocks, ProgBarEventType progEvent = ProgBarEventType.ProgressBar)
 {
     Fire(new ODEventArgs(_eventName, new ProgressBarHelper(labelValue, percentVal, barVal, barMax, progStyle
                                                            , tagString, marqSpeed, labelTop, isLeftHidden, isTopHidden, isPercentHidden, progressBarEventType: progEvent)));
 }
Beispiel #2
0
        public ODProgressBar(string labelLeftText, string labelTopText = "", string labelPercentText   = "", int blockValue        = 0, int blockMax = 100, string tagString = "",
                             ProgBarStyle progressStyle = ProgBarStyle.NoneSpecified, int marqueeSpeed = 0, bool isLabelLeftHidden = false, bool isLabelTopHidden = false
                             , bool isLabelRightHidden  = false)
        {
            InitializeComponent();
            this.labelLeftText.Text   = labelLeftText;
            this.labelTopText.Text    = labelTopText;
            labelPercentComplete.Text = labelPercentText;
            progressBar.Maximum       = blockMax;
            progressBar.Value         = blockValue;
            _tagString = tagString;
            switch (progressStyle)
            {
            case ProgBarStyle.Blocks:
                progressBar.Style = ProgressBarStyle.Blocks;
                break;

            case ProgBarStyle.Marquee:
                progressBar.Style = ProgressBarStyle.Marquee;
                break;

            case ProgBarStyle.NoneSpecified:
            case ProgBarStyle.Continuous:
            default:
                progressBar.Style = ProgressBarStyle.Continuous;
                break;
            }
            progressBar.MarqueeAnimationSpeed = marqueeSpeed;
            _isLabelLeftHidden  = isLabelLeftHidden;
            _isLabelTopHidden   = isLabelTopHidden;
            _isLabelRightHidden = isLabelRightHidden;
            LayoutHelper();
        }
Beispiel #3
0
        public void UpdateProgressDetailed(string labelValue, string percentVal = "", string tagString = "", int barVal = 0, int barMax               = 100, int marqSpeed = 0,
                                           string labelTop        = "", bool isLeftHidden = false, bool isTopHidden     = false, bool isPercentHidden = false,
                                           ProgBarStyle progStyle = ProgBarStyle.Blocks, ProgBarEventType progEvent = ProgBarEventType.ProgressBar)
        {
            ProgressBarHelper progHelper = new ProgressBarHelper(labelValue, percentVal, barVal, barMax, progStyle, tagString, marqSpeed, labelTop, isLeftHidden,
                                                                 isTopHidden, isPercentHidden, progEvent);

            UpdateProgress(labelValue, progHelper, true, false);
        }
Beispiel #4
0
 ///<summary>Updates the progress bar with these details.</summary>
 public void UpdateProgressDetailed(string labelValue, string percentVal = "", string tagString = "", int barVal = 0, int barMax               = 100, int marqSpeed = 0,
                                    string labelTop        = "", bool isLeftHidden = false, bool isTopHidden     = false, bool isPercentHidden = false,
                                    ProgBarStyle progStyle = ProgBarStyle.Blocks, ProgBarEventType progEvent = ProgBarEventType.ProgressBar)
 {
     if (_formProgress.InvokeRequired)
     {
         _formProgress.BeginInvoke(() => UpdateProgressDetailed(labelValue, percentVal, tagString, barVal, barMax, marqSpeed, labelTop, isLeftHidden, isTopHidden,
                                                                isPercentHidden, progStyle, progEvent));
         return;
     }
     _formProgress.UpdateProgressDetailed(labelValue, percentVal, tagString, barVal, barMax, marqSpeed, labelTop, isLeftHidden, isTopHidden, isPercentHidden,
                                          progStyle, progEvent);
 }
Beispiel #5
0
        public void ODProgUpdate(string labelLeftText, string labelTopText, string labelPercentText, int blockValue, int blockMax, string tagString,
                                 ProgBarStyle progressStyle, int marqueeSpeed = 0, bool isLabelLeftHidden = false, bool isLabelTopHidden = false, bool isLabelRightHidden = false)
        {
            this.labelLeftText.Text = labelLeftText;
            this.labelTopText.Text  = labelTopText;
            if (labelPercentText != null)
            {
                labelPercentComplete.Text = labelPercentText;
            }
            if (blockMax != 0)
            {
                progressBar.Maximum = blockMax;
            }
            if (blockValue != 0)
            {
                if (blockValue > progressBar.Maximum || blockValue < progressBar.Minimum)
                {
                    progressBar.Value = progressBar.Maximum;
                }
                else
                {
                    progressBar.Value = blockValue;
                }
            }
            progressBar.Tag = tagString;
            switch (progressStyle)
            {
            case ProgBarStyle.Blocks:
                progressBar.Style = ProgressBarStyle.Blocks;
                break;

            case ProgBarStyle.Marquee:
                progressBar.Style = ProgressBarStyle.Marquee;
                break;

            case ProgBarStyle.NoneSpecified:
            case ProgBarStyle.Continuous:
            default:
                progressBar.Style = ProgressBarStyle.Continuous;
                break;
            }
            if (marqueeSpeed != 0)
            {
                progressBar.MarqueeAnimationSpeed = marqueeSpeed;
            }
            progressBar.MarqueeAnimationSpeed = marqueeSpeed;
            _isLabelLeftHidden  = isLabelLeftHidden;
            _isLabelTopHidden   = isLabelTopHidden;
            _isLabelRightHidden = isLabelRightHidden;
            LayoutHelper();
        }
Beispiel #6
0
 public ODProgressBar()
 {
     InitializeComponent();
     labelLeftText.Text        = "";
     labelTopText.Text         = "";
     labelPercentComplete.Text = "";
     progressBar.Maximum       = 100;
     progressBar.Value         = 0;
     _tagString     = "";
     _progressStyle = ProgBarStyle.NoneSpecified;
     progressBar.MarqueeAnimationSpeed = 0;
     _isLabelLeftHidden  = false;
     _isLabelTopHidden   = false;
     _isLabelRightHidden = false;
 }
Beispiel #7
0
        ///<summary>Runs the workerDelegate on a separate thread and displays a progress window while the thread is running.</summary>
        public static void ShowProgressForThread(ODThread.WorkerDelegate workerDelegate, Control parent, string startingMessage = "Please Wait...",
                                                 ProgBarStyle progStyle = ProgBarStyle.Blocks, string threadName = "ODProgressThread", ODThread.ExceptionDelegate exceptionHandler = null)
        {
            ODProgress prog   = new ODProgress(Lan.g(parent, startingMessage), progStyle);
            ODThread   thread = new ODThread(workerDelegate);

            if (exceptionHandler != null)
            {
                thread.AddExceptionHandler(exceptionHandler);
            }
            thread.Name        = threadName;
            thread.ProgressLog = prog;
            thread.Start(true);
            prog.ShowDialog(parent);
        }
 ///<param name="currentForm">The form to activate once the progress is done. If you cannot possibly pass in a form, it is okay to pass in null.
 ///</param>
 public ODProgressExtended(ODEventType odEventType, IODEvent odEvent, Form currentForm, object tag = null, ProgBarStyle progBarStyle = ProgBarStyle.Blocks,
                           string lanThis = "ProgressExtended", string cancelButtonText = null)
 {
     _actionCloser = ODProgress.ShowExtended(odEventType, odEvent.GetType(), currentForm, tag,
                                             new ProgressCanceledHandler((object sender, EventArgs e) => {
         IsCanceled = true;
     }),
                                             new ProgressPausedHandler((object sender, ProgressPausedArgs e) => {
         IsPaused = e.IsPaused;
     }), cancelButtonText);
     _event        = odEvent;
     _progBarStyle = progBarStyle;
     _odEventType  = odEventType;
     LanThis       = lanThis;
 }
        ///<summary>Creates a new progress bar and adds it to the form.</summary>
        private ODProgressBar AddNewProgressBar(string leftLabel, string topLabel, string rightLabel, int blockValue, int blockMax, string tagString,
                                                ProgBarStyle progStyle, int marqSpeed, bool isLeftHidden, bool isTopHidden, bool isRightHidden)
        {
            if (_listProgressBars.Count > 10)
            {
                MsgBox.Show(this, "Cannot have more than 10 progress bars on window.");
                return(null);
            }
            ODProgressBar pbar = new ODProgressBar(leftLabel, topLabel, rightLabel, blockValue, blockMax, tagString, progStyle, marqSpeed, isLeftHidden, isTopHidden,
                                                   isRightHidden);
            int rowLocation = tableLayoutPanel1.RowCount;

            tableLayoutPanel1.Controls.Add(pbar, 1, rowLocation);
            pbar.Name = "pbar" + rowLocation;
            return(pbar);
        }
        ///<summary>Creates a new progress bar and adds it to the form.  Returns null if there are more than 10 progress bars.</summary>
        private ODProgressBar AddNewProgressBar(string leftLabel, string topLabel, string rightLabel, int blockValue, int blockMax, string tagString,
                                                ProgBarStyle progStyle, int marqSpeed, bool isLeftHidden, bool isTopHidden, bool isRightHidden)
        {
            if (_listProgressBars.Count > 10)
            {
                return(null);
            }
            ODProgressBar pbar = new ODProgressBar(leftLabel, topLabel, rightLabel, blockValue, blockMax, tagString, progStyle, marqSpeed, isLeftHidden, isTopHidden,
                                                   isRightHidden);

            pbar.TabStop = false;
            int rowLocation = tableLayoutPanel1.RowCount;

            tableLayoutPanel1.Controls.Add(pbar, 1, rowLocation);
            pbar.Name = "pbar" + rowLocation;
            return(pbar);
        }
Beispiel #11
0
 ///<summary>Used as a shell to store information events need to update a progress window.</summary>
 public ProgressBarHelper(string labelValue, string percentValue = "", int blockValue = 0, int blockMax = 0
                          , ProgBarStyle progressStyle           = ProgBarStyle.NoneSpecified, string tagString = "", int marqueeSpeed = 0, string labelTop = "", bool isLeftValHidden = false,
                          bool isTopHidden = false, bool isPercentHidden = false, ProgBarEventType progressBarEventType                = ProgBarEventType.ProgressBar)
 {
     _labelValue           = labelValue;
     _percentValue         = percentValue;
     _blockValue           = blockValue;
     _blockMax             = blockMax;
     _progressStyle        = progressStyle;
     _progressBarEventType = progressBarEventType;
     _tagString            = tagString;
     _marqueeSpeed         = marqueeSpeed;
     _labelTop             = labelTop;
     _isValHidden          = isLeftValHidden;
     _isTopHidden          = isTopHidden;
     _isPercentHidden      = isPercentHidden;
 }
Beispiel #12
0
 ///<param name="currentForm">The form to activate once the progress is done. If you cannot possibly pass in a form, it is okay to pass in null.
 ///</param>
 public ODProgressExtended(string eventName, IODEvent odEvent, Form currentForm, object tag = null, ProgBarStyle progBarStyle = ProgBarStyle.Blocks,
                           string lanThis = "ProgressExtended")
 {
     _actionCloser = ODProgressOld.ShowProgressExtended(eventName, odEvent.GetType(), currentForm, tag,
                                                        new ProgressCanceledHandler((object sender, EventArgs e) => {
         IsCanceled = true;
     }),
                                                        new ProgressPausedHandler((object sender, ProgressPausedArgs e) => {
         IsPaused = e.IsPaused;
     }),
                                                        new EventHandler((object sender, EventArgs e) => {
         _hasProgressOpened = true;
     }));
     _event        = odEvent;
     _progBarStyle = progBarStyle;
     _eventName    = eventName;
     LanThis       = lanThis;
 }
Beispiel #13
0
 public void UpdateProgressDetailed(string labelValue, string percentVal = "", string tagString = "", int barVal = 0, int barMax               = 100, int marqSpeed = 0,
                                    string labelTop            = "", bool isLeftHidden = false, bool isTopHidden = false, bool isPercentHidden = false, ProgBarStyle progStyle = ProgBarStyle.Blocks,
                                    ProgBarEventType progEvent = ProgBarEventType.ProgressBar)
 {
 }
Beispiel #14
0
 public ODProgress(string startingMessage = "Please Wait...", ProgBarStyle progStyle = ProgBarStyle.Blocks)
 {
     _formProgress = new FormProgressStatus("", typeof(ODEvent), false, true);
     _formProgress.UpdateProgressDetailed(startingMessage, progStyle: progStyle);
 }