Beispiel #1
0
        private void buttonRemove_Click(object sender, EventArgs e) {
			LevelItem item = Economy.Levels;
            item.Presets.Remove(item.FindPreset(dataGridView1.SelectedRows[0].Cells[0].Value.ToString()));
            dataGridView1.Rows.RemoveAt(dataGridView1.SelectedRows[0].Index);
            buttonRemove.Enabled = checkBoxLevel.Checked && dataGridView1.SelectedRows.Count > 0;
            buttonEdit.Enabled = checkBoxLevel.Checked && dataGridView1.SelectedRows.Count > 0;
        }
Beispiel #2
0
        private void buttonOk_Click(object sender, EventArgs e)
        {
            LevelItem item = Economy.Levels;

            if (edit)
            {
                item.Presets.Remove(item.FindPreset(lvledit.oldname));
            }
            LevelItem.LevelPreset preset = new LevelItem.LevelPreset();
            preset.name  = textBoxName.Text.Split()[0];
            preset.price = (int)numericUpDownPrice.Value;
            preset.x     = comboBoxX.SelectedItem.ToString();
            preset.y     = comboBoxY.SelectedItem.ToString();
            preset.z     = comboBoxZ.SelectedItem.ToString();
            preset.type  = comboBoxType.SelectedItem.ToString().ToLower();

            item.Presets.Add(preset);
            eco.UpdateLevels();
            eco.CheckLevelEnables();
            this.Close();
        }