public void BanUserMachineList() { ProgressForm frmProgress = ProgressForm.Show(this, "Loading Ban Uers Machines..."); try { DataSet ds = SocketClient.GetAllBanUserMachine(); dataGridView1.AutoGenerateColumns = false; if (ds != null) { if (ds.Tables.Count > 0) { table = ds.Tables[0]; } else { table = null; } } RefreshGrid(table); } catch (Exception ex) { MessageForm.Show(ex); } frmProgress.Close(); }
private void RefreshGrid() { ProgressForm frmProgress = ProgressForm.Show(this, "Loading teams..."); try { dgvRegisterTeam.AutoGenerateColumns = false; DataSet ds = SocketClient.GetRecentTournamentTeam(this.Tournament.TournamentID); if (ds != null) { table = ds.Tables[0]; } RefreshGrid(table); } catch (Exception ex) { TestDebugger.Instance.WriteError(ex); string s = ex.Message; } frmProgress.Close(); }
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); }
public bool RestartGame() { if (DbGame == null) { return(false); } GameType wGameType = GameTime.GetGameType(Convert.ToInt32(cmbWhiteMin.Text), Convert.ToInt32(cmbWhiteSec.Text)); GameType bGameType = GameTime.GetGameType(Convert.ToInt32(cmbBlackMin.Text), Convert.ToInt32(cmbBlackSec.Text)); if (this.DbGame.GameTypeIDE != wGameType || this.DbGame.GameTypeIDE != bGameType) { MessageForm.Error(this.ParentForm, MsgE.ErrorRestartGameTime, ""); return(false); } int wMin = Convert.ToInt32(cmbWhiteMin.Text) * 60; int wSec = Convert.ToInt32(cmbWhiteSec.Text); int bMin = Convert.ToInt32(cmbBlackMin.Text) * 60; int bSec = Convert.ToInt32(cmbBlackSec.Text); ProgressForm frm = ProgressForm.Show(this, "Restarting Game..."); SocketClient.RestartGameWithSetup(ResetGameE.Asked, this.DbGame.GameID, notationViewerUc1.SelectedMoveID, ChallengerUserID, OpponentUserID, wMin, wSec, bMin, bSec, IsTournamentDirector); frm.Close(); return(true); }
private void RefreshGrid() { ProgressForm frmProgress = ProgressForm.Show(this, "Loading Users..."); try { dataGridView1.AutoGenerateColumns = false; DataSet ds = SocketClient.GetAllUserByID(); if (ds != null) { if (ds.Tables.Count > 0) { table = ds.Tables[0]; } else { table = null; } } RefreshGrid(table); } catch (Exception ex) { MessageForm.Show(ex); } frmProgress.Close(); }
private void RefreshGrid() { ProgressForm frmProgress = ProgressForm.Show(this, "Loading Logs..."); try { gvLog.AutoGenerateColumns = false; DataSet ds = SocketClient.GetAllLog(); if (ds != null) { if (ds.Tables.Count > 0) { table = ds.Tables[0]; } else { table = null; } } RefreshGrid(table); } catch (Exception ex) { TestDebugger.Instance.WriteError(ex); MessageForm.Show(ex); } frmProgress.Close(); }
private void startMatchToolStripMenuItem_Click(object sender, EventArgs e) { ProgressForm frmProgress = ProgressForm.Show(this, "Loading players..."); CreateChallange(TournamentMatchStatusE.InProgress); frmProgress.Close(); }
private void tsbBlackBye_Click(object sender, EventArgs e) { ProgressForm frmProgress = ProgressForm.Show(this, "Loading players..."); frmProgress.Close(); }
private void btnBrowse_Click(object sender, EventArgs e) { ofdEngineFile = new OpenFileDialog(); ofdEngineFile.Filter = "UCI Engines exe(*.exe)|*.exe"; ofdEngineFile.FileName = "*.exe"; //ofdEngineFile.InitialDirectory = Ap.FolderEngines; if (ofdEngineFile.ShowDialog() == DialogResult.OK) { frmProgress = ProgressForm.Show(this, "Verifying UCI Engine...", 4000); frmProgress.FormClosed += new FormClosedEventHandler(frmProgress_FormClosed); btnBrowse.Enabled = false; btnOK.Enabled = false; btnParameters.Enabled = false; txtAuthor.Text = ""; txtName.Text = ""; txtEngine.Text = ofdEngineFile.SafeFileName; sourceFilePath = ofdEngineFile.FileName; engineFileName = sourceFilePath.Substring(sourceFilePath.LastIndexOf("\\") + 1); ValidateEngine(); } }
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 btnOk_Click(object sender, EventArgs e) { ProgressForm frm = ProgressForm.Show(this, "Verifying Username and Password ..."); LoginUser(); frm.Close(); }
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); }
private void RefreshGrid() { ProgressForm frmProgress = ProgressForm.Show(this, "Loading Tournaments..."); try { dgvTournamentList.AutoGenerateColumns = false; DataSet ds = null; switch (TournamentStatus) { case TournamentStatusE.Unknown: ds = SocketClient.GetAllTournaments(Ap.CurrentUser.IsAdmin); break; case TournamentStatusE.Scheduled: ds = SocketClient.GetAllForthcommingTournaments(TournamentStatus); break; case TournamentStatusE.InProgress: ds = SocketClient.GetAllInprogressTournaments(TournamentStatus); break; case TournamentStatusE.Finsihed: ds = SocketClient.GetAllFinishedTournaments(TournamentStatus); break; default: break; } if (ds != null) { if (ds.Tables.Count > 0) { table = ds.Tables[0]; } else { table = null; } } else { table = null; } RefreshGrid(table); } catch (Exception ex) { TestDebugger.Instance.WriteError(ex); } frmProgress.Close(); }
private void RefreshGrid() { if (this.Tournament == null) { return; } if (this.Tournament.TournamentID == 0) { return; } ProgressForm frmProgress = ProgressForm.Show(this, "Loading Standings..."); try { DataSet ds = SocketClient.GetTournamentResultById(this.Tournament.TournamentID); if (ds != null) { if (ds.Tables.Count > 0) { table = ds.Tables[0]; RefreshGrid(table); } else { dgvResult.DataSource = null; } } else { dgvResult.DataSource = null; } foreach (DataGridViewRow row in dgvResult.Rows) { if (row.Cells["CountryId"].Value.ToString() == "0") { Image item = Image.FromFile(Ap.FolderFlags + "244.png"); row.Cells["Flag"].Value = item; } else { Image item = Image.FromFile(Ap.FolderFlags + row.Cells["CountryId"].Value + ".png"); row.Cells["Flag"].Value = item; } } } catch (Exception ex) { TestDebugger.Instance.WriteError(ex); } FormatGrid(); frmProgress.Close(); }
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); } }
private void RefreshGrid() { if (this.Tournament == null) { return; } if (this.Tournament.TournamentID == 0) { return; } ProgressForm frmProgress = ProgressForm.Show(this, "Loading players..."); try { dgvWantin.AutoGenerateColumns = false; DataSet ds = SocketClient.GetTournamentWantinUsers(this.Tournament.TournamentID); if (ds != null) { if (ds.Tables.Count > 0) { table = ds.Tables[0]; dgvWantin.DataSource = table; } else { if (table != null) { table.Rows.Clear(); table.AcceptChanges(); } } } else { if (table != null) { table.Rows.Clear(); table.AcceptChanges(); } } RefreshGrid(table); } catch (Exception ex) { TestDebugger.Instance.WriteError(ex); MessageForm.Show(ex); } frmProgress.Close(); }
private void btnSubmit_Click(object sender, EventArgs e) { frmProgress = ProgressForm.Show(this, "Searching..."); GetUser(txtUser.Text); this.Text = "'" + txtUser.Text + "'" + " - Personal Information"; if (!isRated) { MessageForm.Show(this, MsgE.InfoProfile, txtUser.Text); } frmProgress.Close(); }
private void RefreshGrid() { if (this.Tournament == null) { return; } ProgressForm frmProgress = ProgressForm.Show(this, "Loading players..."); try { dgvRegisterPlayer.AutoGenerateColumns = false; DataSet ds = SocketClient.GetTournamentRegisteredUser(StatusE.Active, this.Tournament.TournamentID); if (ds != null) { if (ds.Tables.Count > 0) { table = ds.Tables[0]; if (Tournament.TournamentTypeE == TournamentTypeE.RoundRobin) { dgvRegisterPlayer.Columns[2].Visible = true; } } else { if (table != null) { table.Rows.Clear(); table.AcceptChanges(); } } } else { if (table != null) { table.Rows.Clear(); table.AcceptChanges(); } } RefreshGrid(table); } catch (Exception ex) { TestDebugger.Instance.WriteError(ex); MessageForm.Show(ex); } frmProgress.Close(); }
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); } }
private void DeleteTeams() { if (dgvTeam.Rows.Count == 0) { MessageForm.Error(this.ParentForm, MsgE.ErrorNoSelection, "team"); return; } try { int i = 0; string tournamentTeamIds = string.Empty; foreach (DataGridViewRow row in dgvTeam.Rows) { if (row.Cells[0].Value != null) { if ((bool)row.Cells[0].Value) { int teamId = BaseItem.ToInt32(TeamGridTable.Rows[i]["TeamID"]); tournamentTeamIds += "," + teamId.ToString(); } } i++; } if (tournamentTeamIds.Length > 0) { tournamentTeamIds = tournamentTeamIds.Remove(0, 1); ProgressForm frmProgress = ProgressForm.Show(this, "Removing Teams..."); SocketClient.DeleteTournamentTeam(tournamentTeamIds, this.Tournament.TournamentID); frmProgress.Close(); RefreshTeamGrid(); RefreshPlayerGrid(); } } catch (Exception ex) { TestDebugger.Instance.WriteError(ex); MessageForm.Show(ex); } }
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); } }
private void DeletePlayers() { if (dgvPlayer.Rows.Count == 0) { MessageForm.Error(this.ParentForm, MsgE.ErrorNoSelection, "player"); return; } try { int i = 0; string userIDs = string.Empty; foreach (DataGridViewRow row in dgvPlayer.Rows) { if (row.Cells[0].Value != null) { if ((bool)row.Cells[0].Value) { int userID = BaseItem.ToInt32(PlayerGridTable.Rows[i]["UserID"]); userIDs += "," + userID.ToString(); } } i++; } if (userIDs.Length > 0) { userIDs = userIDs.Remove(0, 1); ProgressForm frmProgress = ProgressForm.Show(this, "Removing Players..."); SocketClient.SaveTournamentRegisteredUsers(StatusE.Deleted, TournamentUserStatusE.Declined, this.Tournament.TournamentID, userIDs, SelectedTeamID, 0); frmProgress.Close(); RefreshPlayerGrid(); } } catch (Exception ex) { TestDebugger.Instance.WriteError(ex); MessageForm.Show(ex); } }
private void RefreshGrid() { if (this.Tournament == null) { return; } if (this.Tournament.TournamentID == 0) { return; } ProgressForm frmProgress = ProgressForm.Show(this, "Loading Standings..."); try { DataSet ds = SocketClient.GetTournamentResultById(this.Tournament.TournamentID); if (ds != null) { if (ds.Tables.Count > 0) { table = ds.Tables[0]; RefreshGrid(table); FillWinners(table); } else { dgvResult.DataSource = null; LoadWinners(null); } } else { dgvResult.DataSource = null; LoadWinners(null); } } catch (Exception ex) { TestDebugger.Instance.WriteError(ex); } FormatGrid(); frmProgress.Close(); }
private void RefreshGrid() { if (this.Tournament == null) { return; } if (this.Tournament.TournamentID == 0) { return; } ProgressForm frmProgress = ProgressForm.Show(this, "Loading Matches..."); try { dgvMatches.AutoGenerateColumns = false; DataSet ds = SocketClient.GetTournamentMatches(Tournament.TournamentID, Tournament.TournamentTypeE); if (ds != null) { if (ds.Tables.Count > 0) { table = ds.Tables[0]; RefreshGrid(table); } else { dgvMatches.DataSource = null; } } else { dgvMatches.DataSource = null; } } catch (Exception ex) { TestDebugger.Instance.WriteError(ex); MessageForm.Show(ex); } frmProgress.Close(); }
void GetUser(string userName) { ProgressForm frmProgress = ProgressForm.Show(this, "Loading User Information..."); DataSet ds = null; if (userName == "" && userID != 0) { ds = SocketClient.GetUserInfoByUserID(userID); } else if (userName != "") { ds = SocketClient.UserByName(userName); } Init(ds); frmProgress.Close(); }
private void LoadParams() { parameters = new InfinitySettings.UCIManager.EngineParameters(this.Game); parameters.ParametersLoaded += new EventHandler(parameters_ParametersLoaded); parameters.ParameterError += new InfinitySettings.UCIManager.EngineParameters.ParameterErrorHandler(parameters_ParameterError); string engineName = Path.GetFileNameWithoutExtension(engineFilePath); dgvParameters.Visible = false; frmProgressForm = ProgressForm.Show(this, "Loading...", 1); if (UciEngine == null) { parameters.Init(engineFilePath); } else { parameters.Init(UciEngine); } }
private void LoadImportGameData() { if (!databaseFileName.EndsWith(Files.DatabaseExtension)) { MessageForm.Error(this, MsgE.ErrorInvalidFileFormat); this.Close(); return; } try { ProgressForm frmProgress = ProgressForm.Show(this, "Loading Database..."); database = new Database(databaseFileName, this.Game); frmProgress.Close(); if (database.GamesCount > 0) { numFromGameNo.Value = 1; numToGameNo.Value = database.GamesCount; numFromGameNo.Maximum = database.GamesCount; numToGameNo.Maximum = database.GamesCount; } else { numFromGameNo.Maximum = 0; numToGameNo.Maximum = 0; numFromGameNo.Value = 0; numToGameNo.Value = 0; } fromGameNo = (int)numFromGameNo.Value; toGameNo = (int)numToGameNo.Value; } catch (Exception ex) { TestDebugger.Instance.WriteError(ex); MessageForm.Error(this, MsgE.ErrorInvalidFileFormat, ex); this.Close(); } }
void UnBlockedIP() { try { int i = 0; string blockedIPIDs = string.Empty; BlockedIpItem ips = new BlockedIpItem(); foreach (DataGridViewRow row in dataGridView1.Rows) { if (row.Cells[0].Value != null) { if ((bool)row.Cells[0].Value) { Int32 blockedIps = BaseItem.ToInt32(GridTable.Rows[i]["BlockedIPID"]); blockedIPIDs += "," + blockedIps.ToString(); } } i++; } if (blockedIPIDs.Length > 0) { blockedIPIDs = blockedIPIDs.Remove(0, 1); ProgressForm frmProgress = ProgressForm.Show(this, "UnBlocking IPs..."); SocketClient.UnBlockIPs(blockedIPIDs); frmProgress.Close(); RefreshGrid(); MessageForm.Show(this.ParentForm, MsgE.InfoUnBlockedIPs); } else { MessageForm.Show(this.ParentForm, MsgE.ErrorSelectCheckBox); } } catch (Exception ex) { TestDebugger.Instance.WriteError(ex); MessageForm.Show(ex); } }
private void tsbClear_Click(object sender, EventArgs e) { try { if (MessageForm.Confirm(this.ParentForm, MsgE.ConfirmItemTask, "clear", "logs") == DialogResult.Yes) { ProgressForm frmProgress = ProgressForm.Show(this, "Removing Logs..."); SocketClient.ClearLog(); frmProgress.Close(); RefreshGrid(); MessageForm.Show(this.ParentForm, MsgE.InfoClearLogs); } } catch (Exception ex) { TestDebugger.Instance.WriteError(ex); MessageForm.Show(ex); } }
private void OnlineClient_FormClosing(object sender, FormClosingEventArgs e) { if (Ap.IsGameInProgress || Ap.HasKibitzers) { ChatClient.Write(ChatTypeE.OnlineClient, ChatMessageTypeE.Warning, ChatTypeE.OnlineClient, MsgE.ErrorRoomChange, 0); e.Cancel = true; return; } else if (isNormalClose) { if (MessageForm.Confirm(this, MsgE.ConfirmLogOff) == DialogResult.No) { e.Cancel = true; return; } } Ap.UnInit(ApModuleE.Online); if (isNormalClose) { ProgressForm frm = ProgressForm.Show(this, "Logging off..."); Ap.CurrentUser.Logoff(); frm.Close(); } UnInitDockingEvents(); SaveDocking(); Ap.CanAutoChallenge = true; Ap.PlayingMode.ChessTypeID = 1; PlayingModeData.Instance.ChessType = ChessTypeE.Human; Ap.SelectedRoomID = 0; if (Ap.PlayingMode.SelectedEngine != null) { Ap.PlayingMode.SelectedEngine.Close(); Ap.PlayingMode.SelectedEngine = null; } PlayingModeData.Instance.Save(); UserFormulas.Instance = null; }