本文整理汇总了C#中Client.Logout方法的典型用法代码示例。如果您正苦于以下问题:C# Client.Logout方法的具体用法?C# Client.Logout怎么用?C# Client.Logout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Client
的用法示例。
在下文中一共展示了Client.Logout方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestMessageSearch
public static void TestMessageSearch()
{
var client = new Client(ClientUrl, timeout: int.MaxValue);
try
{
var sw = Stopwatch.StartNew();
var loginStatus = client.Login(ClientUsername, ClientPassword, "0.0.0");
var channel = client.GetChannels("d24f9ca7-d696-4ffd-b86e-484669213fa8").Channels[0];
Console.WriteLine("Loaded Channel [{0}] in {1}ms ", channel.Name, sw.Elapsed.TotalMilliseconds.ToString("N2"));
Console.WriteLine("Found {0} metadata columns: {1}", channel.Properties.MetaDataColumns.Items.Count, string.Join(",", channel.Properties.MetaDataColumns.Items.Select(x => x.Name).ToArray()));
sw.Restart();
var maxMessageId = client.GetMaxMessageId(channel.Id);
var filter = new MessageFilter()
{
MaxMessageId = maxMessageId,
//Statuses = new List<string>() { "ERROR" },
//EndDate = DateTime.Now.Date.AddDays(-7),
MetaDataSearch = new List<MetaDataSearchCriteria>
{
new MetaDataSearchCriteria
{
ColumnName = "PATIENT_ID",
Value = new MetaDataSearchCriteriaValue("00556249"),
Operator = MetaDataSearchOperator.STARTS_WITH,
IgnoreCase = "true",
},
},
MinMessageId = 896930,
};
var messageCount = client.GetMessageCount(channel.Id, filter);
Console.WriteLine("Counted {0} messages in {1}ms", messageCount, sw.Elapsed.TotalMilliseconds.ToString("N2"));
sw.Restart();
var messages_nocontent = client.GetMessages(channel.Id, filter, false, 0, 51);
Console.WriteLine("Loaded {0} messages in {1}ms", messages_nocontent.Messages.Count, sw.Elapsed.TotalMilliseconds.ToString("N2"));
var messages_rows = messages_nocontent.Messages.SelectMany(x => x.AsFlatMessageRows()).ToArray();
}
finally
{
client.Logout();
}
}
示例2: HelpLogOut
public void HelpLogOut(Client.ServerServicesClient client,int sessionId)
{
client.Logout(sessionId);
}
示例3: Main
public static int Main(string[] args)
{
if (args.Length == 0 || args[0] == "--help") {
Console.WriteLine ("Usage: sample-client <host> [<track_id> <track_id> ...]");
Console.WriteLine ("Pass a track id of 'ALL' to download all tracks.");
return 1;
}
ushort port = 3689;
if (Environment.GetEnvironmentVariable ("PORT") != null)
port = UInt16.Parse (Environment.GetEnvironmentVariable ("PORT"));
Client client = new Client (args[0], port);
if (client.AuthenticationMethod == AuthenticationMethod.None) {
client.Login ();
} else {
string user = null;
string pass = null;
if (client.AuthenticationMethod == AuthenticationMethod.UserAndPassword) {
Console.Write ("Username for '{0}': ", client.Name);
user = Console.ReadLine ();
}
Console.Write ("Password for '{0}': ", client.Name);
pass = Console.ReadLine ();
client.Login (user, pass);
}
try {
Console.WriteLine ("Server: " + client.Name);
if (args.Length > 1) {
for (int i = 1; i < args.Length; i++) {
foreach (Database db in client.Databases) {
if (args[i] == "ALL") {
for(int j = 0; j < db.TrackCount; j++) {
Console.WriteLine ("Downloading ({0} of {1}): {2}", j + 1, db.TrackCount,
db.TrackAt(j).Title);
DownloadTrack (db, db.TrackAt(j));
}
} else {
int id = Int32.Parse (args[i]);
Track track = db.LookupTrackById (id);
if (track == null) {
Console.WriteLine ("WARNING: no track with id '{0}' was found.", id);
continue;
}
Console.WriteLine ("Downloading: " + track.Title);
DownloadTrack (db, track);
}
}
}
} else {
foreach (Database db in client.Databases) {
Console.WriteLine ("Database: " + db.Name);
foreach (Track track in db.Tracks)
Console.WriteLine (track);
foreach (Playlist pl in db.Playlists) {
Console.WriteLine ("Playlist: " + pl.Name);
foreach (Track track in pl.Tracks) {
Console.WriteLine (track);
}
}
}
}
} finally {
client.Logout ();
}
return 0;
}
示例4: PurgeERRORMessages
public static void PurgeERRORMessages()
{
var client = new Client(ClientUrl, timeout: int.MaxValue);
var loginStatus = client.Login(ClientUsername, ClientPassword, "0.0.0");
var channelSummaryList = client.GetChannelSummary();
Console.WriteLine("Found " + channelSummaryList.Channels.Count + " channels...");
for (int i = 0; i < channelSummaryList.Channels.Count; i++)
{
try
{
var channelId = channelSummaryList.Channels[i].GetChannelId();
Console.Write((i) + " ");
var maxMessageId = client.GetMaxMessageId(channelId);
if (maxMessageId == 0)
{
Console.WriteLine();
continue;
}
var filter = new MessageFilter()
{
MaxMessageId = maxMessageId,
Statuses = new List<string>() { "ERROR" },
EndDate = DateTime.Now.Date.AddDays(-7),
};
var messageCount = client.GetMessageCount(channelId, filter);
var channel = client.GetChannels(channelId).Channels.Single();
Console.Write("Found " + messageCount + " messages for " + channel.Name + "...");
if (messageCount == 0)
{
Console.WriteLine();
continue;
}
var sw = Stopwatch.StartNew();
client.RemoveMessages(channelId, filter);
sw.Stop();
Console.WriteLine(" Deleted in " + sw.Elapsed.TotalSeconds.ToString("N2") + " sec.");
}
catch (Exception e)
{
Console.Write(" ERROR: " + e.Message);
}
}
client.Logout();
}
示例5: FindFailedToDeployConnectors
public static void FindFailedToDeployConnectors()
{
var client = new Client(ClientUrl, timeout: int.MaxValue);
var loginStatus = client.Login(ClientUsername, ClientPassword, "0.0.0");
var channelStatusList = client.GetChannelStatusList().DashboardStatuses;
foreach (var item in channelStatusList.OrderBy(x => x.Name))
{
Console.Write("{0} deployed with {1} connectors. ", item.Name.MaxOrPad(30), item.ChildStatuses.DashboardStatuses.Count);
var channelId = item.ChannelId;
var channel = client.GetChannels(channelId).Channels.Single();
var connectors = channel.GetAllEnabledConnectors();
if (connectors.Count != item.ChildStatuses.DashboardStatuses.Count)
{
Console.Write("WARNING: Found {0} configured connectors!", connectors.Count);
Console.Error.Write("WARNING: Found {0} configured connectors!", connectors.Count);
}
Console.WriteLine();
}
client.Logout();
}
示例6: ListChannels
public static void ListChannels()
{
var client = new Client(ClientUrl, timeout: int.MaxValue);
var loginStatus = client.Login(ClientUsername, ClientPassword, "0.0.0");
var channelSummaryList = client.GetChannelSummary();
Console.WriteLine("Found " + channelSummaryList.Channels.Count + " channels...");
Console.WriteLine("Index^Channel Name^Description^Max Message Id^Revision^Enabled^Channel Id");
for (int i = 0; i < channelSummaryList.Channels.Count; i++)
{
try
{
var channelId = channelSummaryList.Channels[i].GetChannelId();
var maxMessageId = client.GetMaxMessageId(channelId);
var channel = client.GetChannels(channelId).Channels.Single();
Console.WriteLine(string.Format(@"{0}^{1}^{2}^{3}^{4}^{5}^{6}", i, channel.Name, channel.Description.Replace("\n", " "), maxMessageId, channel.Revision, channel.Enabled, channelId));
}
catch (Exception e)
{
Console.WriteLine(" ERROR: " + e.Message);
}
}
client.Logout();
}