private void btnSetFuelTank_Click(object sender, EventArgs e) { int index = this.lvFuel.SelectedIndices[0]; FsFuelTank tank = ActiveTanks[index]; if (Properties.Settings.Default.UseMetric) { tank.WeightKgs = double.Parse(txtTankWeight.Text); } else { tank.WeightLbs = double.Parse(txtTankWeight.Text); } ps.WriteChanges(); checkWeight(); refreshTankList(); lvFuel.Focus(); }
private void lvFuel_SelectedIndexChanged(object sender, EventArgs e) { if (this.lvFuel.SelectedIndices.Count > 0) { txtTankWeight.Enabled = true; btnSetFuelTank.Enabled = true; int index = this.lvFuel.SelectedIndices[0]; FsFuelTank tank = ActiveTanks[index]; lblTankWeight.Text = lvFuel.SelectedItems[0].Text; if (Properties.Settings.Default.UseMetric) { txtTankWeight.Text = tank.WeightKgs.ToString("F0"); } else { txtTankWeight.Text = tank.WeightLbs.ToString("F0"); } } }