private void listBox2_SelectedIndexChanged(object sender, EventArgs e) { PrmFile selected = Params[listBox1.SelectedIndex]; if (listBox2.SelectedIndex >= 0) { UpdateTextBoxes(); } else { DisableTextBoxes(); } }
private void stringBox_TextChanged(object sender, EventArgs e) { if (noEdit) { return; } PrmFile selected = Params[listBox1.SelectedIndex]; PrmData seldat = selected.GetData((string)listBox2.SelectedItem); seldat.StringValue = stringBox.Text; selected.SetData((string)listBox2.SelectedItem, seldat); UpdateTextBoxes(); }
private void doubleUpDown_ValueChanged(object sender, EventArgs e) { if (noEdit) { return; } PrmFile selected = Params[listBox1.SelectedIndex]; PrmData seldat = selected.GetData((string)listBox2.SelectedItem); seldat.DoubleValue = (double)doubleUpDown.Value; selected.SetData((string)listBox2.SelectedItem, seldat); UpdateTextBoxes(); }
/* These functions update the values of parameter */ private void sizeUpDown_ValueChanged(object sender, EventArgs e) { if (noEdit) { return; } PrmFile selected = Params[listBox1.SelectedIndex]; if (MessageBox.Show("Changing this may cause loss of data, are you sure you want to continue?", "Change Size", MessageBoxButtons.YesNo) == DialogResult.Yes) { selected.SetSize((string)listBox2.SelectedItem, (uint)sizeUpDown.Value); } UpdateTextBoxes(); }
/* Updates textbox values and enables the ones needed */ private void UpdateTextBoxes() { DisableTextBoxes(); noEdit = true; PrmFile selected = Params[listBox1.SelectedIndex]; PrmData seldat = selected.GetData((string)listBox2.SelectedItem); sizeUpDown.Value = seldat.Size; byteUpDown.Value = seldat.ByteValue; wordUpDown.Value = seldat.ShortValue; intUpDown.Value = seldat.IntValue; singleUpDown.Value = (decimal)seldat.SingleValue; doubleUpDown.Value = (decimal)seldat.DoubleValue; vectorBox.Text = seldat.VectorValue.ToString(); stringBox.Text = seldat.StringValue; int size = seldat.Size; if (size == 1) { byteUpDown.Enabled = true; } else if (size == 2) { wordUpDown.Enabled = true; } else if (size == 4) { singleUpDown.Enabled = true; intUpDown.Enabled = true; } else if (size == 8) { doubleUpDown.Enabled = true; } else if (size == 12) { vectorBox.Enabled = true; } stringBox.Enabled = true; sizeUpDown.Enabled = true; noEdit = false; }
private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { PrmFile selected = Params[listBox1.SelectedIndex]; listBox2.Items.Clear(); string[] keys = selected.GetAllKeys(); foreach (string key in keys) { listBox2.Items.Add(key); } if (listBox2.Items.Count != 0) { listBox2.SelectedIndex = 0; } else { listBox2.SelectedIndex = -1; } }
private void vectorBox_TextChanged(object sender, EventArgs e) { if (noEdit) { return; } PrmFile selected = Params[listBox1.SelectedIndex]; PrmData seldat = selected.GetData((string)listBox2.SelectedItem); Vector outvec; if (!Vector.TryParse(vectorBox.Text, out outvec)) { return; } seldat.VectorValue = outvec; selected.SetData((string)listBox2.SelectedItem, seldat); UpdateTextBoxes(); }