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 }); } }
private void 启用监控ToolStripMenuItem_Click(object sender, EventArgs e) { try { if (lvRecords.SelectedItems.Count >= 1) { DnsPodApi.Record tag = (DnsPodApi.Record)lvRecords.SelectedItems[0].Tag; ToolStripMenuItem item = (ToolStripMenuItem)sender; if (item.Text == "启用监控") { new FMonitorSetting(domain, tag).ShowDialog(); } else { AppStatus.Default.Config.RemoveMonitor(tag.RecordId); } AppStatus.Default.Config.Save(); BindData(); } } catch (Exception exception) { MessageBox.Show(exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); _logger.Error("fmonitor.enableddns has an error:{0}", new object[] { exception }); } }
private void menuManualRefresh_Click(object sender, EventArgs e) { try { if (lvRecords.SelectedItems.Count >= 1) { DnsPodApi.Record tag = (DnsPodApi.Record)lvRecords.SelectedItems[0].Tag; 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 }); } } catch (Exception exception) { MessageBox.Show(exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); _logger.Error("fddns.enable_ddns has an error:{0}", new object[] { exception }); } }
private void menuDisableDdns_Click(object sender, EventArgs e) { try { if (lvRecords.SelectedItems.Count >= 1) { DnsPodApi.Record tag = (DnsPodApi.Record)lvRecords.SelectedItems[0].Tag; AppStatus.Default.Config.RemoveDdns(tag.RecordId); AppStatus.Default.Config.Save(); BindData(); } } catch (Exception exception) { MessageBox.Show(exception.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); _logger.Error("fddns.disable_ddns has an error:{0}", new object[] { exception }); } }
private void lvRecords_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { ListViewHitTestInfo info = lvRecords.HitTest(e.Location); if (info.Item != null) { DnsPodApi.Record tag = (DnsPodApi.Record)info.Item.Tag; if (tag.IsMonitor) { contextMenuStrip1.Items[1].Visible = true; contextMenuStrip1.Items[2].Visible = true; contextMenuStrip1.Items[0].Text = "禁用监控"; } else { contextMenuStrip1.Items[1].Visible = false; contextMenuStrip1.Items[2].Visible = false; contextMenuStrip1.Items[0].Text = "启用监控"; } contextMenuStrip1.Show(lvRecords, e.Location); } } }
private void lvRecords_MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { ListViewHitTestInfo info = lvRecords.HitTest(e.Location); if (info.Item != null) { DnsPodApi.Record tag = (DnsPodApi.Record)info.Item.Tag; if (tag.IsDdns) { menuEnableDdns.Visible = false; menuManualRefresh.Visible = true; menuDisableDdns.Visible = true; } else { menuEnableDdns.Visible = true; menuManualRefresh.Visible = false; menuDisableDdns.Visible = false; } contextMenuStrip1.Show(lvRecords, e.Location); } } }
public FMonitorSetting(DnsPodApi.Domain domain, DnsPodApi.Record record) : this() { this.domain = domain; this.record = record; }