/// <summary>
 /// 添加按钮点击响应
 /// </summary>
 protected void addButton_Click(object sender, EventArgs e)
 {
     mw.GiftConfig config = new mw.GiftConfig();
     config.id    = GiftTable.IdIncrease;
     config.title = TextManager.CreateText();
     config.desc  = TextManager.CreateText();
     config.icon  = "131409";
     config.from  = 160044;
     TextManager.SetText(config.title, this.titleTextBox.Text);
     TextManager.SetText(config.desc, this.descriptionTextBox.Text);
     GiftTable.GiftList.Add(config);
     GiftTable.GiftListEx.Add(config);
     TableManager.Save(GiftTable.GiftListEx);
     this.giftListBox.Items.Add(new ListItem(this.GetGiftText(config), config.id.ToString()));
     ++GiftTable.IdIncrease;
 }
 /// <summary>
 /// 获取礼包文本
 /// </summary>
 /// <param name="config">礼包配置</param>
 /// <returns>礼包文本</returns>
 private string GetGiftText(mw.GiftConfig config)
 {
     //return config.id + " | " + config.title;
     return(config.id + " | " + TextManager.GetText(config.title));
 }
        /// <summary>
        /// 修改物品按钮点击响应
        /// </summary>
        protected void modifyItemButton_Click(object sender, EventArgs e)
        {
            //道具数量不能为空
            if (string.IsNullOrEmpty(this.countTextBox.Text))
            {
                this.outputLabel.Text = TableManager.GetGMTText(702) + "!";
                return;
            }

            if (int.Parse(this.countTextBox.Text) == 0)
            {
                this.outputLabel.Text = TableManager.GetGMTText(703) + "!";
                return;
            }

            if (this.itemListBox.SelectedIndex < 0)
            {
                return;
            }
            if (giftListBox.SelectedIndex < 0)
            {
                outputLabel.Text = TableManager.GetGMTText(704) + "!";
                return;
            }

            var config_in_all = GiftTable.GiftListEx[this.giftListBox.SelectedIndex];

            mw.GiftConfig config = null;
            foreach (var cf in GiftTable.GiftListEx)
            {
                if (cf.id == config_in_all.id)
                {
                    config = cf;
                }
            }

            if (null == config)
            {
                outputLabel.Text = TableManager.GetGMTText(705) + "!";
                return;
            }

            switch (this.itemListBox.SelectedIndex)
            {
            case 0:
                config.reward_idx_0   = (mw.Enums.RewardType) this.typeDropDownList.SelectedIndex;
                config.reward_type_0  = int.Parse(this.idDropDownList.SelectedValue);
                config.reward_count_0 = int.Parse(this.countTextBox.Text);
                this.UpdateItem(0, config.reward_idx_0, config.reward_type_0, config.reward_count_0);
                break;

            case 1:
                config.reward_idx_1   = (mw.Enums.RewardType) this.typeDropDownList.SelectedIndex;
                config.reward_type_1  = int.Parse(this.idDropDownList.SelectedValue);
                config.reward_count_1 = int.Parse(this.countTextBox.Text);
                this.UpdateItem(1, config.reward_idx_1, config.reward_type_1, config.reward_count_1);
                break;

            case 2:
                config.reward_idx_2   = (mw.Enums.RewardType) this.typeDropDownList.SelectedIndex;
                config.reward_type_2  = int.Parse(this.idDropDownList.SelectedValue);
                config.reward_count_2 = int.Parse(this.countTextBox.Text);
                this.UpdateItem(2, config.reward_idx_2, config.reward_type_2, config.reward_count_2);
                break;

            case 3:
                config.reward_idx_3   = (mw.Enums.RewardType) this.typeDropDownList.SelectedIndex;
                config.reward_type_3  = int.Parse(this.idDropDownList.SelectedValue);
                config.reward_count_3 = int.Parse(this.countTextBox.Text);
                this.UpdateItem(3, config.reward_idx_3, config.reward_type_3, config.reward_count_3);
                break;
            }

            TableManager.Save(GiftTable.GiftListEx);
        }