public virtual void OnProgress(UpdateProgressInfo pi) { if (ProgressDelegate != null) { ProgressDelegate(pi); } }
void Instance_ReportProgress(UpdateProgressInfo currentStatus) { UpdateProgressBar.Dispatcher.Invoke((Action)(() => { UpdateProgressBar.Value = currentStatus.Percentage; })); }
private void Execute() { Progress = 0; try { process.Start(); StreamReader sr = process.StandardOutput; while (!process.HasExited) { string output = sr.ReadLine(); if (output != null) { string[] j = output.Split(' '); Int32 p; if (Int32.TryParse(j[0], out p)) { UpdateProgressInfo?.Invoke(this, new TaskPostBackEventArgs(p, j[1], p, j[1])); } } } } catch (Exception e) { PostErrorAndAbort?.Invoke(this, new ExceptionEventArgs(e, e.Message)); } finally { Progress = 100; Complete = true; UpdateProgressInfo?.Invoke(this, new TaskPostBackEventArgs(Progress, UpdateStrings.ready, Progress, UpdateStrings.ready)); } }
private void UpdateManagerReportProgress(UpdateProgressInfo currentStatus) { UIThread.BeginRun(() => { Message.Text = currentStatus.Message; Progress.Value = currentStatus.Percentage; }); }
public override TaskExecutionStatus Execute(bool coldRun) { var result = base.Execute(coldRun); var info = new UpdateProgressInfo { Message = "Applied with result " + result.ToString(), Percentage = Convert.ToInt32((this.Index + 1) / Count * 100) }; OnProgress(info); return(result); }
public override void Prepare(IUpdateSource source) { //This was an assumed int, which meant we never reached 100% with an odd number of tasks var info = new UpdateProgressInfo { Message = "Preparing", Percentage = Convert.ToInt32((this.Index + 1) / Count * 100f) }; OnProgress(info); base.Prepare(source); }
public void UpdateStateNotice(UpdateInfo.ResInfo res, UpdateProgressInfo.Phase downloadState, int totalSize, int curSize) { var data = new UpdateProgressInfo(); data.totalCount = m_updateCount; data.curIndex = m_currIndex; data.totalSize = totalSize; data.curSize = curSize; data.phase = downloadState; data.resInfo = res; if (m_delegate != null) { m_delegate.OnUpdateProgress(data); } }
private void TaskProgressCallback(UpdateProgressInfo currentStatus, IUpdateTask task) { if (ReportProgress == null) { return; } currentStatus.TaskDescription = task.Description; currentStatus.TaskId = UpdatesToApply.IndexOf(task) + 1; //This was an assumed int, which meant we never reached 100% with an odd number of tasks float taskPerc = 100F / UpdatesToApply.Count; currentStatus.Percentage = (int)Math.Round((currentStatus.Percentage * taskPerc / 100) + (currentStatus.TaskId - 1) * taskPerc); ReportProgress(currentStatus); }