private void btnLogin_Click(object sender, EventArgs e) { Action <string> action = null; Action <string> action2 = null; Action <string> action3 = null; Action <string> action4 = null; try { this.btnLogin.Text = "登录中,请等待..."; this.btnLogin.Enabled = false; this.TruncateLog(); if (this.Config == null) { this.Config = new DNSPodClientLite.Config(); } this.Config.LoginEmail = this.txtLoginEmail.Text.Trim(); this.Config.LoginPassword = this.txtLoginPassword.Text; this.Config.Save(); this.Api = new DNSPodClientLite.Api(this.Config.LoginEmail, this.Config.LoginPassword, this.Config.GetLocal()); this.Ddns = new DDns(this.Config.LastIp, this.Config.GetLocal()); if (action == null) { if (action3 == null) { action3 = delegate(string msg) { this.NotifyInfo(false, msg); }; } action = action3; } this.Ddns.Info += action; this.Ddns.Start(); this.Monitor = new HttpMonitor(this.Config); if (action2 == null) { if (action4 == null) { action4 = delegate(string msg) { this.NotifyInfo(false, msg); }; } action2 = action4; } this.Monitor.Info += action2; this.Monitor.Start(); this.ShowDomainList(); } catch (Exception exception) { this._logger.Error("flogin.btnLogin_Click has an error:{0}", new object[] { exception }); MessageBox.Show(exception.Message); } }
private void Reset() { Api = new DnsPodApi(Config, Config.GetLocal()); Ddns = new DDns(Config.LastIp, Config.GetLocal()); Monitor = new HttpMonitor(Config); }