private void toolStripButtonModify_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count != 0 && Ap.SelectedRoomID != (int)RoomE.HumanTournaments && Ap.SelectedRoomParentID != (int)RoomE.HumanTournaments)
            {
                int i = dataGridView1.CurrentRow.Index;

                if (UData.ToInt32(dataGridView1["ChallengerID", i].Value) != Ap.CurrentUserID && UData.ToInt32(dataGridView1["Type", i].Value) != (int)ChallengeTypeE.Seek)
                {
                    ChallengeWindow frm = new ChallengeWindow();
                    frm.IsModify         = true;
                    frm.ChallengeID      = UData.ToInt32(dataGridView1["ChallengeID", i].Value);
                    frm.opponentUserID   = UData.ToInt32(dataGridView1["ChallengerID", i].Value);
                    frm.opponentUserName = dataGridView1["OpponentName", i].Value.ToString();
                    frm.ShowDialog();
                }
            }
        }
Example #2
0
        private void ChallengeGame(DataGridViewRow row)
        {
            if (Ap.IsGameInProgress)
            {
                return;
            }

            if (Ap.SelectedRoomID == (int)RoomE.HumanTournaments || Ap.SelectedRoomParentID == (int)RoomE.HumanTournaments || Ap.SelectedRoomID == (int)RoomE.EngineTournaments || Ap.SelectedRoomParentID == (int)RoomE.EngineTournaments)
            {
                return;
            }
            if (Convert.ToInt32(row.Cells[0].Value) == Ap.CurrentUserID)
            {
                MessageForm.Error(this.ParentForm, MsgE.ErrorChallangeYourself);
                return;
            }

            if (UData.ToInt32(row.Cells[20].Value.ToString()) == (int)UserStatusE.Blank ||
                UData.ToInt32(row.Cells[20].Value.ToString()) == (int)UserStatusE.Engine ||
                UData.ToInt32(row.Cells[20].Value.ToString()) == (int)UserStatusE.Centaur ||
                UData.ToInt32(row.Cells[20].Value.ToString()) == (int)UserStatusE.Kibitzer)
            {
                if (!String.IsNullOrEmpty(row.Cells[21].Value.ToString()) && Convert.ToBoolean(row.Cells[21].Value.ToString()))
                {
                    MessageForm.Show(this.ParentForm, MsgE.ChallengePauseUser, row.Cells[2].Value.ToString());
                    return;
                }
                //MessageForm.Show(dataGridView1[2, e.RowIndex].Value + " : " + UserStatusE.Idle.ToString());
                ChallengeWindow frm = new ChallengeWindow();
                frm.IsModify         = false;
                frm.opponentUserID   = SelectedUserId;
                frm.opponentUserName = SelectedUserName;
                frm.opponentRank     = SelectedUserRank;
                frm.ShowDialog();
            }
        }