private void SetFactors(List <FactorManager.FactorData> datas) { DataTable dt = new DataTable(); dt.Columns.Add("FactorType", typeof(FactorManager.FactorType)); dt.Columns.Add("Name", typeof(string)); dt.Columns.Add("NameTrans", typeof(string)); dt.Columns.Add("Desc", typeof(string)); dt.Columns.Add("DescTrans", typeof(string)); foreach (var item in datas) { dt.Rows.Add(item.FactorType, item.Name, item.NameTrans, item.Desc, item.DescTrans); } Extensions.SetGridDataSource(dataGridView2, dt); Extensions.SetGridColumnVisible(dataGridView2, "FactorType", false); //Extensions.SetGridColumnVisible(dataGridView2, "NameToCheck", false); //Extensions.SetGridColumnVisible(dataGridView2, "FactorType", false); Extensions.SetGridColumnSizeMode(dataGridView2, "Name", DataGridViewAutoSizeColumnMode.NotSet); Extensions.SetGridColumnSizeMode(dataGridView2, "NameTrans", DataGridViewAutoSizeColumnMode.NotSet); Extensions.SetGridColumnSizeMode(dataGridView2, "Desc", DataGridViewAutoSizeColumnMode.Fill); Extensions.SetGridColumnSizeMode(dataGridView2, "DescTrans", DataGridViewAutoSizeColumnMode.Fill); for (int i = 0; i < dataGridView2.RowCount; i++) { if ((FactorManager.FactorType)dataGridView2["FactorType", i].Value == FactorManager.FactorType.Characteristics) { Extensions.SetGridRowBackColor(dataGridView2, i, Color.FromArgb(0x34, 0xb6, 0xf4)); Extensions.SetGridRowForeColor(dataGridView2, i, SystemColors.ControlText); } else if ((FactorManager.FactorType)dataGridView2["FactorType", i].Value == FactorManager.FactorType.Suitability) { Extensions.SetGridRowBackColor(dataGridView2, i, Color.FromArgb(0xff, 0x75, 0xb0)); Extensions.SetGridRowForeColor(dataGridView2, i, SystemColors.ControlText); } else if ((FactorManager.FactorType)dataGridView2["FactorType", i].Value == FactorManager.FactorType.ParentSkill) { Extensions.SetGridRowBackColor(dataGridView2, i, Color.FromArgb(0x91, 0xcf, 0x2e)); Extensions.SetGridRowForeColor(dataGridView2, i, SystemColors.ControlText); } else { if (Program.ColorManager.SelectedScheme != null) { Extensions.SetGridRowBackColor(dataGridView2, i, Program.ColorManager.SelectedScheme.GrigStyle.BackColor); Extensions.SetGridRowForeColor(dataGridView2, i, Program.ColorManager.SelectedScheme.GrigStyle.ForeColor); } } } }
private void SetFreeShopItems(List <FreeShopManager.FreeShopItemData> datas) { DataTable dt = new DataTable(); dt.Columns.Add("Id", typeof(long)); dt.Columns.Add("Item", typeof(Image)); dt.Columns.Add("Price", typeof(long)); dt.Columns.Add("Name", typeof(string)); dt.Columns.Add("NameTrans", typeof(string)); dt.Columns.Add("Description", typeof(string)); dt.Columns.Add("DescriptionTrans", typeof(string)); foreach (var item in datas) { Image img = null; foreach (var iconPath in freeShopitemIconPathes) { img = Program.IconDB.GetImageByKey(iconPath, item.ItemId.ToString()); if (img != null) { break; } } dt.Rows.Add(item.ItemId, img, item.ItemPrice, item.ItemName, item.ItemNameTrans, item.ItemDesc, item.ItemDescTrans); } Extensions.SetGridDataSource(dataGridView4, dt); Extensions.SetGridColumnVisible(dataGridView4, "Id", false); Extensions.SetGridColumnSizeMode(dataGridView4, "Item", DataGridViewAutoSizeColumnMode.AllCells); Extensions.SetGridColumnSizeMode(dataGridView4, "Price", DataGridViewAutoSizeColumnMode.NotSet); Extensions.SetGridColumnSizeMode(dataGridView4, "Name", DataGridViewAutoSizeColumnMode.Fill); Extensions.SetGridColumnSizeMode(dataGridView4, "NameTrans", DataGridViewAutoSizeColumnMode.Fill); Extensions.SetGridColumnSizeMode(dataGridView4, "Description", DataGridViewAutoSizeColumnMode.Fill); Extensions.SetGridColumnSizeMode(dataGridView4, "DescriptionTrans", DataGridViewAutoSizeColumnMode.Fill); for (int i = 0; i < dataGridView4.RowCount; i++) { if (Program.ColorManager.SelectedScheme != null) { Extensions.SetGridRowBackColor(dataGridView4, i, Program.ColorManager.SelectedScheme.GrigStyle.BackColor); Extensions.SetGridRowForeColor(dataGridView4, i, Program.ColorManager.SelectedScheme.GrigStyle.ForeColor); } } }
private void SetMissions(List <MissionManager.MissionData> datas) { DataTable dt = new DataTable(); dt.Columns.Add("Id", typeof(long)); dt.Columns.Add("Item", typeof(Image)); dt.Columns.Add("Count", typeof(long)); dt.Columns.Add("Mission", typeof(string)); dt.Columns.Add("MissionTrans", typeof(string)); foreach (var item in datas) { Image img = null; foreach (var iconPath in itemIconPathes) { img = Program.IconDB.GetImageByKey(iconPath, item.ItemId.ToString()); if (img != null) { break; } } dt.Rows.Add(item.Id, img, item.ItemCount, item.MissionText, item.TransMissionText); } Extensions.SetGridDataSource(dataGridView3, dt); Extensions.SetGridColumnVisible(dataGridView3, "Id", false); Extensions.SetGridColumnSizeMode(dataGridView3, "Item", DataGridViewAutoSizeColumnMode.AllCells); Extensions.SetGridColumnSizeMode(dataGridView3, "Count", DataGridViewAutoSizeColumnMode.NotSet); Extensions.SetGridColumnSizeMode(dataGridView3, "Mission", DataGridViewAutoSizeColumnMode.Fill); Extensions.SetGridColumnSizeMode(dataGridView3, "MissionTrans", DataGridViewAutoSizeColumnMode.Fill); for (int i = 0; i < dataGridView3.RowCount; i++) { if (Program.ColorManager.SelectedScheme != null) { Extensions.SetGridRowBackColor(dataGridView3, i, Program.ColorManager.SelectedScheme.GrigStyle.BackColor); Extensions.SetGridRowForeColor(dataGridView3, i, Program.ColorManager.SelectedScheme.GrigStyle.ForeColor); } } }