void eco_dgvRanks_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex == -1) { return; } object name = eco_dgvRanks.Rows[e.RowIndex].Cells[0].Value; object price = eco_dgvRanks.Rows[e.RowIndex].Cells[1].Value; // On Mono this event is raised during initialising cells too // However, first time event is raised, price is not initialised yet if (price == null) { return; } Group grp = Group.Find(name.ToString()); if (grp == null) { return; // TODO: does this ever happen? } RankItem.RankEntry rank = Economy.Ranks.GetOrAdd(grp.Permission); rank.Price = int.Parse(price.ToString()); if (rank.Price == 0) { Economy.Ranks.Remove(grp.Permission); } }
void Eco_UpdateRanks() { eco_dgvRanks.Rows.Clear(); for (int i = 0; i < GuiPerms.RankPerms.Length; i++) { RankItem.RankEntry rank = Economy.Ranks.Find(GuiPerms.RankPerms[i]); int price = rank == null ? 0 : rank.Price; eco_dgvRanks.Rows.Add(GuiPerms.RankNames[i], price); } Eco_UpdateRankEnables(); }
void Eco_UpdateRanks() { eco_dgvRanks.Rows.Clear(); foreach (Group grp in Group.GroupList) { RankItem.RankEntry rank = Economy.Ranks.Find(grp.Permission); int price = rank == null ? 0 : rank.Price; int idx = eco_dgvRanks.Rows.Add(grp.Name, price); eco_dgvRanks.Rows[idx].Tag = grp.Permission; } Eco_UpdateRankEnables(); }
void eco_dgvRanks_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex == -1) { return; } object name = eco_dgvRanks.Rows[e.RowIndex].Cells[0].Value; object price = eco_dgvRanks.Rows[e.RowIndex].Cells[1].Value; Group grp = Group.Find(name.ToString()); if (grp == null) { return; // TODO: does this ever happen? } RankItem.RankEntry rank = Economy.Ranks.GetOrAdd(grp.Permission); rank.Price = int.Parse(price.ToString()); if (rank.Price == 0) { Economy.Ranks.Remove(grp.Permission); } }
void eco_dgvRanks_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex == -1) { return; } DataGridViewRow row = eco_dgvRanks.Rows[e.RowIndex]; object price = row.Cells[1].Value; // On Mono this event is raised during initialising cells too // However, first time event is raised, price is not initialised yet if (price == null) { return; } LevelPermission perm = (LevelPermission)row.Tag; RankItem.RankEntry rank = Economy.Ranks.GetOrAdd(perm); rank.Price = int.Parse(price.ToString()); if (rank.Price == 0) { Economy.Ranks.Remove(perm); } }