예제 #1
0
        private void UpdateDNS()
        {
            try
            {
                notifyIcon.Icon = icoTrayC;
                List <string> msg = new List <string>();
                ddns.Update(msg);
                lblInfo.Text = "Last update on " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " (" + (msg.Count == 0 ? "OK" : "FAILED") + ")";
                if (msg.Count > 0)
                {
                    string tmsg = "Update of DuckDNS failed, check token and domain:\r\n";
                    foreach (string s in msg)
                    {
                        tmsg += s + "\r\n";
                    }

                    notifyIcon.Icon = icoTrayE;
                    notifyIcon.ShowBalloonTip(5000, "Error", tmsg, ToolTipIcon.Error);
                }
                else
                {
                    notifyIcon.Icon = icoTray;
                }
            }
            catch (Exception e)
            {
                notifyIcon.Icon = icoTrayE;
                notifyIcon.ShowBalloonTip(5000, "Error updating", "Error updating domain: " + e.Message, ToolTipIcon.Error);
            }
        }
예제 #2
0
파일: Form1.cs 프로젝트: v3gan/DuckDNS
 private void UpdateDNS()
 {
     try
     {
         notifyIcon.Icon = icoTrayC;
         bool update = ddns.Update();
         lblInfo.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " (" + (update ? "OK" : "FAILED") + ")";
         if (!update)
         {
             MessageBox.Show("Error updating Duck DNS domain", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
             Show();
         }
     }
     finally
     {
         notifyIcon.Icon = icoTray;
     }
 }