예제 #1
0
        private void NewShopButton_Click(object sender, EventArgs e)
        {
            Shop newShop  = new Shop("Новий 1");
            Form editShop = new EditShopForm("Додати новий магазин", ref newShop, false, ref saveChangeFlag);

            editShop.ShowDialog();
            this.Visible = false;

            if (newShop.saveChangeFlag)
            {
                shopsListBox.Items.Clear();
                listOfShop.shopsList.Add(newShop);
                foreach (Shop shops in listOfShop.shopsList)
                {
                    shopsListBox.Items.Add(shops);
                }
            }
            this.Visible = true;
        }
예제 #2
0
 private void editShopButton_Click(object sender, EventArgs e)
 {
     if (shopsListBox.SelectedIndex > -1)
     {
         tempShop = shopsListBox.SelectedItem as Shop;
         Form editShop = new EditShopForm("Редагувати магазин", ref tempShop, true, ref saveChangeFlag);
         this.Visible = false;
         editShop.ShowDialog();
         shopsListBox.Items.Clear();
         foreach (Shop shops in listOfShop.shopsList)
         {
             shopsListBox.Items.Add(shops);
         }
         this.Visible = true;
     }
     else
     {
         MessageBox.Show("Виберіть магазин зі списку", "Помилка");
     }
 }