コード例 #1
0
 public void InvokeNext(string s, ThreadStart e)
 {
     OneAtATimeQueue.Enqueue(s, () =>
     {
         e();
     });
 }
コード例 #2
0
        /// <summary>
        /// Initialize everything that needs to be initialized once we're logged in.
        /// </summary>
        /// <param name="login">The status of the login</param>
        /// <param name="message">Error message on failure, MOTD on success.</param>
        public void Network_OnLogin(object sender, LoginProgressEventArgs e)
        {
            var message = e.Message;
            var login   = e.Status;

            if (_BotLoginParams == null)
            {
                SetLoginName(gridClient.Self.FirstName, gridClient.Self.LastName);
            }
            else
            {
                _BotLoginParams.Status = login;
            }
            if (login == LoginStatus.Success)
            {
                // Start in the inventory root folder.
                if (Inventory.Store != null)
                {
                    CurrentDirectory = Inventory.Store.RootFolder; //.RootFolder;
                }
                else
                {
                    Logger.Log("Cannot get Inventory.Store.RootFolder", OpenMetaverse.Helpers.LogLevel.Error);
                    CurrentDirectory = null;
                }
                OneAtATimeQueue.Enqueue(RunOnLogin);
            } // anyhitng other than success NeedRunOnLogin
            else
            {
                NeedRunOnLogin = true;
            }
            //            WriteLine("ClientManager Network_OnLogin : [" + login.ToString() + "] " + message);
            //SendNewEvent("On-Login", login, message);

            if (login == LoginStatus.Failed)
            {
                ExpectConnected = false;
                SendNetworkEvent("On-Login-Fail", login, message);
                WriteLine("Login Failed " + message + " LoginRetries: " + LoginRetries);
                if (LoginRetries <= 0)
                {
                    if (_BotLoginParams != null)
                    {
                        _BotLoginParams.LoginEvent.Set();
                    }
                    return;
                }
                LoginRetries--;
                Login(false);
            }
            else if (login == LoginStatus.Success)
            {
                if (!ClientManager.StarupLispCreatedBotClients)
                {
                    CogbotGUI.GetLoginOptionsFromRadegast(TheRadegastInstance, this);
                }
                LoginRetries = 0; // maybe LoginRetriesFresh??
                WriteLine("Logged in successfully");
                ExpectConnected = true;
                SendNetworkEvent("On-Login-Success", login, message);
                //                SendNewEvent("on-login-success",login,message);
                if (_BotLoginParams != null)
                {
                    _BotLoginParams.LoginEvent.Set();
                }
            }
            else
            {
                SendNetworkEvent("On-Login", login, message);
            }
        }