MonoDevelop.UnitTesting.AbstractUnitTestTextEditorExtension.HandleDocumentParsed C# (CSharp) Méthode

HandleDocumentParsed() private méthode

private HandleDocumentParsed ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
Résultat void
		void HandleDocumentParsed (object sender, EventArgs e)
		{
			if (!IdeApp.Preferences.EnableUnitTestEditorIntegration)
				return;
			src.Cancel ();
			src = new CancellationTokenSource ();
			var token = src.Token;
			ThreadPool.QueueUserWorkItem (delegate {
				if (token.IsCancellationRequested || DocumentContext == null)
					return;
				try {
					GatherUnitTests (unitTestMarkers, token).ContinueWith (task => {
						var foundTests = task.Result;
						if (foundTests == null || DocumentContext == null)
							return;
						Application.Invoke (delegate {
							if (token.IsCancellationRequested || DocumentContext == null)
								return;
							foreach (var oldMarker in currentMarker)
								Editor.RemoveMarker (oldMarker);
							var newMarkers = new List<IUnitTestMarker> ();
							foreach (var foundTest in foundTests) {
								if (foundTest == null)
									continue;
								var unitTestMarker = TextMarkerFactory.CreateUnitTestMarker (Editor, new UnitTestMarkerHostImpl (this), foundTest);
								newMarkers.Add (unitTestMarker);
								var line = Editor.GetLineByOffset (foundTest.Offset);
								if (line != null) {
									Editor.AddMarker (line, unitTestMarker);
								}
							}
							currentMarker = newMarkers;
						});

					}, TaskContinuationOptions.ExecuteSynchronously | 
						TaskContinuationOptions.NotOnCanceled | 
						TaskContinuationOptions.NotOnFaulted);
				} catch (OperationCanceledException) {
				}
			});
		}