本文整理汇总了C#中CodeActivityContext.Track方法的典型用法代码示例。如果您正苦于以下问题:C# CodeActivityContext.Track方法的具体用法?C# CodeActivityContext.Track怎么用?C# CodeActivityContext.Track使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CodeActivityContext
的用法示例。
在下文中一共展示了CodeActivityContext.Track方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Execute
protected override void Execute(CodeActivityContext context)
{
// Create a Lead class and populate it with the input arguments
Lead l = new Lead();
l.ContactName = ContactName.Get(context);
l.ContactPhone = ContactPhone.Get(context);
l.Interests = Interests.Get(context);
l.Comments = Notes.Get(context);
l.WorkflowID = context.WorkflowInstanceId;
l.Status = "Open";
// Add this to the work queue to be persisted later
PersistLead persist = context.GetExtension<PersistLead>();
persist.AddLead(l, "Insert");
// Store the request in the OutArgument
Lead.Set(context, l);
// Add a custom track record
CustomTrackingRecord userRecord = new CustomTrackingRecord("New Lead")
{
Data =
{
{"Name", l.ContactName},
{"Phone", l.ContactPhone}
}
};
// Emit the custom tracking record
context.Track(userRecord);
}
示例2: Execute
protected override void Execute(CodeActivityContext context)
{
DateTime startLookup = DateTime.Now;
string symbol = StockSymbol.Get(context);
double price = knownSymbols[symbol];
Value.Set(context, price);
DateTime endLookup = DateTime.Now;
TimeSpan lookupTime = endLookup - startLookup;
CustomTrackingRecord userRecord = new CustomTrackingRecord("QuoteLookupEvent");
userRecord.Data.Add("LookupTime", lookupTime.TotalMilliseconds);
userRecord.Data.Add("Units", "Milliseconds");
context.Track(userRecord);
}
示例3: Execute
protected override void Execute(CodeActivityContext context)
{
// create and set the record data
CustomTrackingRecord customRecord = new CustomTrackingRecord("ActionExecuted");
customRecord.Data.Add("HiringRequestId", this.HiringRequestId.Get(context));
customRecord.Data.Add("State", this.State.Get(context));
customRecord.Data.Add("Date", DateTime.Now);
customRecord.Data.Add("Action", this.Action.Get(context));
customRecord.Data.Add("Comment", this.Comment.Get(context));
if (this.Employee.Get(context) != null)
{
customRecord.Data.Add("EmployeeId", this.Employee.Get(context).Id);
customRecord.Data.Add("EmployeeName", this.Employee.Get(context).Name);
}
// emit the record
context.Track(customRecord);
}
示例4: LogMessage
/// <summary>
/// Messages are logged to build log if the user instructed us to log (through the VerboseLogging argument) or if an error occured
/// </summary>
private void LogMessage(String message, CodeActivityContext context, bool isError = false)
{
bool shouldLog = context.GetValue(this.VerboseLogging);
if (shouldLog || isError)
{
BuildInformationRecord<BuildMessage> record =
new BuildInformationRecord<BuildMessage>()
{
Value = new BuildMessage()
{
Importance = BuildMessageImportance.High,
Message = message,
},
};
context.Track(record);
}
}
示例5: TrackMessage
private void TrackMessage(CodeActivityContext context, string message)
{
context.Track(new BuildInformationRecord<BuildMessage>
{
Value = new BuildMessage()
{
Importance = BuildMessageImportance.Normal,
Message = message,
},
});
}
示例6: Execute
/// <summary>
/// The execute.
/// </summary>
/// <param name="context">
/// The context.
/// </param>
protected override void Execute(CodeActivityContext context)
{
var text = context.GetValue(this.Text);
// Debug.WriteLine(text);
switch (this.Level)
{
case TraceLevel.Error:
Trace.TraceError(text);
break;
case TraceLevel.Info:
Trace.TraceInformation(text);
break;
case TraceLevel.Verbose:
WorkflowTrace.Information(text, this.Category);
break;
case TraceLevel.Warning:
Trace.TraceWarning(text);
break;
}
if (this.Level != TraceLevel.Off)
{
var trackRecord = new CustomTrackingRecord(this.Category, this.Level);
trackRecord.Data.Add("Text", text);
trackRecord.Data.Add("Category", this.Category);
context.Track(trackRecord);
}
}
示例7: Execute
protected override void Execute(CodeActivityContext context)
{
Console.WriteLine("In CustomActivity.Execute");
CustomTrackingRecord customRecord = new CustomTrackingRecord("OrderIn")
{
Data =
{
{"OrderId", 200},
{"OrderDate", "20 Aug 2001"}
}
};
// Emit CustomTrackingRecord
context.Track(customRecord);
}
示例8: Execute
protected override void Execute(CodeActivityContext context)
{
string text = context.GetValue(this.Text);
switch (Level)
{
case System.Diagnostics.TraceLevel.Error:
Trace.TraceError(text);
break;
case System.Diagnostics.TraceLevel.Info:
Trace.TraceInformation(text);
break;
case System.Diagnostics.TraceLevel.Verbose:
Trace.WriteLine(text, Category);
break;
case System.Diagnostics.TraceLevel.Warning:
Trace.TraceWarning(text);
break;
}
if (Level != System.Diagnostics.TraceLevel.Off)
{
var trackRecord = new CustomTrackingRecord(Category, Level);
trackRecord.Data.Add("Text", text);
trackRecord.Data.Add("Category", Category);
context.Track(trackRecord);
}
}
示例9: Execute
protected override void Execute(CodeActivityContext context)
{
context.Track(new TestCustomTrackingRecord("MyRecord") { Value = CustomTrackingTraceTests.TestValue });
}