本文整理汇总了C#中IProgressReporter.Initialize方法的典型用法代码示例。如果您正苦于以下问题:C# IProgressReporter.Initialize方法的具体用法?C# IProgressReporter.Initialize怎么用?C# IProgressReporter.Initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IProgressReporter
的用法示例。
在下文中一共展示了IProgressReporter.Initialize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RunUpdate
/// <summary>
/// Runs the updating process.
/// </summary>
public void RunUpdate()
{
try
{
_progressReporter = GetProgressReporter();
}
catch (Exception ex)
{
Popup.ShowPopup(SystemIcons.Error, "Error while initializing the graphic user interface.", ex,
PopupButtons.Ok);
return;
}
ThreadPool.QueueUserWorkItem(arg => RunUpdateAsync());
try
{
_progressReporter.Initialize();
}
catch (Exception ex)
{
_progressReporter.InitializingFail(ex);
_progressReporter.Terminate();
}
}
示例2: Collect
public static async Task<Results> Collect(IReadOnlyList<string> languages, IReadOnlyList<ISearchRunner> runners, IProgressReporter progressReporter = null)
{
if (languages == null)
throw new ArgumentNullException("languages");
if (runners == null)
throw new ArgumentNullException("runners");
var results = new long[languages.Count, runners.Count];
var errors = new List<Exception>();
if (progressReporter != null)
{
progressReporter.Initialize(languages.Count * runners.Count);
}
List<Task> tasks = new List<Task>();
for (var li = 0; li < languages.Count; li++)
{
for (var ri = 0; ri < runners.Count; ri++)
{
tasks.Add(StartTask(languages, runners, progressReporter, results, li, ri));
}
}
await Task.WhenAll(tasks.ToArray());
return new Results(languages, runners.Select(r => r.Name).ToList(), results);
}