예제 #1
0
        /// <summary>
        /// 店数変更処理されたときに通知を受け取る。
        /// </summary>
        /// <param name="sender">送信元オブジェクト</param>
        /// <param name="e">イベントオブジェクト</param>
        private void OnButtonChangeShopCountClick(object sender, EventArgs e)
        {
            FormNumberInput form = new FormNumberInput();

            form.Number = Shops.Count - 1;
            if (form.ShowDialog(this) != DialogResult.OK)
            {
                return;
            }

            int newCount = form.Number + 1;

            if (newCount >= Shops.Count)
            {
                while (Shops.Count < newCount)
                {
                    int id = Shops.Count;
                    Shops.Add(new DataShop()
                    {
                        Id = id
                    });
                }
            }
            else if (newCount < Shops.Count)
            {
                while (Shops.Count > newCount)
                {
                    Shops.RemoveAt(Shops.Count - 1);
                }
            }

            ModelToUI();
        }