Example #1
0
        /// <summary>
        /// Generic progress report of any CJob type object
        /// Changes progress bar and sets simple status messages
        /// </summary>
        /// <param name="s">JobStatus</param>
        /// <param name="j">Job</param>
        private void genericJobProgressReport(CJobStatus s, CJob j)
        {
            switch (s)
            {
            case CJobStatus.start:
                lastTaskName = null;
                break;

            case CJobStatus.taskStart:

                if (j.TASK_LAST.FLAG_PROGRESS_DISABLE)
                {
                    lastTaskName = null;
                    return;
                }

                if (!string.IsNullOrEmpty(j.TASK_LAST.desc))
                {
                    lastTaskName = j.TASK_LAST.desc;
                }
                else
                {
                    lastTaskName = j.TASK_LAST.name;
                }

                form_setText(lastTaskName, 0);
                break;

            case CJobStatus.progress:
                form_setProgress((int)Math.Ceiling(j.PROGRESS_TOTAL));
                form_setText($"[{j.PROGRESS_TOTAL.ToString("0.#")}%] {lastTaskName}", 0);
                break;

            case CJobStatus.complete:
                form_setText(j.name + " Complete ", 2);
                LOG.line(40);
                LOG.log("");                 // newline
                form_setProgress(100);
                FormTools.invoke(this, () => {
                    TaskbarManager.Instance.SetProgressState(TaskbarProgressBarState.NoProgress);
                    FormTools.FlashWindow(this.Handle);
                });
                break;

            case CJobStatus.fail:
                form_setText(j.name + " Failed ", 3);
                break;
            }
        }// -----------------------------------------