Example #1
0
        /// <summary>
        /// This method acts as a callback for the LoginAsync method of the Echelon communicator.
        /// Once the callback attempt is finished -- success or not -- this method is invoked.
        /// </summary>
        /// <param name="result">Result of the login attempt.</param>
        private void LoginFinished(Network.Util.Result result)
        {
            if (result.Success)
            {
                //string latestVersion = ServiceManager.Echelon.CheckClientVersion();
                //System.Console.WriteLine("Latest client version is: " + latestVersion);
                CheckVersion();
            }

            ServiceManager.Game.Invoke(HandleLoginFinished, result);
        }
Example #2
0
        /// <summary>
        /// Handle the login being finished on a separate thread.
        /// </summary>
        /// <param name="resultObj"></param>
        private void HandleLoginFinished(object resultObj)
        {
            Network.Util.Result result = (Network.Util.Result)resultObj;
            if (!result.Success)
            {
                // The login attempt failed.
                ServiceManager.Game.Console.DebugPrint(
                    "Login unsuccessful: {0}", result.Exception.Message);
                // TODO: Message box error. The message is user-friendly.
                MessageBox.Show(ServiceManager.Game.Manager,
                                MessageBox.MessageBoxType.ERROR,
                                result.Exception.Message, result.Exception.Message);
            }
            else
            {
                // The login attempt succeeded.
                ServiceManager.Game.Console.DebugPrint("Login successful.");

                ServiceManager.StateManager.ChangeState <TankListState>();
            }

            form.Login.Enabled = true;
            form.Login.Text    = "Login";
        }