本文整理汇总了C#中ClientState.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ClientState.ToString方法的具体用法?C# ClientState.ToString怎么用?C# ClientState.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ClientState
的用法示例。
在下文中一共展示了ClientState.ToString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProduceClientState
public static bool ProduceClientState(Interactor intr, ClientState desiredState, int attemptCount)
{
if (intr.CancelSource.Token.IsCancellationRequested) { return false; }
attemptCount += 1;
intr.Log(LogEntryType.Info, "Attempting to produce client state: " + desiredState.ToString());
if (States.IsClientState(intr, desiredState)) {
intr.Log(LogEntryType.Info, "Client state is already: " + desiredState.ToString());
return true;
} else if (desiredState == ClientState.Inactive) {
if (States.IsGameState(intr, GameState.ClientActive)) {
intr.Log( "Minimizing client...");
Screen.WindowMinimize(intr, States.GAMECLIENTEXE);
}
return true;
} else if (desiredState == ClientState.None) {
intr.Log("Attempting to close game client...");
KillAll(intr);
return true;
} else if (desiredState == ClientState.CharSelect) {
var currentClientState = States.DetermineClientState(intr);
intr.Log(LogEntryType.Debug, "Interactions::ProduceClientState(): Current client state is " +
currentClientState.ToString());
switch (currentClientState) {
case ClientState.None:
intr.Log("Launching patcher...");
return PatcherLogin(intr, desiredState);
case ClientState.Inactive:
intr.Log("Game client is currently in the background. Waiting 30 seconds " +
"or until client is brought to foreground before continuing...");
const int waitIncr = 5000;
for (int i = 0; i < 30000; i += waitIncr) {
if (!States.IsClientState(intr, ClientState.Inactive)) { break; }
intr.Wait(waitIncr);
}
//intr.Wait(30000);
intr.Log("Activating Client...");
ActivateClient(intr);
return intr.WaitUntil(10, ClientState.CharSelect, States.IsClientState, ProduceClientState, attemptCount);
case ClientState.InWorld:
if (attemptCount >= 10) {
intr.Log(LogEntryType.FatalWithScreenshot, "Stuck at in world. Killing all and restarting.");
KillAll(intr);
intr.Wait(5000);
return ProduceClientState(intr, ClientState.CharSelect, 0);
} else {
intr.Log("Logging out...");
LogOut(intr);
return intr.WaitUntil(45, ClientState.CharSelect, States.IsClientState, ProduceClientState, attemptCount);
}
case ClientState.LogIn:
if (attemptCount >= 10) {
intr.Log(LogEntryType.FatalWithScreenshot, "Stuck at client login screen. Killing all and restarting.");
KillAll(intr);
intr.Wait(5000);
return ProduceClientState(intr, ClientState.CharSelect, 0);
} else {
intr.Log("Client open, at login screen.");
ClientSignIn(intr);
return intr.WaitUntil(30, ClientState.CharSelect, States.IsClientState, ProduceClientState, attemptCount);
}
case ClientState.Unknown:
default:
ClearDialogues(intr);
if (!intr.WaitUntil(30, ClientState.CharSelect, States.IsClientState, null, attemptCount)) {
intr.Log(LogEntryType.Info, "Client state unknown. Attempting crash recovery...");
CrashCheckRecovery(intr, 0);
return ProduceClientState(intr, desiredState, attemptCount);
//var curState = Game.DetermineClientState(intr);
//if (curState == ClientState.Unknown) {
// //CrashCheckRecovery(intr);
// return
//} else {
// return
//}
} else {
return true;
}
}
}
return false;
}
示例2: UpdateUserInterface
/// <summary>
/// Updates the user interface based on changes from lync, ie Lync => App update
/// </summary>
/// <param name="currentState"></param>
private void UpdateUserInterface(ClientState currentState)
{
//Update the client state in the user interface
clientStateTextBlock.Text = currentState.ToString();
if (currentState == ClientState.SignedIn)
{
//Listen for events of changes of the contact's information
lyncClient.Self.Contact.ContactInformationChanged += new EventHandler<ContactInformationChangedEventArgs>(SelfContact_ContactInformationChanged);
SetPersonalNote();
}
}