Ejemplo n.º 1
0
        private void addButton_Click(object sender, EventArgs e)
        {
            string name = nameInput.Text;

            ;           string state = stateInput.Text;
            var isNotNull            = false;

            if (name.Trim() == "")
            {
                MessageBox.Show("Введите наименование гитары");
                isNotNull = true;
            }
            else
            {
                isNotNull = false;
            }
            if (state.Trim() == "")
            {
                MessageBox.Show("Введите состояние гитары");
                isNotNull = true;
            }
            else
            {
                isNotNull = false;
            }

            if (isNotNull)
            {
                ProductGuitarInfo guitar1 = new ProductGuitarInfo(name, state);
                ReadWriteFile     file    = new ReadWriteFile();
                file.Write(guitar1.Name + "|" + guitar1.State, "Data");
                guitar = guitar1;
            }
        }