Esempio n. 1
0
        private void btnRefreshData_Click(object sender, EventArgs e)
        {
            #region 校验 “排除最新期数号” 和 “定码个数” 这两个值的合法性。
            string newestPeriodStr = this.txtNewestPeriod.Text ?? throw new ApplicationException("“排除最新期数号” 的值不能为空!");
            if (false == Regex.IsMatch(newestPeriodStr, @"^[1-9]+[0-9]*$"))
            {
                MessageBox.Show("“排除最新期数号” 的值格式非法!必须为不以 0 开头的非 0 正整数!");
                return;
            }
            int newestPeriod = int.Parse(newestPeriodStr);

            string dingMaString = this.txtDingMaCount.Text ?? throw new ApplicationException("“定码个数” 的值不能为空!");
            if (false == Regex.IsMatch(dingMaString, @"^[1-9]+[0-9]*$"))
            {
                MessageBox.Show("“定码个数” 的值格式非法!必须为不以 0 开头的非 0 正整数!");
                return;
            }
            int dingMaCount = int.Parse(dingMaString);

            if (dingMaCount + newestPeriod > 100)
            {
                MessageBox.Show("所设置的 “排除最新期数号” 和 “定码个数” 两个数的和不能大于 100!请重新设置!");
                return;
            }
            #endregion


            mgr.UpdateSelectedState(newestPeriod, dingMaCount);
            RefreshAllUIData(mgr);
        }