private void UserNewGame(Kv kv)
        {
            int      gameID  = kv.GetInt32("GameID");
            NewGameE newGame = (NewGameE)kv.GetInt32("NewGame");

            switch (newGame)
            {
            case NewGameE.Asked:
                if (MessageForm.Confirm(this, MsgE.ConfirmPlay) == DialogResult.Yes)
                {
                    AcceptNewGameOffer();
                }
                else
                {
                    RejectNewGameOffer();
                }
                break;

            case NewGameE.Accepted:
                NewGame(kv);
                break;

            case NewGameE.Decline:
                ChatClient.Write(ChatTypeE.GameWindow, ChatMessageTypeE.Info, ChatTypeE.GameWindow, MsgE.InfoNewGameOffer, gameID);
                break;

            default:
                break;
            }
        }
Example #2
0
        private void tsbDeleteTeamPlayer_Click(object sender, EventArgs e)
        {
            if (this.Tournament == null)
            {
                return;
            }

            if (this.Tournament.TournamentID == 0)
            {
                return;
            }

            if (this.Tournament.TournamentStatusIDE != TournamentStatusE.Scheduled)
            {
                return;
            }


            DialogResult dr = MessageForm.Confirm(this.ParentForm, MsgE.ConfirmItemDelete, "player(s)");

            if (dr == DialogResult.Yes)
            {
                DeletePlayers();
            }
        }
Example #3
0
        bool TournamentFinish()
        {
            if (this.Tournament == null)
            {
                return(false);
            }

            if (this.Tournament.TournamentID == 0)
            {
                return(false);
            }

            if (MessageForm.Confirm(this.ParentForm, MsgE.ConfirmItemTask, "finish", "tournament " + "'" + this.Tournament.Name + "'") == DialogResult.Yes)
            {
                ProgressForm frmProgress = ProgressForm.Show(this, "Loading matches...");
                this.Tournament.TournamentStatusIDE = TournamentStatusE.Finsihed;
                SocketClient.TournamentFinish(this.Tournament.TournamentID, this.Tournament.TournamentStatusIDE);
                frmProgress.Close();

                this.ParentForm.DialogResult = DialogResult.OK;
                this.ParentForm.Close();
                return(true);
            }
            return(false);
        }
Example #4
0
 private void tsbUnBlockedIP_Click(object sender, EventArgs e)
 {
     if (MessageForm.Confirm(this.ParentForm, MsgE.ConfirmItemTask, "unblocked", "ips") == DialogResult.Yes)
     {
         UnBlockedIP();
     }
 }
 private void tsUndoSetting_Click(object sender, EventArgs e)
 {
     if (MessageForm.Confirm(this, MsgE.ConfirmLoadDefaultPanes) == DialogResult.Yes)
     {
         LoadDefaultPanels();
     }
 }
 private void loadDefaultPanesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (MessageForm.Confirm(this, MsgE.ConfirmLoadDefaultPanes) == DialogResult.Yes)
     {
         LoadDefaultPanels();
     }
 }
        private void DownloadUpgrades()
        {
            try
            {
                DataSet ds = UpdateUtility.GetAvailablePatches(Config.Version);
                if (ds != null && ds.Tables.Count > 0)
                {
                    Kv   kv         = new Kv(ds.Tables[0]);
                    long patchSize  = kv.GetInt32("PatchSize");
                    long setupSize  = kv.GetInt32("SetupSize");
                    int  multiplier = 6;
                    if (patchSize >= (setupSize * multiplier))
                    {
                        if (MessageForm.Confirm(null, MsgE.ConfirmPatchSizeDownload, patchSize + " MB", setupSize + " MB") == DialogResult.No)
                        {
                            return;
                        }
                    }
                    string newVersion      = kv.Get("PatchFile1").Replace(".zip", "");
                    string currentPatchUrl = KeyValues.Instance.GetKeyValue(KeyValueE.PatchUrl).Value;
                    this.Invoke(new UpdateClient.BeginUpdateDelegateKv(UpdateClient.BeginUpdate), kv, currentPatchUrl, newVersion);
                }
            }

            catch (Exception ex)
            {
                TestDebugger.Instance.WriteError(ex);
                MessageForm.Show(ex);
            }
        }
 private void fullScreenToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (_FullScreen == null)
     {
         _FullScreen = new FullScreen(ApWin.OnlineClientForm);
     }
     if (fullScreenToolStripMenuItem.Checked == false)
     {
         // show FullScreen
         DialogResult dr = MessageForm.Confirm(this, MsgE.ConfirmStoreNormalView);
         if (dr == DialogResult.Yes)
         {
             _FullScreen.ShowFullScreen();
             tableLayoutPanel1.Visible           = false;
             statusStrip1.Visible                = false;
             fullScreenToolStripMenuItem.Checked = true;
         }
     }
     else
     {
         // Hide FullScreen
         _FullScreen.ShowFullScreen();
         tableLayoutPanel1.Visible           = true;
         statusStrip1.Visible                = true;
         fullScreenToolStripMenuItem.Checked = false;
     }
 }
 private void tsbAddPlayer_Click(object sender, EventArgs e)
 {
     if (MessageForm.Confirm(this.ParentForm, MsgE.ConfirmItemTask, "register", "player(s)") == DialogResult.Yes)
     {
         Save();
     }
 }
        private void UpdateMatchStatus(TournamentMatchStatusE tournamentMatchStatusID, string matchStatus)
        {
            if (this.Tournament == null)
            {
                return;
            }
            if (this.Tournament.TournamentID == 0)
            {
                return;
            }

            string matchIDs = string.Empty;

            foreach (DataGridViewRow row in dgvMatches.Rows)
            {
                if (row.Cells["Select"].Value != null)
                {
                    if ((bool)row.Cells["Select"].Value)
                    {
                        if (GridTable.Rows[row.Index]["WhiteUserID"].ToString() != "2" && GridTable.Rows[row.Index]["BlackUserID"].ToString() != "2")
                        {
                            matchIDs += "," + GridTable.Rows[row.Index]["TournamentMatchID"].ToString();
                        }
                    }
                }
            }

            if (matchIDs.Length > 0)
            {
                matchIDs = matchIDs.Remove(0, 1);

                if (MessageForm.Confirm(this.ParentForm, MsgE.ConfirmItemTask, "update match status to ", matchStatus) != DialogResult.Yes)
                {
                    return;
                }

                ProgressForm frmProgress = ProgressForm.Show(this, "Updating match status...");
                DataSet      ds          = SocketClient.UpdateTournamentMatchStatus(tournamentMatchStatusID, this.Tournament.TournamentID, matchIDs);
                frmProgress.Close();

                if (ds != null)
                {
                    if (ds.Tables.Count > 0)
                    {
                        Kv kv = new Kv(ds.Tables[0]);
                        if (kv.GetInt32("Result") > 0)
                        {
                            MessageForm.Error(this.ParentForm, (MsgE)kv.GetInt32("Result"));
                            return;
                        }
                    }
                }
                RefreshGrid();
            }
            else
            {
                MessageForm.Error(this.ParentForm, MsgE.ErrorTournamentMatchStartRequest);
            }
        }
 private void tsbDecline_Click(object sender, EventArgs e)
 {
     if (MessageForm.Confirm(this.ParentForm, MsgE.ConfirmItemTask, "decline", "player(s)") == DialogResult.Yes)
     {
         SaveWantinUsers(StatusE.Deleted, TournamentUserStatusE.Declined);
     }
     RefreshGrid();
 }
Example #12
0
        private bool StartTournament()
        {
            bool isTrue = false;

            if (this.Tournament == null)
            {
                return(false);
            }

            if (this.Tournament.TournamentID == 0)
            {
                return(false);
            }

            if (MessageForm.Confirm(this.ParentForm, MsgE.ConfirmItemTask, "start", "tournament " + "'" + this.Tournament.Name + "'") == DialogResult.Yes)
            {
                ProgressForm frmProgress = ProgressForm.Show(this, "Creating matches...");

                this.Tournament.TournamentStatusIDE = TournamentStatusE.InProgress;
                DataSet ds = SocketClient.TournamentStart(this.Tournament.TournamentID, this.Tournament.TournamentStatusIDE);

                if (ds != null)
                {
                    if (ds.Tables.Count > 0)
                    {
                        Kv kv = new Kv(ds.Tables[0]);
                        if (kv.GetInt32("Result") > 0)
                        {
                            frmProgress.Close();
                            if ((int)MsgE.ErrorTournamentUserExist == kv.GetInt32("Result") && this.Tournament.TournamentTypeIDE == TournamentTypeE.Knockout)
                            {
                                MessageForm.Error(this.ParentForm, (MsgE)kv.GetInt32("Result"), this.Tournament.Name, 4);
                            }
                            else
                            {
                                MessageForm.Error(this.ParentForm, (MsgE)kv.GetInt32("Result"), this.Tournament.Name, 2);
                            }

                            this.Tournament.TournamentStatusIDE = TournamentStatusE.Scheduled;
                            return(false);
                        }
                    }

                    tsbRescheduleTask.Visible = true;
                    frmProgress.Close();

                    MessageForm.Show(this.ParentForm, MsgE.ConfirmTournamentStarted, this.Tournament.Name);
                    isTrue = true;
                }
                else
                {
                    MessageForm.Error(this.ParentForm, MsgE.ErrorTournamentUserExist, this.Tournament.Name);

                    return(false);
                }
            }
            return(isTrue);
        }
Example #13
0
        private void tsbDelete_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageForm.Confirm(this.ParentForm, MsgE.ConfirmItemDelete, "prize(s)");

            if (dr == DialogResult.Yes)
            {
                DeletePrizes();
            }
        }
Example #14
0
 private void OnlineResign_Click(object sender, EventArgs e)
 {
     if (!base.Game.Flags.IsGameFinished)
     {
         if (MessageForm.Confirm(this, MsgE.ConfirmResignGame) == DialogResult.Yes)
         {
             Resign();
         }
     }
 }
Example #15
0
 public void CreateTieMatch()
 {
     if (MessageForm.Confirm(this.ParentForm, MsgE.ConfirmItemTask, "create", "match") == DialogResult.Yes)
     {
         if (Save())
         {
             this.ParentForm.DialogResult = DialogResult.OK;
         }
     }
 }
Example #16
0
        void UpdateBanStatus(StatusE statusID)
        {
            try
            {
                int i = 0;

                string userIDs = string.Empty;

                foreach (DataGridViewRow row in dataGridView1.Rows)
                {
                    if (row.Cells[0].Value != null)
                    {
                        if ((bool)row.Cells[0].Value)
                        {
                            int statusIDx = BaseItem.ToInt32(GridTable.Rows[i]["StatusID"]);

                            if (statusIDx == (int)StatusE.Ban)
                            {
                                int userID = BaseItem.ToInt32(GridTable.Rows[i]["UserID"]);

                                userIDs += "," + userID.ToString();
                            }
                        }
                    }
                    i++;
                }

                if (userIDs.Length > 0)
                {
                    userIDs = userIDs.Remove(0, 1);

                    if (MessageForm.Confirm(this.ParentForm, MsgE.ConfirmItemTask, "remove ban", "user") == DialogResult.Yes)
                    {
                        ProgressForm frmProgress = ProgressForm.Show(this, "Removing Ban...");

                        SocketClient.UpdateBanStatus(statusID, userIDs);

                        frmProgress.Close();

                        RefreshGrid();

                        MessageForm.Show(this.ParentForm, MsgE.InfoBanRemove);
                    }
                }
                else
                {
                    MessageForm.Show(this.ParentForm, MsgE.ErrorSelectCheckBox);
                }
            }
            catch (Exception ex)
            {
                MessageForm.Show(ex);
            }
        }
Example #17
0
 private void btnLogoffUser_Click(object sender, EventArgs e)
 {
     if (MessageForm.Confirm(this, MsgE.ConfirmClosedAllWindow, "") == DialogResult.Yes)
     {
         SocketClient.ForceLogoff(Ap.CurrentUserID);
         this.Close();
     }
     else
     {
         return;
     }
 }
Example #18
0
        private void tsmFactorySetting_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageForm.Confirm(this, MsgE.ConfirmResetSetting);

            if (dialogResult == DialogResult.Yes)
            {
                ApWin.ShowUserProfile = true;
                Ap.ResetFactorySettings();
                LoadDefaultPanels();
                this.Close();
            }
        }
Example #19
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(txtEmail.Text))
            {
                Regex reg = new Regex(@"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*");
                Match mt  = reg.Match(txtEmail.Text);
                if (!mt.Success)
                {
                    MessageForm.Error(this, MsgE.ErrorInvalidEmail);
                    return;
                }
            }
            if (!String.IsNullOrEmpty(txtURL.Text))
            {
                Regex reg = new Regex(@"http(s)?://([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?");
                Match mt  = reg.Match(txtURL.Text);
                if (!mt.Success)
                {
                    MessageForm.Error(this, MsgE.ErrorInvalidURL);
                    return;
                }
            }

            if (IsNew)
            {
                if (ShowConfirmDialog)
                {
                    if (MessageForm.Confirm(this.ParentForm, MsgE.ConfirmItemTask, "save", "user") == DialogResult.Yes)
                    {
                        Save();
                    }
                }
                else
                {
                    Save();
                }
            }
            else
            {
                if (ShowConfirmDialog)
                {
                    if (MessageForm.Confirm(this.ParentForm, MsgE.ConfirmItemTask, "update", "user") == DialogResult.Yes)
                    {
                        Update();
                    }
                }
                else
                {
                    Update();
                }
            }
        }
Example #20
0
        private void blockMachineToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (SelectedUserId == 0)
            {
                return;
            }

            DialogResult dr = MessageForm.Confirm(this.ParentForm, MsgE.ConfirmBlockMachine, SelectedUserName);

            if (dr == DialogResult.Yes)
            {
                SocketClient.BlockMachine(SelectedUserId);
            }
        }
Example #21
0
        void UpdateRoomStatus(StatusE statusID)
        {
            try
            {
                int i = 0;

                string roomIDs = string.Empty;

                foreach (DataGridViewRow row in dataGridView1.Rows)
                {
                    if (row.Cells[0].Value != null)
                    {
                        if ((bool)row.Cells[0].Value)
                        {
                            Int32 roomId = BaseItem.ToInt32(GridTable.Rows[i]["RoomID"]);

                            roomIDs += "," + roomId.ToString();
                        }
                    }

                    i++;
                }
                if (roomIDs.Length > 0)
                {
                    roomIDs = roomIDs.Remove(0, 1);

                    if (MessageForm.Confirm(this.ParentForm, MsgE.ConfirmItemTask, statusID.ToString().ToLower(), "room") == DialogResult.Yes)
                    {
                        ProgressForm frmProgress = ProgressForm.Show(this, "Updating Room Status...");

                        SocketClient.UpdateRoomStatus(statusID, roomIDs);

                        frmProgress.Close();

                        RefreshGrid();

                        MessageForm.Show(this.ParentForm, MsgE.InfoUpdateRoom);
                    }
                }
                else
                {
                    MessageForm.Show(this.ParentForm, MsgE.ErrorSelectCheckBox);
                }
            }
            catch (Exception ex)
            {
                TestDebugger.Instance.WriteError(ex);
                MessageForm.Show(ex);
            }
        }
Example #22
0
        private void makeAdminToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                int i = 0;

                string userIDs = string.Empty;

                foreach (DataGridViewRow row in dataGridView1.Rows)
                {
                    if (row.Cells[0].Value != null)
                    {
                        if ((bool)row.Cells[0].Value)
                        {
                            int userID = BaseItem.ToInt32(GridTable.Rows[i]["UserID"]);

                            userIDs += "," + userID.ToString();
                        }
                    }
                    i++;
                }

                if (userIDs.Length > 0)
                {
                    userIDs = userIDs.Remove(0, 1);

                    if (MessageForm.Confirm(this.ParentForm, MsgE.ConfirmItemTask, "make", "admin") == DialogResult.Yes)
                    {
                        ProgressForm frmProgress = ProgressForm.Show(this, "Making Admin...");

                        SocketClient.MakeAdmin(userIDs, RankE.King, RoleE.Admin);

                        frmProgress.Close();

                        RefreshGrid();

                        MessageForm.Show(this.ParentForm, MsgE.InfoMakeAdmin);
                    }
                }
                else
                {
                    MessageForm.Show(this.ParentForm, MsgE.ErrorSelectCheckBox);
                }
            }
            catch (Exception ex)
            {
                MessageForm.Show(ex);
            }
        }
Example #23
0
 private void tsCloseBook_Click(object sender, EventArgs e)
 {
     if (this.Game.Book.IsOpeningBookChanged)
     {
         DialogResult dialogResult = MessageForm.Confirm(this.ParentForm, MsgE.ConfirmSaveChanges);
         if (dialogResult == DialogResult.Yes)
         {
             this.Game.Book.Save();
             UpdateBook();
         }
     }
     SetCloseBookLayout();
     this.Game.Book.Close();
     Options.Instance.CurrentBookFilePath = null;
 }
        private void ResetGameAsked(Kv kv)
        {
            Ap.Game.Pause();
            ResetGameE reset = ResetGameE.Decline;

            if (MessageForm.Confirm(this, MsgE.ConfirmRestartTournamentMatch) == DialogResult.Yes)
            {
                reset = ResetGameE.Accepted;
            }
            else
            {
                Ap.Game.Resume();
            }

            SocketClient.RestartGame(kv.GetInt32("TournamentID"), kv.Get("MatchIDs"), kv.GetInt32("TournamentDirectorID"), kv.GetInt32("SenderUserID"), kv.GetInt32("ReceiverUserID"), reset, kv.GetBool("IsResetFromLastMove"), kv.Get("GameXml"));
        }
Example #25
0
 private void btnOk_Click(object sender, EventArgs e)
 {
     if (newsDetailUc1.NewsName == string.Empty)
     {
         MessageForm.Show(this, MsgE.ErrorEmptyNewsTitle);
     }
     else
     {
         if (MessageForm.Confirm(this.ParentForm, MsgE.ConfirmItemTask, "save", "news") == DialogResult.Yes)
         {
             newsDetailUc1.SaveNews();
             this.DialogResult = DialogResult.OK;
             this.Close();
         }
     }
 }
Example #26
0
 private void btnOk_Click(object sender, EventArgs e)
 {
     if (teamDetailUc1.TeamName == string.Empty)
     {
         MessageForm.Show(this.ParentForm, MsgE.ErrorEmptyTeamTitle);
     }
     else
     {
         if (MessageForm.Confirm(this.ParentForm, MsgE.ConfirmItemTask, "save", "team") == DialogResult.Yes)
         {
             SaveTeam();
             this.DialogResult = DialogResult.OK;
             this.Close();
         }
     }
 }
Example #27
0
 void progressForm_OnWorkCancelled(object sender, EventArgs args)
 {
     if (Ap.Database != null)
     {
         DialogResult dr = MessageForm.Confirm(this.ParentForm, MsgE.ConfirmItemTask, "cancel", "searching");
         if (dr == DialogResult.Yes)
         {
             progressForm.OnWorkCancelled -= new GameSearchProgress.WorkCancelledHandler(progressForm_OnWorkCancelled);
             Ap.Database.CancelSearching();
         }
         else
         {
             return;
         }
     }
 }
 void pgnProgressForm_OnWorkCancelled(object sender, EventArgs args)
 {
     if (pgn != null)
     {
         DialogResult dr = MessageForm.Confirm(this.ParentForm, MsgE.ConfirmItemTask, "cancel", "conversion");
         if (dr == DialogResult.Yes)
         {
             progressForm.OnWorkCancelled -= new GameSearchProgress.WorkCancelledHandler(pgnProgressForm_OnWorkCancelled);
             pgn.CancelPgnToIcdConversion();
         }
         else
         {
             return;
         }
     }
 }
 private void btnOk_Click(object sender, EventArgs e)
 {
     if (mtxtBlockedIP.Text == string.Empty)
     {
         MessageForm.Show(this, MsgE.ErrorEmptyNewsTitle);
     }
     else
     {
         if (MessageForm.Confirm(this.ParentForm, MsgE.ConfirmItemTask, "block", "ip") == DialogResult.Yes)
         {
             SaveBlockedIP();
             this.DialogResult = DialogResult.OK;
             this.Close();
         }
     }
 }
Example #30
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            if (txtBanReason.Text != string.Empty)
            {
                KvUserData.UserID        = this.userID;
                KvUserData.BanStartDate  = dtpStartDate.Text;
                KvUserData.BanStartTime  = dtpStartTime.Text;
                KvUserData.BanReason     = txtBanReason.Text;
                KvUserData.BanMachineKey = WmiHelper.GetMachineKey();
                if (rbDate.Checked)
                {
                    KvUserData.BanEndDate = dtpEndDate.Text;
                    KvUserData.BanEndTime = dtpEndTime.Text;
                }
                else if (rbForever.Checked)
                {
                    KvUserData.BanEndDate = "";
                    KvUserData.BanEndTime = "";
                }
                else if (rbDuration.Checked)
                {
                    KvUserData.BanEndDate = dtServerTime.ToString();
                    if (cbDays.Text.Trim().Length > 0)
                    {
                        dtServerTime          = dtServerTime.AddDays(Convert.ToInt32(cbDays.Text));
                        KvUserData.BanEndTime = dtServerTime.ToString();
                    }
                    if (cbHours.Text.Trim().Length > 0)
                    {
                        dtServerTime          = dtServerTime.AddHours(Convert.ToInt32(cbHours.Text));
                        KvUserData.BanEndTime = dtServerTime.ToString();
                    }
                }

                DialogResult dr = MessageForm.Confirm(this.ParentForm, MsgE.ConfirmBanUser, userName);
                if (dr == DialogResult.Yes)
                {
                    DataSet ds = SocketClient.BanUser(KvUserData);
                }
                SubmitClicked(dr);
            }
            else
            {
                MessageForm.Error(this.ParentForm, MsgE.ErrorBanReason);
            }
        }