Exemplo n.º 1
0
        private void btnAddField_Click(object sender, EventArgs e)
        {
            frmGetInput = new frmInput(FieldInputPrompt, 60);

            if (frmGetInput.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    FieldService.AddNew(new Field {
                        CategoryId = (int)lstCategories.SelectedValue, Label = frmGetInput.Input
                    });

                    PopulateFieldsListBox((int)lstCategories.SelectedValue);
                    lstFields.SelectedIndex = (lstFields.Items.Count - 1);
                    PopulateFieldsColumns((int)lstCategories.SelectedValue);
                    PopulateAccountRows((int)lstCategories.SelectedValue);

                    AdjustGUI();

                    SendMessage("'" + frmGetInput.Input + "' added.", Color.Green);
                }
                catch (ArgumentException ex)
                {
                    SendMessage(ex.Message, Color.Red);
                }
            }
        }