Exemple #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 });
     }
 }
Exemple #2
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;
             ToolStripMenuItem item = (ToolStripMenuItem)sender;
             if (item.Text == "启用监控")
             {
                 new FMonitorSetting(this.domain, this.fLogin, tag).ShowDialog();
             }
             else
             {
                 this.fLogin.Config.RemoveMonitor(tag.RecordId);
             }
             this.fLogin.Config.Save();
             this.BindData();
         }
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message);
         this._logger.Error("fmonitor.enableddns has an error:{0}", new object[] { exception });
     }
 }
Exemple #3
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;
             this.fLogin.Config.RemoveDdns(tag.RecordId);
             this.fLogin.Config.Save();
             this.BindData();
         }
     }
     catch (Exception exception)
     {
         MessageBox.Show(exception.Message);
         this._logger.Error("fddns.disable_ddns has an error:{0}", new object[] { exception });
     }
 }
Exemple #4
0
 private void lvRecords_MouseClick(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         ListViewHitTestInfo info = this.lvRecords.HitTest(e.Location);
         if (info.Item != null)
         {
             Api.Record tag = (Api.Record)info.Item.Tag;
             if (tag.IsDdns)
             {
                 this.contextMenuStrip1.Items[0].Visible = false;
                 this.contextMenuStrip1.Items[1].Visible = true;
                 this.contextMenuStrip1.Items[2].Visible = true;
             }
             else
             {
                 this.contextMenuStrip1.Items[0].Visible = true;
                 this.contextMenuStrip1.Items[1].Visible = false;
                 this.contextMenuStrip1.Items[2].Visible = false;
             }
             this.contextMenuStrip1.Show(this.lvRecords, e.Location);
         }
     }
 }
Exemple #5
0
 public FMonitorSetting(Api.Domain domain, FLogin fLogin, Api.Record record) : this()
 {
     this.domain = domain;
     this.fLogin = fLogin;
     this.record = record;
 }