Beispiel #1
0
        private void Btn_back_Click(object sender, RoutedEventArgs e)
        {
            MenuWindow wind = new MenuWindow(this.username);

            wind.Show();
            this.Hide();
            this.Close();
        }
        private void Back_Click(object sender, RoutedEventArgs e)
        {
            this.isForcedClosing = false;
            MenuWindow mw = new MenuWindow(this.client);

            this.Close();
            mw.Show();
        }
Beispiel #3
0
        private void Btn_Exit_Clicked(object sender, RoutedEventArgs e)
        {
            LeaveGameResponse response = (LeaveGameResponse)Communicator.Communicate(new LeaveGameRequest());

            if (response.status == 1)
            {
                MenuWindow wind = new MenuWindow(this.username);
                wind.Show();
                this.Hide();
                this.Close();
            }
        }
Beispiel #4
0
        private void LeaveBTN_Click(object sender, RoutedEventArgs e)
        {
            LeaveRoomResponse response = (LeaveRoomResponse)Communicator.Communicate(new LeaveRoomRequest());

            if (response.status == 1)
            {
                this.thread.Abort();
                MenuWindow wind = new MenuWindow(this.username);
                wind.Show();
                this.Hide();
                this.Close();
            }
        }
Beispiel #5
0
        private void Btn_Signup_Click(object sender, RoutedEventArgs e)
        {
            this._username = TBUsername.Text;
            this._password = TBPassword.Password;
            this._email    = TBEmail.Text;

            SignupResponse response = (SignupResponse)Communicator.Communicate(new SignupRequest(this._username, this._password, this._email));

            if (response.status == 1)
            {
                MenuWindow wind = new MenuWindow(this._username);
                wind.Show();
                this.Hide();
                this.Close();
            }
        }
Beispiel #6
0
 private void LeaveRoom()
 {
     JsonResponsePacketDeserializer.LeaveRoomResponse leaveRoomResp = this.client.SendAndReceive <JsonResponsePacketDeserializer.LeaveRoomResponse>(null, (uint)JsonRequestPacketSerializer.reqCodes.LEAVEROOM_REQ_CODE);
     if (leaveRoomResp.status == 1)
     {
         this.isForcedClosing = false;
         this.dt.Stop();
         MenuWindow mw = new MenuWindow(this.client);
         this.Close();
         mw.Show();
     }
     else
     {
         this.LeaveError.Visibility = Visibility.Visible;
     }
 }
Beispiel #7
0
        private void Btn_signin(object sender, RoutedEventArgs e)
        {
            this.username = TBUsername.Text;
            this.password = TBPassword.Password;


            LoginResponse req = (LoginResponse)Communicator.Communicate(new LoginRequest(username, password));

            if (req.status == 1)
            {
                MenuWindow wind = new MenuWindow(username);
                wind.Show();
                this.Hide();
                this.Close();
            }
            else
            {
                TBInvalid.Text = "Invalid username or password!";
            }
        }
Beispiel #8
0
 private void Login_Click(object sender, RoutedEventArgs e)
 {
     JsonRequestPacketSerializer.LoginRequest loginReq = new JsonRequestPacketSerializer.LoginRequest(this.Username.Text, this.PasswordBox.Password);
     try
     {
         JsonResponsePacketDeserializer.LoginResponse loginResp = this.client.SendAndReceive <JsonResponsePacketDeserializer.LoginResponse>(loginReq, (uint)JsonRequestPacketSerializer.reqCodes.LOGIN_REQ_CODE);
         if (loginResp.status == 1)
         {
             MenuWindow mw = new MenuWindow(this.client);
             this.Close();
             mw.Show();
         }
         else
         {
             this.LoginError.Visibility = Visibility.Visible;
         }
     }
     catch (Exception exception)
     {
     }
 }
Beispiel #9
0
 private void Leave_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         JsonResponsePacketDeserializer.LeaveGameResponse leaveGameResp = this.client.SendAndReceive <JsonResponsePacketDeserializer.LeaveGameResponse>(null, (uint)JsonRequestPacketSerializer.reqCodes.LEAVEGAME_REQ_CODE);
         if (leaveGameResp.status == 1)
         {
             this.isForcedClosing = false;
             dt.Stop();
             MenuWindow mw = new MenuWindow(this.client);
             this.Close();
             mw.Show();
         }
         else
         {
         }
     }
     catch (Exception exception)
     {
     }
 }
Beispiel #10
0
 private void Close_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         JsonResponsePacketDeserializer.CloseRoomResponse closeRoomResp = this.client.SendAndReceive <JsonResponsePacketDeserializer.CloseRoomResponse>(null, (uint)JsonRequestPacketSerializer.reqCodes.CLOSEROOM_REQ_CODE);
         if (closeRoomResp.status == 1)
         {
             this.isForcedClosing = false;
             this.dt.Stop();
             MenuWindow mw = new MenuWindow(this.client);
             this.Close();
             mw.Show();
         }
         else
         {
             this.StartError.Visibility = Visibility.Hidden;
             this.CloseError.Visibility = Visibility.Visible;
         }
     }
     catch (Exception exception)
     {
     }
 }