Пример #1
0
        void ConnectionDialog_Loaded(object sender, RoutedEventArgs e)
        {
            MessageText.Text = String.Format(SR.ConnectionTestFormat, Settings.GameServerPort);

            // Check socket port, if fails to open a connection then use the http handler.
            ServerManager.Connected += (o, args) =>
            {
                this.Dispatcher.BeginInvoke(() => this.Close());
            };
            ServerManager.Configure();
        }
Пример #2
0
        void LoginScreen_Loaded(object sender, RoutedEventArgs e)
        {
            // Check socket port, if fails to open a connection then use the http handler.
            ServerManager.Connected += (o, args) =>
            {
                this.Dispatcher.BeginInvoke(() =>
                {
                    ServerManager.Instance.Reset();
                    ServerManager.Instance.Response += new ServerResponseEventHandler(_server_Response);

                    txtUsername.Focus();

                    // Check local storage for the remember me token.
                    var token = StorageManager.GetPersistLoginToken();
                    if (!String.IsNullOrEmpty(token))
                    {
                        _waitDialog.Show("Attempting login...");
                        ServerManager.Instance.SendUserCommand("LOGIN", token);
                    }

                    txtUsername.Text = _username;
                });
            };
            ServerManager.ConnectFailed += (o, args) =>
            {
                this.Dispatcher.BeginInvoke(() =>
                {
                    var alert     = new AlertWindow();
                    alert.Closed += (s, a) =>
                    {
                        System.Windows.Browser.HtmlPage.Window.Navigate(new Uri("http://www.perenthia.com"));
                    };
                    alert.Show("Connection to Server Failed", String.Format(SR.ConnectionFailed, Settings.GameServerPort));
                });
            };
            ServerManager.Configure();
        }