/// <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; } }// -----------------------------------------
}// ----------------------------------------- // ============================================================ // == EVENTS // ============================================================ /// <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.taskStart: if (j.TASK_LAST.PROGRESS_UNKNOWN) { form_setProgress(-1); // ("PROGRESS BAR WORKING-----------"); } if (string.IsNullOrEmpty(j.TASK_LAST.desc)) { form_setText(j.TASK_LAST.name, 0); } else { form_setText(j.TASK_LAST.desc, 0); } break; case CJobStatus.taskEnd: if (j.TASK_LAST.PROGRESS_UNKNOWN) { form_setProgress(0); // Restore the progress bar to normal } else { form_setProgress(j.TASKS_COMPLETION_PERCENT); } break; case CJobStatus.complete: form_setText(j.name + " complete ", 2); FLAG_CLEAR_STATUS = true; break; case CJobStatus.fail: form_setText(j.name + " failed ", 3); FLAG_CLEAR_STATUS = true; break; } }// -----------------------------------------