示例#1
0
 private void 启用动态解析ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         if (this.lvRecords.SelectedItems.Count >= 1)
         {
             Api.Record        tag     = (Api.Record) this.lvRecords.SelectedItems[0].Tag;
             Config.DDNSConfig config2 = new Config.DDNSConfig {
                 Domain    = this.domain.Name,
                 DomainId  = this.domain.DomainId,
                 RecordId  = tag.RecordId,
                 Subdomain = tag.Name
             };
             Config.DDNSConfig item = config2;
             this.fLogin.Config.AddDdns(item);
             this.fLogin.Api.Ddns(this.domain.DomainId, tag.RecordId, this.fLogin.Ddns.LastIp);
             new Logger("ddns").Info("change ip:{0}.{1}({2})-{3}", new object[] { tag.Name, this.domain.Name, tag.RecordId, this.fLogin.Ddns.LastIp });
             this.fLogin.Config.Save();
             this.BindData();
         }
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message);
         this._logger.Error("fddns.enable_ddns has an error:{0}", new object[] { exception });
     }
 }
示例#2
0
 private void menuEnableDdns_Click(object sender, EventArgs e)
 {
     try
     {
         if (lvRecords.SelectedItems.Count >= 1)
         {
             DnsPodApi.Record  tag     = (DnsPodApi.Record)lvRecords.SelectedItems[0].Tag;
             Config.DDNSConfig config2 = new Config.DDNSConfig
             {
                 Domain    = domain.Name,
                 DomainId  = domain.DomainId,
                 RecordId  = tag.RecordId,
                 Subdomain = tag.Name
             };
             Config.DDNSConfig item = config2;
             AppStatus.Default.Config.AddDdns(item);
             AppStatus.Default.Api.UpdateDns(domain.DomainId, tag.RecordId, AppStatus.Default.Ddns.LastIp);
             new Logger("ddns").Info("change ip:{0}.{1}({2})-{3}", new object[] { tag.Name, domain.Name, tag.RecordId, AppStatus.Default.Ddns.LastIp });
             AppStatus.Default.Config.Save();
             BindData();
         }
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
         _logger.Error("fddns.enable_ddns has an error:{0}", new object[] { exception });
     }
 }