本文整理汇总了C#中Altaxo.ReportProgress方法的典型用法代码示例。如果您正苦于以下问题:C# Altaxo.ReportProgress方法的具体用法?C# Altaxo.ReportProgress怎么用?C# Altaxo.ReportProgress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Altaxo
的用法示例。
在下文中一共展示了Altaxo.ReportProgress方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InternalVerifyOpeningOfDocumentsWithoutException
private void InternalVerifyOpeningOfDocumentsWithoutException(TestAllProjectsInFolderOptions testOptions, Altaxo.Main.Services.ExternalDrivenBackgroundMonitor monitor)
{
monitor.ReportProgress("Searching Altaxo project files ...", 0);
var path = testOptions.FolderPaths;
Current.Console.WriteLine("Begin of test. Search path(s): {0}", path);
var filelist = GetAltaxoProjectFileNames(path);
int numberOfProjectsTested = 0;
int numberOfProjectsFailedToLoad = 0;
double totalFilesToTest = filelist.Count;
monitor.ReportProgress(string.Format("Searching done, {0} Altaxo project files found.", totalFilesToTest));
foreach (var filename in filelist)
{
if (monitor.CancellationPending)
break;
try
{
System.Diagnostics.Debug.WriteLine(string.Format("Begin opening Altaxo project file {0}", filename));
monitor.ReportProgress(string.Format(
"Successfully loaded: {0}, failed to load: {1}, total: {2}/{3} projects.\r\n" +
"Currently opening: {4}", numberOfProjectsTested - numberOfProjectsFailedToLoad, numberOfProjectsFailedToLoad, numberOfProjectsTested, totalFilesToTest, filename), numberOfProjectsTested / totalFilesToTest);
++numberOfProjectsTested;
Current.Gui.Execute(Current.ProjectService.OpenProject, filename, true);
monitor.ReportProgress(string.Format(
"Successfully loaded: {0}, failed to load: {1}, total: {2}/{3} projects.\r\n" +
"Loaded successfully: {4}", numberOfProjectsTested - numberOfProjectsFailedToLoad, numberOfProjectsFailedToLoad, numberOfProjectsTested, totalFilesToTest, filename), numberOfProjectsTested / totalFilesToTest);
System.Threading.Thread.Sleep(1000);
}
catch (Exception)
{
++numberOfProjectsFailedToLoad;
monitor.ReportProgress(string.Format(
"Successfully loaded: {0}, failed to load: {1}, total: {2}/{3} projects.\r\n" +
"Failed to load: {4}", numberOfProjectsTested - numberOfProjectsFailedToLoad, numberOfProjectsFailedToLoad, numberOfProjectsTested, totalFilesToTest, filename), numberOfProjectsTested / totalFilesToTest);
Current.Console.WriteLine("Error opening file {0}", filename);
}
// Project is now opened from the original file
#if DEBUG && TRACEDOCUMENTNODES
{
GC.Collect();
System.Threading.Thread.Sleep(500);
bool areThereAnyProblems = false;
areThereAnyProblems |= Main.SuspendableDocumentNodeBase.ReportNotConnectedDocumentNodes(false);
areThereAnyProblems |= Main.SuspendableDocumentNode.ReportChildListProblems();
areThereAnyProblems |= Main.SuspendableDocumentNode.ReportWrongChildParentRelations();
if (areThereAnyProblems)
{
Current.Console.WriteLine("Above listed problems were detected after opening the file {0}", filename);
Current.Console.WriteLine();
}
}
#endif
if (testOptions.TestSavingAndReopening)
{
// Test saving of the project (now with the current version of Altaxo)
string tempFileName = System.IO.Path.GetTempFileName();
try
{
monitor.ReportProgress(string.Format(
"Successfully loaded: {0}, failed to load: {1}, total: {2}/{3} projects.\r\n" +
"Currently saving: {4}", numberOfProjectsTested - numberOfProjectsFailedToLoad, numberOfProjectsFailedToLoad, numberOfProjectsTested, totalFilesToTest, filename), numberOfProjectsTested / totalFilesToTest);
Current.Gui.Execute(Current.ProjectService.SaveProject, tempFileName);
monitor.ReportProgress(string.Format(
"Successfully loaded: {0}, failed to load: {1}, total: {2}/{3} projects.\r\n" +
"Saved successfully: {4}", numberOfProjectsTested - numberOfProjectsFailedToLoad, numberOfProjectsFailedToLoad, numberOfProjectsTested, totalFilesToTest, filename), numberOfProjectsTested / totalFilesToTest);
}
catch (Exception)
{
++numberOfProjectsFailedToLoad;
monitor.ReportProgress(string.Format(
"Successfully loaded: {0}, failed to load: {1}, total: {2}/{3} projects.\r\n" +
"Failed to save: {4}", numberOfProjectsTested - numberOfProjectsFailedToLoad, numberOfProjectsFailedToLoad, numberOfProjectsTested, totalFilesToTest, filename), numberOfProjectsTested / totalFilesToTest);
Current.Console.WriteLine("Error saving file {0}", filename);
}
// Close the project now
try
{
Current.Gui.Execute(Current.ProjectService.CloseProject, true);
System.Threading.Thread.Sleep(1000);
}
catch (Exception ex)
{
Current.Console.WriteLine("Error closing file (after saving) {0}; Message: {1}", filename, ex);
//.........这里部分代码省略.........