本文整理汇总了C#中ActivityContext.GetExtension方法的典型用法代码示例。如果您正苦于以下问题:C# ActivityContext.GetExtension方法的具体用法?C# ActivityContext.GetExtension怎么用?C# ActivityContext.GetExtension使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActivityContext
的用法示例。
在下文中一共展示了ActivityContext.GetExtension方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VersionControlScope
public VersionControlScope(VersionControlServer server, ActivityContext context)
{
this.Server = server;
if (context != null)
{
this.ActionInvoker = context.GetExtension<ScheduleActionExtension>();
if (this.ActionInvoker == null)
{
throw new ServiceMissingException(typeof(ScheduleActionExtension));
}
}
this.GettingHandlers = new List<Tuple<string, GettingEventHandler>>();
this.NonFatalErrorHandlers = new List<Tuple<string, ExceptionEventHandler>>();
this.NewPendingChangeHandlers = new List<Tuple<string, PendingChangeEventHandler>>();
}
示例2: GetTimerExtension
private TimerExtension GetTimerExtension(ActivityContext context)
{
return context.GetExtension<TimerExtension>();
}
示例3: InitializeChannelCacheEnabledSetting
internal void InitializeChannelCacheEnabledSetting(ActivityContext context)
{
if (!this.channelCacheEnabled.HasValue)
{
SendMessageChannelCache channelCacheExtension = context.GetExtension<SendMessageChannelCache>();
Fx.Assert(channelCacheExtension != null, "channelCacheExtension must exist!");
InitializeChannelCacheEnabledSetting(channelCacheExtension);
}
}
示例4: GetRunInProc
protected bool GetRunInProc(ActivityContext context)
{
bool flag = false;
bool flag1;
HostParameterDefaults extension = context.GetExtension<HostParameterDefaults>();
if (this as PSGeneratedCIMActivity == null)
{
IEnumerator enumerator = context.DataContext.GetProperties().GetEnumerator();
try
{
while (enumerator.MoveNext())
{
PropertyDescriptor current = (PropertyDescriptor)enumerator.Current;
if (!string.Equals(current.DisplayName, "PSRunInProcessPreference", StringComparison.OrdinalIgnoreCase))
{
continue;
}
object value = current.GetValue(context.DataContext);
if (value == null || !LanguagePrimitives.TryConvertTo<bool>(value, CultureInfo.InvariantCulture, out flag))
{
continue;
}
flag1 = flag;
return flag1;
}
this.psActivityContextImplementationVariable.Get(context);
PSWorkflowHost workflowHost = PSActivity.GetWorkflowHost(extension);
return workflowHost.PSActivityHostController.RunInActivityController(this);
}
finally
{
IDisposable disposable = enumerator as IDisposable;
if (disposable != null)
{
disposable.Dispose();
}
}
return flag1;
}
else
{
return true;
}
}
示例5: GenerateLogFile
/// <summary>
/// Make sure we have a log file in place.
/// <para></para>
/// If the user hasn't specified one we will create one for him on
/// the logs drops folder path.
/// <para></para>
/// The file will have the same name as the solution/project being built, plus the
/// context for configuration and platform with the .log file extension
/// </summary>
/// <param name="context">Activity Context</param>
/// <returns>The location of the log file</returns>
private string GenerateLogFile(ActivityContext context)
{
string finalLogFile = null;
var buildDetail = context.GetExtension<IBuildDetail>();
var filePath = this.FilePath.Get(this.ActivityContext);
var configuration = this.Configuration.Get(this.ActivityContext);
var platform = this.Platform.Get(this.ActivityContext);
var fileName = Path.GetFileName(filePath);
if (fileName != null)
{
string logDirectory = string.IsNullOrEmpty(buildDetail.DropLocation)
? Path.GetDirectoryName(filePath)
: Path.Combine(buildDetail.DropLocation, @"logs");
if (!Directory.Exists(logDirectory))
{
Directory.CreateDirectory(logDirectory);
}
finalLogFile = Path.GetFileNameWithoutExtension(fileName);
if (string.IsNullOrWhiteSpace(configuration) == false)
{
finalLogFile += configuration;
}
if (string.IsNullOrWhiteSpace(platform) == false)
{
finalLogFile += platform;
}
finalLogFile += ".log";
finalLogFile = Path.Combine(logDirectory, SanitizeFileName(finalLogFile));
}
this.LogBuildMessage(string.Format("Log file {0} will be used.", finalLogFile));
return finalLogFile;
}
示例6: InitializeChannelCacheEnabledSetting
internal void InitializeChannelCacheEnabledSetting(ActivityContext context)
{
if (!this.channelCacheEnabled.HasValue)
{
SendMessageChannelCache extension = context.GetExtension<SendMessageChannelCache>();
this.InitializeChannelCacheEnabledSetting(extension);
}
}
示例7: GetTimerExtension
TimerExtension GetTimerExtension(ActivityContext context)
{
TimerExtension timerExtension = context.GetExtension<TimerExtension>();
Fx.Assert(timerExtension != null, "TimerExtension must exist.");
return timerExtension;
}
示例8: GenerateLogFile
/// <summary>
/// Make sure we have a log file in place.
/// <para></para>
/// If the user hasn't specified one we will create one for him on
/// the logs drops folder path.
/// <para></para>
/// The file will have the same name of the solution/project being built, plus the
/// context for configuration and platform with the .log file extension
/// </summary>
/// <param name="context">Activity Context</param>
/// <returns>The location of the log file</returns>
private string GenerateLogFile(ActivityContext context)
{
string finalLogFile = null;
string logDirectory;
var buildDetail = context.GetExtension<IBuildDetail>();
var fileName = this.LogFilename.Get(context);
if (fileName == null)
{
return null;
}
if (string.IsNullOrEmpty(buildDetail.LogLocation) == false)
{
logDirectory = buildDetail.LogLocation;
}
else if (string.IsNullOrEmpty(buildDetail.DropLocation) == false)
{
logDirectory = Path.Combine(buildDetail.DropLocation, @"logs");
}
else
{
this.LogBuildWarning("drop location not defined. Will not write to log file");
return null;
}
if (!Directory.Exists(logDirectory))
{
Directory.CreateDirectory(logDirectory);
}
finalLogFile = Path.Combine(logDirectory, SanitizeFileName(fileName));
this.LogBuildMessage(string.Format("Log file {0} will be used.", finalLogFile));
return finalLogFile;
}