Beispiel #1
0
        private async void LogIn()
        {
            var email    = this.LogUsername.Text;
            var password = this.LogPassword.Password;

            var content = new FormUrlEncodedContent(new[]
            {
                new KeyValuePair <string, string>("username", email),
                new KeyValuePair <string, string>("password", password),
                new KeyValuePair <string, string>("confirmPassword", password),
                new KeyValuePair <string, string>("grant_type", "password")
            });

            var response = await this._httpClient.PostAsync(Endpoint.Log, content);

            var loginDataPlus = await response.Content.ReadAsAsync <LoginData>();

            this._loginData = loginDataPlus;

            if (response.IsSuccessStatusCode)
            {
                var         placement  = this.GetPlacement();
                ModesWindow roomWindow = new ModesWindow(_loginData, placement);
                roomWindow.Show();
                this.Close();
            }
            else
            {
                MessageBox.Show(await response.Content.ReadAsStringAsync());
                this.ButtonLog.IsEnabled      = true;
                this.RegisterButton.IsEnabled = true;
                this.LogUsername.IsEnabled    = true;
                this.LogPassword.IsEnabled    = true;
            }
        }
Beispiel #2
0
        private void ClickModesButton(object sender, RoutedEventArgs e)
        {
            var         placment    = this.GetPlacement();
            ModesWindow modesWindow = new ModesWindow(this.loginData, placment);

            modesWindow.Show();
            this.Close();
        }
Beispiel #3
0
        private async void QuitCurrentGame()
        {
            if (this.gameMode == GameMode.Online)
            {
                OtherPlayerLeft();
            }
            var         placement   = this.GetPlacement();
            ModesWindow modesWindow = new ModesWindow(this.loginData, placement);

            modesWindow.Show();
            this.Close();
        }