public IEnumerator<object> LoadDiff(string filename)
{
var progress = new CallbackProgressListener {
OnSetStatus = (status) => {
LoadingPanel.Text = status;
},
OnSetMaximum = (maximum) => {
if (LoadingProgress.Maximum != maximum)
LoadingProgress.Maximum = maximum;
},
OnSetProgress = (value) => {
if (value.HasValue) {
var v = value.Value;
if (LoadingProgress.Style != ProgressBarStyle.Continuous)
LoadingProgress.Style = ProgressBarStyle.Continuous;
LoadingProgress.Value = Math.Min(v + 1, LoadingProgress.Maximum);
LoadingProgress.Value = v;
} else {
if (LoadingProgress.Style != ProgressBarStyle.Marquee)
LoadingProgress.Style = ProgressBarStyle.Marquee;
}
}
};
var rtc = new RunToCompletion<HeapDiff>(
HeapDiff.FromFile(filename, progress)
);
using (rtc)
yield return rtc;
DiffLoaded(rtc.Result, filename);
}