本文整理汇总了C#中IRuntime类的典型用法代码示例。如果您正苦于以下问题:C# IRuntime类的具体用法?C# IRuntime怎么用?C# IRuntime使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IRuntime类属于命名空间,在下文中一共展示了IRuntime类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IavaCamera
/// <summary>
/// Constructor used for unit testing
/// </summary>
/// <param name="runtime">IRuntime object to provide the data to the camera</param>
internal IavaCamera(IRuntime runtime)
{
// Set the IRuntime object
_runtime = runtime;
InitializeDevice();
}
示例2: SetMessageValuesIfNotSetInClient
private static void SetMessageValuesIfNotSetInClient(RequestHeader message, IRuntime runtime)
{
if (runtime == null) return;
if (message.MessageId.IsNullOrWhiteSpace())
message.MessageId = Guid.NewGuid().ToString();
if (message.Environment.IsNullOrWhiteSpace())
message.Environment = runtime.Environment;
if (message.ServiceName.IsNullOrWhiteSpace())
message.ServiceName = runtime.ServiceName;
if (message.ConfigSet.IsNullOrWhiteSpace())
message.ConfigSet = Utilities.GetConfigSetName();
if (message.TimeStamp == null)
message.TimeStamp = DateTime.UtcNow;
if (runtime.RequestContext.IsInstance() && runtime.RequestContext.RequestHeader.IsInstance())
{
message.ReferingMessageId = runtime.RequestContext.RequestHeader.MessageId;
}
string supportCode;
if (runtime.TryGetSupportCode(out supportCode)) message.SupportCode = supportCode;
else
{
if (runtime.RequestContext.IsInstance() && runtime.RequestContext.RequestHeader.IsInstance())
{
message.SupportCode = runtime.RequestContext.RequestHeader.SupportCode;
}
}
}
示例3: PartCoverTestIsolationProvider
/// <summary>
/// Initializes the isolation provider.
/// </summary>
/// <param name="runtime">The runtime.</param>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="runtime"/> is null.</exception>
public PartCoverTestIsolationProvider(IRuntime runtime)
{
if (runtime == null)
throw new ArgumentNullException("runtime");
this.runtime = runtime;
}
示例4: ReportPrimes
private static void ReportPrimes(IRuntime runtime, List<int> primes, int n, int client)
{
// item 229
string[] primesAsText = primes
.Select(p => p.ToString())
.ToArray();
// item 226
string primeString = String.Join(
"\n",
primesAsText
);
// item 227
string result = String.Format(
"Prime numbers up to {0}: {1} found:\n{2}",
n,
primes.Count,
primeString
);
// item 228
runtime.SendMessage(
client,
CallResult.Completed,
result,
0
);
}
示例5: DownloadCompleted
private static void DownloadCompleted(IRuntime runtime, int caller, DownloadDataCompletedEventArgs e)
{
// item 255
if (e.Cancelled) {
// item 258
runtime.SendMessage(
caller,
Cancel,
null,
0
);
} else {
// item 259
if (e.Error == null) {
// item 262
runtime.SendMessage(
caller,
CallResult.Completed,
e.Result,
0
);
} else {
// item 261
runtime.SendMessage(
caller,
CallResult.Error,
e.Error,
0
);
}
}
}
示例6: IsolatedProcessHostFactory
/// <summary>
/// Creates a host factory.
/// </summary>
/// <param name="runtime">The runtime.</param>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="runtime"/> is null.</exception>
public IsolatedProcessHostFactory(IRuntime runtime)
{
if (runtime == null)
throw new ArgumentNullException("runtime");
runtimePath = runtime.GetRuntimeSetup().RuntimePath;
}
示例7: ExternalThread
public ExternalThread(string name, IRuntime runtime, IActorLogger logger, IErrorHandler errorHandler, Action<Action> dispatchMethod)
{
_name = name;
_runtime = runtime;
_logger = logger;
_errorHandler = errorHandler;
_dispatcher = dispatchMethod;
}
示例8: NCoverTestIsolationProvider
/// <summary>
/// Initializes the isolation provider.
/// </summary>
/// <param name="runtime">The runtime.</param>
/// <param name="version">The NCover version.</param>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="runtime"/> is null.</exception>
public NCoverTestIsolationProvider(IRuntime runtime, NCoverVersion version)
{
if (runtime == null)
throw new ArgumentNullException("runtime");
this.runtime = runtime;
this.version = version;
}
示例9: CreateSeleniumArgs
public static LazyDownloadArgs CreateSeleniumArgs(IRuntime runtime, int line, int threadCount, string cssElement, int cssTimeout, Table<ResultRow> table)
{
var args = new LazyDownloadArgs(runtime, threadCount);
foreach (var row in table)
args.Wires.Add(new SeleniumHttpWire(row[0].ToString(), cssElement, cssTimeout, runtime, line));
return args;
}
示例10: CreateWebRequestArgs
public static LazyDownloadArgs CreateWebRequestArgs(IRuntime runtime, int line, int threadCount, Table<ResultRow> table)
{
var args = new LazyDownloadArgs(runtime, threadCount);
foreach (var row in table)
args.Wires.Add(new WebRequestHttpWire(row[0].ToString(), runtime, line));
return args;
}
示例11: Deactivate
public static void Deactivate(IRuntime runtime)
{
lock (_currentLock)
{
_active.ContainsKey(Thread.CurrentThread).AssertTrue();
ReferenceEquals(_active[Thread.CurrentThread], runtime).AssertTrue();
_active.Remove(Thread.CurrentThread);
}
}
示例12: DedicatedThread
public DedicatedThread(string name, IRuntime runtime, IActorLogger logger, IErrorHandler errorHandler, int actorId, IActor actor)
{
_actor = actor;
_actorId = actorId;
_name = name;
_runtime = runtime;
_logger = logger;
_errorHandler = errorHandler;
}
示例13: DownloadImage
public static RuntimeTable<DownloadImage> DownloadImage(IRuntime runtime, string url, int line)
{
var table = new RuntimeTable<DownloadImage>();
var image = GetImage(runtime.RequestFactory, new WebRequestHttpWire(url, runtime, line));
table.Add(image);
return table;
}
示例14: Activate
public static IDisposable Activate(IRuntime runtime)
{
lock (_currentLock)
{
_active.ContainsKey(Thread.CurrentThread).AssertFalse();
_active.ContainsValue(runtime).AssertFalse();
_active.Add(Thread.CurrentThread, runtime);
return new DisposableAction(() => Deactivate(runtime));
}
}
示例15: DownloadPage
private static RuntimeTable<DownloadPage> DownloadPage(IRuntime runtime, IHttpWire[] wires)
{
var table = new RuntimeTable<DownloadPage>();
foreach (var wire in wires)
{
int contentlength;
var doc = GetDocument(runtime.RequestFactory, wire, out contentlength);
table.Add(new DownloadPage() { url = wire.Url, nodes = new[] { doc.DocumentNode }, date = DateTime.Now, size = contentlength });
}
return table;
}