本文整理汇总了C#中Microsoft.Build.Framework.ProjectFinishedEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# ProjectFinishedEventArgs类的具体用法?C# ProjectFinishedEventArgs怎么用?C# ProjectFinishedEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ProjectFinishedEventArgs类属于Microsoft.Build.Framework命名空间,在下文中一共展示了ProjectFinishedEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VerifyEventType
public void VerifyEventType()
{
BuildFinishedEventArgs buildFinished = new BuildFinishedEventArgs("Message", "Keyword", true);
BuildStartedEventArgs buildStarted = new BuildStartedEventArgs("Message", "Help");
BuildMessageEventArgs lowMessage = new BuildMessageEventArgs("Message", "help", "sender", MessageImportance.Low);
TaskStartedEventArgs taskStarted = new TaskStartedEventArgs("message", "help", "projectFile", "taskFile", "taskName");
TaskFinishedEventArgs taskFinished = new TaskFinishedEventArgs("message", "help", "projectFile", "taskFile", "taskName", true);
TaskCommandLineEventArgs commandLine = new TaskCommandLineEventArgs("commandLine", "taskName", MessageImportance.Low);
BuildWarningEventArgs warning = new BuildWarningEventArgs("SubCategoryForSchemaValidationErrors", "MSB4000", "file", 1, 2, 3, 4, "message", "help", "sender");
BuildErrorEventArgs error = new BuildErrorEventArgs("SubCategoryForSchemaValidationErrors", "MSB4000", "file", 1, 2, 3, 4, "message", "help", "sender");
TargetStartedEventArgs targetStarted = new TargetStartedEventArgs("message", "help", "targetName", "ProjectFile", "targetFile");
TargetFinishedEventArgs targetFinished = new TargetFinishedEventArgs("message", "help", "targetName", "ProjectFile", "targetFile", true);
ProjectStartedEventArgs projectStarted = new ProjectStartedEventArgs(-1, "message", "help", "ProjectFile", "targetNames", null, null, null);
ProjectFinishedEventArgs projectFinished = new ProjectFinishedEventArgs("message", "help", "ProjectFile", true);
ExternalProjectStartedEventArgs externalStartedEvent = new ExternalProjectStartedEventArgs("message", "help", "senderName", "projectFile", "targetNames");
VerifyLoggingPacket(buildFinished, LoggingEventType.BuildFinishedEvent);
VerifyLoggingPacket(buildStarted, LoggingEventType.BuildStartedEvent);
VerifyLoggingPacket(lowMessage, LoggingEventType.BuildMessageEvent);
VerifyLoggingPacket(taskStarted, LoggingEventType.TaskStartedEvent);
VerifyLoggingPacket(taskFinished, LoggingEventType.TaskFinishedEvent);
VerifyLoggingPacket(commandLine, LoggingEventType.TaskCommandLineEvent);
VerifyLoggingPacket(warning, LoggingEventType.BuildWarningEvent);
VerifyLoggingPacket(error, LoggingEventType.BuildErrorEvent);
VerifyLoggingPacket(targetStarted, LoggingEventType.TargetStartedEvent);
VerifyLoggingPacket(targetFinished, LoggingEventType.TargetFinishedEvent);
VerifyLoggingPacket(projectStarted, LoggingEventType.ProjectStartedEvent);
VerifyLoggingPacket(projectFinished, LoggingEventType.ProjectFinishedEvent);
VerifyLoggingPacket(externalStartedEvent, LoggingEventType.CustomEvent);
}
示例2: EventArgsCtors
public void EventArgsCtors()
{
ProjectFinishedEventArgs projectFinishedEvent = new ProjectFinishedEventArgs2();
projectFinishedEvent = new ProjectFinishedEventArgs("Message", "HelpKeyword", "ProjectFile", true);
projectFinishedEvent = new ProjectFinishedEventArgs("Message", "HelpKeyword", "ProjectFile", true, DateTime.Now);
projectFinishedEvent = new ProjectFinishedEventArgs(null, null, null, true);
projectFinishedEvent = new ProjectFinishedEventArgs(null, null, null, true, DateTime.Now);
}
示例3: eventSource_ProjectFinished
void eventSource_ProjectFinished(object sender, ProjectFinishedEventArgs e)
{
Stopwatch.Stop();
WriteMessage(String.Format("\nBuild {0}.", (e.Succeeded ? "succeeded" : "FAILED")));
WriteMessage(String.Format("Time Elapsed {0:00}:{1:00}:{2:00}.{3:00}",
Stopwatch.Elapsed.Hours,
Stopwatch.Elapsed.Minutes,
Stopwatch.Elapsed.Seconds,
Stopwatch.Elapsed.Milliseconds));
Stopwatch = null;
}
示例4: AssignmentTest
public void AssignmentTest ()
{
ProjectFinishedEventArgs pfea;
string message = "message";
string helpKeyword = "helpKeyword";
string projectFile = "projectFile";
bool succeeded = true;
pfea = new ProjectFinishedEventArgs (message, helpKeyword, projectFile, succeeded);
Assert.AreEqual (message, pfea.Message, "Message");
Assert.AreEqual (helpKeyword, pfea.HelpKeyword, "HelpKeyword");
Assert.AreEqual (projectFile, pfea.ProjectFile, "ProjectFile");
Assert.AreEqual (succeeded, pfea.Succeeded, "Succeeded");
}
示例5: eventSource_ProjectFinishedHandler
private void eventSource_ProjectFinishedHandler(object sender, ProjectFinishedEventArgs e)
{
LogStageFinished(e.Succeeded, e.Timestamp);
}
示例6: ProjectFinishedHandler
/// <summary>
/// This is the delegate for ProjectFinishedHandler events.
/// </summary>
private void ProjectFinishedHandler(object sender, ProjectFinishedEventArgs buildEvent)
{
try
{
if (LogAtImportance(buildEvent.Succeeded ? MessageImportance.Low
: MessageImportance.High))
{
LogEvent(sender, buildEvent);
}
}
catch (Exception e)
{
Debug.Assert(false, "Problem logging projectfinished event: " + e.Message + " at " + e.TargetSite);
// swallow the exception
}
}
示例7: ProjectFinishedHandler
/// <summary>
/// This is the delegate for ProjectFinishedHandler events.
/// </summary>
private void ProjectFinishedHandler(object sender, ProjectFinishedEventArgs buildEvent)
{
if (LogAtImportance(buildEvent.Succeeded ? MessageImportance.Low
: MessageImportance.High))
{
LogEvent(sender, buildEvent);
}
}
示例8: ProjectFinishedHandler
/// <summary>
/// This is the delegate for ProjectFinishedHandler events.
/// </summary>
protected virtual void ProjectFinishedHandler(object sender, ProjectFinishedEventArgs buildEvent)
{
if (buildEvent == null)
throw new ArgumentNullException("buildEvent");
// NOTE: This may run on a background thread!
QueueOutputEvent(buildEvent.Succeeded ? MessageImportance.Low : MessageImportance.High, buildEvent);
}
示例9: IsEquivalent
/// <summary>
/// Compare this build event context with another object to determine
/// equality. This means the values inside the object are identical.
/// </summary>
/// <param name="obj">Object to compare to this object</param>
/// <returns>True if the object values are identical, false if they are not identical</returns>
public static bool IsEquivalent(ProjectFinishedEventArgs args, ProjectFinishedEventArgs other)
{
if (args.Succeeded != other.Succeeded)
{
return false;
}
if (!String.Equals(args.ProjectFile, other.ProjectFile, StringComparison.OrdinalIgnoreCase))
{
return false;
}
return ((BuildEventArgs)args).IsEquivalent(other);
}
示例10: RaiseProjectFinishedEvent
/// <summary>
/// Raises a "project build finished" event to all registered loggers.
/// </summary>
/// <param name="sender">sender of the event</param>
/// <param name="buildEvent">ProjectFinishedEventArgs</param>
/// <exception cref="LoggerException">When EventHandler raises an logger exception the LoggerException is rethrown</exception>
/// <exception cref="InternalLoggerException">Any exceptions which are not LoggerExceptions are wrapped in an InternalLoggerException</exception>
/// <exception cref="Exception">ExceptionHandling.IsCriticalException exceptions will not be wrapped</exception>
private void RaiseProjectFinishedEvent(object sender, ProjectFinishedEventArgs buildEvent)
{
if (ProjectFinished != null)
{
try
{
ProjectFinished(sender, buildEvent);
}
catch (LoggerException)
{
// if a logger has failed politely, abort immediately
// first unregister all loggers, since other loggers may receive remaining events in unexpected orderings
// if a fellow logger is throwing in an event handler.
this.UnregisterAllEventHandlers();
throw;
}
catch (Exception exception)
{
// first unregister all loggers, since other loggers may receive remaining events in unexpected orderings
// if a fellow logger is throwing in an event handler.
this.UnregisterAllEventHandlers();
if (ExceptionHandling.IsCriticalException(exception))
{
throw;
}
InternalLoggerException.Throw(exception, buildEvent, "FatalErrorWhileLogging", false);
}
}
RaiseStatusEvent(sender, buildEvent);
}
示例11: ProjectFinishedHandler
/// <summary>
/// Handler for project finished events
/// </summary>
/// <param name="sender">sender (should be null)</param>
/// <param name="e">event arguments</param>
public void ProjectFinishedHandler(object sender, ProjectFinishedEventArgs e)
{
InitializeBaseConsoleLogger(); // for compat: see DDB#136924
_consoleLogger.ProjectFinishedHandler(sender, e);
}
示例12: OnProjectFinished
private void OnProjectFinished(object sender, ProjectFinishedEventArgs e)
{
indent--;
Messages.Add(Message.CreateInfo(GetLine("Finished {0}", e.ProjectFile)));
}
示例13: TestProjectFinishedEventArgs
public void TestProjectFinishedEventArgs()
{
// Test with reasonable values
ProjectFinishedEventArgs genericEvent = new ProjectFinishedEventArgs("Message", "HelpKeyword", "ProjectFile", true);
genericEvent.BuildEventContext = new BuildEventContext(5, 4, 3, 2);
// Serialize
genericEvent.WriteToStream(_writer);
long streamWriteEndPosition = _stream.Position;
// Deserialize and Verify
_stream.Position = 0;
ProjectFinishedEventArgs newGenericEvent = new ProjectFinishedEventArgs(null, null, null, false);
newGenericEvent.CreateFromStream(_reader, _eventArgVersion);
long streamReadEndPosition = _stream.Position;
Assert.IsTrue(streamWriteEndPosition == streamReadEndPosition, "Stream End Positions Should Match");
VerifyGenericEventArg(genericEvent, newGenericEvent);
Assert.IsTrue(genericEvent.Succeeded == newGenericEvent.Succeeded, "Expected Succeeded to Match");
Assert.IsTrue(string.Compare(genericEvent.ProjectFile, newGenericEvent.ProjectFile, StringComparison.OrdinalIgnoreCase) == 0, "Expected ProjectFile to Match");
// Test with empty strings
_stream.Position = 0;
genericEvent = new ProjectFinishedEventArgs(string.Empty, string.Empty, string.Empty, true);
genericEvent.BuildEventContext = new BuildEventContext(5, 4, 3, 2);
// Serialize
genericEvent.WriteToStream(_writer);
streamWriteEndPosition = _stream.Position;
// Deserialize and Verify
_stream.Position = 0;
newGenericEvent = new ProjectFinishedEventArgs(null, null, null, false);
newGenericEvent.CreateFromStream(_reader, _eventArgVersion);
streamReadEndPosition = _stream.Position;
Assert.IsTrue(streamWriteEndPosition == streamReadEndPosition, "Stream End Positions Should Match");
VerifyGenericEventArg(genericEvent, newGenericEvent);
Assert.IsTrue(genericEvent.Succeeded == newGenericEvent.Succeeded, "Expected Succeeded to Match");
Assert.IsTrue(string.Compare(genericEvent.ProjectFile, newGenericEvent.ProjectFile, StringComparison.OrdinalIgnoreCase) == 0, "Expected ProjectFile to Match");
// Test with null strings
_stream.Position = 0;
// Make sure null string are passed correctly
genericEvent = new ProjectFinishedEventArgs(null, null, null, true);
genericEvent.BuildEventContext = null;
// Serialize
genericEvent.WriteToStream(_writer);
streamWriteEndPosition = _stream.Position;
// Deserialize and Verify
_stream.Position = 0;
newGenericEvent = new ProjectFinishedEventArgs("Something", "Something", "Something", false);
newGenericEvent.CreateFromStream(_reader, _eventArgVersion);
streamReadEndPosition = _stream.Position;
Assert.IsTrue(streamWriteEndPosition == streamReadEndPosition, "Stream End Positions Should Match");
VerifyGenericEventArg(genericEvent, newGenericEvent);
Assert.IsTrue(genericEvent.Succeeded == newGenericEvent.Succeeded, "Expected Succeeded to Match");
Assert.IsTrue(string.Compare(genericEvent.ProjectFile, newGenericEvent.ProjectFile, StringComparison.OrdinalIgnoreCase) == 0, "Expected ProjectFile to Match");
}
示例14: eventSource_ProjectFinished
void eventSource_ProjectFinished(object sender, ProjectFinishedEventArgs e)
{
WriteLine(String.Empty, e, MessageType.Info);
}
示例15: ProjectFinishedHandler
/// <summary>
/// Handler for project finished events
/// </summary>
/// <param name="sender">sender (should be null)</param>
/// <param name="e">event arguments</param>
public override void ProjectFinishedHandler(object sender, ProjectFinishedEventArgs e)
{
if (this.showPerfSummary)
{
PerformanceCounter counter = GetPerformanceCounter(e.ProjectFile, ref projectPerformanceCounters);
// Place the counter "in scope" meaning the project is done executing right now.
counter.InScope = false;
}
// if verbosity is detailed or diagnostic,
// or there was an error or warning
if (contextStack.Peek().hasErrorsOrWarnings
|| (IsVerbosityAtLeast(LoggerVerbosity.Detailed)))
{
setColor(ConsoleColor.Cyan);
if (IsVerbosityAtLeast(LoggerVerbosity.Normal))
{
WriteNewLine();
}
WriteLinePretty(e.Message);
resetColor();
}
Frame top = contextStack.Pop();
this.VerifyStack(top.type == FrameType.Project, "Unexpected project frame {0}", top.ID);
this.VerifyStack(top.ID == e.ProjectFile, "Project frame {0} expected, but was {1}.", e.ProjectFile, top.ID);
}