Exemple #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;
            }
        }
Exemple #2
0
        private void PrintRandomGuitars_Click(object sender, EventArgs e)
        {
            ProductGuitarInfo guitar1 = new ProductGuitarInfo("guitar1", "good");

            guitar1.ShowLProductInfo();
            ProductGuitarInfo guitar2 = new ProductGuitarInfo("guitar2", "bad");

            guitar2.ShowLProductInfo();
            // Показать главное отличие структур от классов
            guitar1       = guitar2;
            guitar2.Name  = "guitar3";
            guitar2.State = "Very good";
            guitar1.ShowLProductInfo();
            guitar2.ShowLProductInfo();
        }
Exemple #3
0
 public void ShowLastProductInfo(ProductGuitarInfo product)
 {
     MessageBox.Show("Last Product:\nGuitar Name:" + product.Name + "\nState Product: " + product.State);
 }