private void FrmEditGundam_Load(object sender, EventArgs e) { bindAll(); gundams = gundamFile.ListMachines(); lsGundam.DataSource = gundams; }
private void loadData() { this.gundamFile = new GundamFile(); stFile.Text = this.gundamFile.FileName; List <MachineConvertInfo> allConverts = gundamFile.ListConvert(); this.actions = GGCRUtil.ListConvertAction(); foreach (MachineConvertInfo c in allConverts) { bool find = false; foreach (KeyValuePair <string, string> kv in actions) { if (kv.Key == c.Action.ToString()) { find = true; break; } } if (!find) { GGCRUtil.AddConvertAction(c.Action, "未知" + c.Action); this.actions = GGCRUtil.ListConvertAction(); } } cboAction.DataSource = actions; cboAction.DisplayMember = "Value"; cboAction.ValueMember = "Key"; this.gundams = gundamFile.ListMachines(); foreach (GundamInfo g in gundams) { if (g.UUID == this.fromUuid) { this.gundam = g; break; } } fromSource.DataSource = this.gundams; toSource.DataSource = this.gundams; cboTo.DataSource = toSource.DataSource; cboTo.ValueMember = "UUID"; cboTo.DisplayMember = "UnitName"; cboFrom.DataSource = fromSource; cboFrom.ValueMember = "UUID"; cboFrom.DisplayMember = "UnitName"; if (this.gundam != null) { this.converts = new List <MachineConvertInfo>(); foreach (MachineConvertInfo c in allConverts) { if (c.From == gundam.UUID || c.To == gundam.UUID) { this.converts.Add(c); } } } else { this.converts = allConverts; } lsMain.DataSource = this.converts; }