private void btnSetStation_Click(object sender, EventArgs e) { int index = this.lvPayload.SelectedIndices[0]; FsPayloadStation station = payloadStations[index]; if (Properties.Settings.Default.UseMetric) { station.WeightKgs = double.Parse(txtStationWeight.Text); } else { station.WeightLbs = double.Parse(txtStationWeight.Text); } ps.WriteChanges(); checkWeight(); refreshPayloadList(); lvPayload.Focus(); }
private void lvPayload_SelectedIndexChanged(object sender, EventArgs e) { if (this.lvPayload.SelectedIndices.Count > 0) { txtStationWeight.Enabled = true; int index = this.lvPayload.SelectedIndices[0]; FsPayloadStation station = payloadStations[index]; lblStation.Text = lvPayload.SelectedItems[0].Text; if (Properties.Settings.Default.UseMetric) { txtStationWeight.Text = station.WeightKgs.ToString("F0"); } else { txtStationWeight.Text = station.WeightLbs.ToString("F0"); } } }