本文整理汇总了C#中Service.LogoffAsync方法的典型用法代码示例。如果您正苦于以下问题:C# Service.LogoffAsync方法的具体用法?C# Service.LogoffAsync怎么用?C# Service.LogoffAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Service
的用法示例。
在下文中一共展示了Service.LogoffAsync方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SearchRealTime
/// <summary>
/// Do real time seach
/// </summary>
/// <param name="service">The service.</param>
/// <returns></returns>
static async Task SearchRealTime(Service service)
{
await service.LoginAsync("admin", "changeme");
// Realtime window is 5 minutes
var jobArgs = new JobArgs("search index=_internal")
{
SearchMode = SearchMode.Realtime,
EarliestTime = "rt-5m",
LatestTime = "rt",
};
Job job = await service.CreateJobAsync(jobArgs);
//this sleep should be removed if DVPL-4503 is fixed.
//Thread.Sleep(5000);
for (var i = 0; i < 5; i++)
{
System.Console.WriteLine("============================= Snapshot {0}=================================", i);
using (SearchResults searchResults = await job.GetSearchResultsPreviewAsync())
{
System.Diagnostics.Debug.Assert(!searchResults.AreFinal);
System.Console.WriteLine("searchResults count:{0}", searchResults.Count());
}
Thread.Sleep(1000);
}
await job.CancelAsync();
await service.LogoffAsync();
}
示例2: OneshotSearch
/// <summary>
/// Called when [search].
/// </summary>
/// <param name="service">The service.</param>
/// <returns></returns>
static async Task OneshotSearch(Service service)
{
//// Login
await service.LoginAsync("admin", "changeme");
// Simple oneshot search
using (SearchResults searchResults = await service.SearchOneshotAsync("search index=_internal | head 5"))
{
foreach (Result record in searchResults)
{
Console.WriteLine(record);
}
}
//Use JobArgs to define the search
JobArgs args = new JobArgs("search index=_internal | head 5")
{
AutoCancel = 0,
};
using (SearchResults searchResults = await service.SearchOneshotAsync(args))
{
foreach (Result record in searchResults)
{
Console.WriteLine(record);
}
}
await service.LogoffAsync();
}