public ShipConfigureMenu() { InitializeComponent(); stf_Data = DataStorage.Instance; stf_Data.InstatiateTables(); ShipDataTable = new DataTable(); ShipBaseTable = new DataTable(); ShipDataTable = stf_Data.STF_Ship_Data.Copy(); SelectedShipTable = stf_Data.STF_Ship_Data.Clone(); ShipBaseTable = stf_Data.STF_Ship_Data.Clone(); ShipWeaponTable = stf_Data.STF_Ship_Weapons.Clone(); CompiledComponents = stf_Data.STF_Ship_Components.Clone(); SelectedComps = stf_Data.STF_Ship_Components.Clone(); ConstructBaseShipData(); SBind = new BindingSource(); ShipNames = ReturnShips(stf_Data.STF_Ship_Data); SBind.DataSource = SelectedShipTable; ShipBrowseGrid.DataSource = SBind; CreateWeaponList(); ShipBrowseGrid.DefaultCellStyle.WrapMode = DataGridViewTriState.True; ShipBrowseGrid.Columns["Tier"].Visible = false; ShipBrowseGrid.Refresh(); SetColumnWidth(); SetShipBox(); }
public ShipWeaponBrowse() { InitializeComponent(); stf_Data = DataStorage.Instance; stf_Data.InstatiateTables(); ShipDataTable = new DataTable(); ShipDataTable = stf_Data.STF_Ship_Weapons.Copy(); SBind = new BindingSource(); SBind.DataSource = ShipDataTable; ShipBrowseGrid.DataSource = SBind; ShipBrowseGrid.DefaultCellStyle.WrapMode = DataGridViewTriState.True; ShipBrowseGrid.Refresh(); SetColumnWidth(); }
private void selectShipBox_SelectedIndexChanged(object sender, EventArgs e) { var aString = selectShipBox.SelectedItem.ToString(); SelectedShipTable = ShipBaseTable.AsEnumerable().Where(row => row.Field <String>("Ship") == aString).CopyToDataTable(); SBind.DataSource = SelectedShipTable; ShipBrowseGrid.Refresh(); var theName = SelectedShipTable.Rows[0][0].ToString(); var Large = Int32.Parse(SelectedShipTable.Rows[0][6].ToString()); var Med = Int32.Parse(SelectedShipTable.Rows[0][7].ToString()); var Small = Int32.Parse(SelectedShipTable.Rows[0][8].ToString()); var Tier = SelectedShipTable.Rows[0].Field <Int32>("Tier"); var Engine = SelectedShipTable.Rows[0].Field <string>("Engine"); ConfigureShipForm theForm = (this.Parent as ConfigureShipForm); theForm.componentSelect1.UpdateComponentBoxes(theName, Large, Med, Small, Tier, Engine); }
public void AddShipToData() { var aString = SelectedShipTable.Rows[0][0].ToString(); var olddt = ShipBaseTable.AsEnumerable().Where(row => row.Field <String>("Ship") == aString).CopyToDataTable(); DataRow dr = SelectedShipTable.Rows[0]; DataRow inputRow = olddt.Rows[0]; dr.BeginEdit(); var dt = CleanTheTable2(CompiledComponents).Copy(); inputRow["Max Crew"] = 0; for (int x = 2; x < dt.Columns.Count; x++) { string myColName = dt.Columns[x].ColumnName; int theNewInt = Int32.Parse(dt.Rows[0][x].ToString()); int theOldInt = Int32.Parse(inputRow[myColName].ToString()); int anInt = theOldInt + theNewInt; dr[myColName] = anInt; } var strEngine = EngineString(); if (strEngine.Length > 0) { DataTable myEngine = EngineData(strEngine); stf_Data.TestTable(myEngine); dr["Speed"] = Int32.Parse(myEngine.Rows[0]["Speed"].ToString()); dr["Agility"] = Int32.Parse(myEngine.Rows[0]["Agility"].ToString()); dr["Fuel Cost"] = Int32.Parse(myEngine.Rows[0]["Fuel Cost"].ToString()); } else { dr["Speed"] = 0; dr["Agility"] = 0; dr["Fuel Cost"] = 1; } dr["Fuel Range"] = ReturnFuelRange(dr); dr.AcceptChanges(); ShipBrowseGrid.Refresh(); UpdateWeaponList(); }
public void DisplayNewData() { SBind.DataSource = CompiledComponents; ShipBrowseGrid.Refresh(); }