当前位置: 首页>>代码示例>>C#>>正文


C# ClientState.ToString方法代码示例

本文整理汇总了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;
        }
开发者ID:c0gent,项目名称:NeverClicker,代码行数:92,代码来源:ProduceClientState.cs

示例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();
            }
        }
开发者ID:ToreFranzen,项目名称:LotusLyncer,代码行数:16,代码来源:MainWindow.xaml.cs


注:本文中的ClientState.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。