using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace QMAPP.WinForm.Forms.DisPatch
{
    public partial class DefaultDataSetNum : Form
    {
        public DefaultDataSetNum()
        {
            InitializeComponent();
        }
        /// <summary>
        /// 设置
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSet_Click(object sender, EventArgs e)
        {
            if (txtDataSetNum.Text.Trim().Length == 0)
            {
                MessageBox.Show("设置的值不允许为空!");
            }
            else
            {
                //QM.Config.CustomConfig.SetItem("ShowDataCount", txtDataSetNum.Text);
                QMAPP.WinForm.Common.LocalSetting.Settings["ShowDataCount"] = txtDataSetNum.Text;
                QMAPP.WinForm.Common.LocalSetting.Settings["RowCount"] = txtRowCount.Text;
                
                MessageBox.Show("设置成功!");
                FrmPlace fplace = (FrmPlace)this.Owner;
                fplace.GetInitData();
                fplace.InitContainer();
                this.Close();
            }
        }

        private void txtDataSetNum_KeyPress(object sender, KeyPressEventArgs e)
        {
           
            if (e.KeyChar != '\b' && !Char.IsDigit(e.KeyChar))
            {
                e.Handled = true;
            }

        }

        private void DefaultDataSetNum_Load(object sender, EventArgs e)
        {
            //txtDataSetNum.Text = QM.Config.CustomConfig.GetItem("ShowDataCount");
            txtDataSetNum.Text = QMAPP.WinForm.Common.LocalSetting.Settings["ShowDataCount"];
            txtRowCount.Text = QMAPP.WinForm.Common.LocalSetting.Settings["RowCount"];
        }
    }
}