Example #1
0
        private void GetRoute()
        {
            XMLSettingsGlobal global = new XMLSettingsGlobal().Read("XMLConfigGlobal.xml") as XMLSettingsGlobal;
            XMLConfigUser     user   = new XMLConfigUser().Read() as XMLConfigUser;

            this.Invoke(new MethodInvoker(delegate
            {   //异步陷阱: 这里不能用BeginInvoke,否则会由于下面user.Save()先执行,从而导致保存的数据不正确
                //          或者直接把user.Save();包含进来也可以
                if (rbDianx.Checked)
                {
                    this.txtDownFile.Text = global.Website1;
                    user.SelectedISP      = ISP.ChinaTelecom;
                }
                else if (rbWangt.Checked)
                {
                    this.txtDownFile.Text = global.Website2;
                    user.SelectedISP      = ISP.ChinaUnicom;
                }
                else
                {
                    this.txtDownFile.Text = global.Website;
                }
            }));

            user.Save();
        }
Example #2
0
        private bool Inite()
        {
            XMLConfigUser user = new XMLConfigUser().Read() as XMLConfigUser;

            this.BeginInvoke(new MethodInvoker(delegate
            {
                if (user.SelectedISP == ISP.ChinaTelecom)
                {
                    rbDianx.Checked = true;
                }
                else if (user.SelectedISP == ISP.ChinaUnicom)
                {
                    rbWangt.Checked = true;
                }
            }));

            if (user.SelectedISP != ISP.Default)
            {
                return(true);
            }
            else
            {
                GetRoute();
                return(false);
            }
        }