Example #1
0
        private void ConnectButton_Click(object sender, EventArgs e)
        {
            if (!connected)
            {
                if (!TestExinPara())
                {
                    return;
                }
                string username = Algorithm.Encryption(Encoding.ASCII.GetBytes(id.EXin.UserName));
                string password = id.EXin.PassWord;

                bool dialSuccess = PPPoE.Connect("E信自由版", username, password);
                if (dialSuccess)
                {
                    this.statusLabel.Text   = "拨号成功!\r\n" + PPPoE.GetIPAddress("E信自由版");
                    this.ConnectButton.Text = "断开";
                    connected = true;

                    if (!uc.HaveBeenChecked)
                    {
                        uc.CheckUpdate();
                    }
                }
            }
            else
            {
                PPPoE.Disconnect("E信自由版");
                this.statusLabel.Text   = "断开连接成功!";
                this.ConnectButton.Text = "连接";
                connected = false;
            }
        }
Example #2
0
        public MainForm()
        {
            InitializeComponent();
            id = DataFile.GetImportantData();
            if (id != null)
            {
                if (id.EXin.UserName != null)
                {
                    this.idTextBox.Text = id.EXin.UserName;
                }
                if (id.EXin.PassWord != null)
                {
                    this.pwdTextBox.Text = id.EXin.PassWord;

                    eXinSaved = true;
                    this.saveCheckBox.Checked = true;
                }


                if (id.Router.UserName != null)
                {
                    this.id2TextBox.Text = id.Router.UserName;
                }

                if (id.Router.PassWord != null)
                {
                    this.pwd2TextBox.Text      = id.Router.PassWord;
                    routerSaved                = true;
                    this.save2CheckBox.Checked = true;
                }
                this.RouterModelComboBox.Items.Add((Object)("WR703N 3.17.1"));
                this.RouterModelComboBox.Items.Add((Object)("WR740N 5.1.3"));
                this.RouterModelComboBox.SelectedIndex = 1;
                if (PPPoE.IsEXinInActive())
                {
                    this.ConnectButton.Text = "断开";
                    this.statusLabel.Text   = "E信已连接";
                    connected = true;
                    if (!uc.HaveBeenChecked)
                    {
                        uc.CheckUpdate();
                    }
                }
            }
        }