private void LoadIpAddressCb(RecordUpdateRequest theRur) { string strJsonIp = string.Format("Dynamic/Public (JSONIP.com) / {0}", DnsCymbalUpdater.GetPublicIP()); NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces(); foreach (NetworkInterface nic in nics) { if (nic.NetworkInterfaceType == NetworkInterfaceType.Loopback) { // Skip } else if (nic.OperationalStatus == OperationalStatus.Up && nic.Speed > 0) { _cbIpAddress.Items.Add(new IpAddressOption(nic)); } } // Add JSONIP dynamic option _cbIpAddress.Items.Add(strJsonIp); // JSONIP.com option selected? if (null != theRur && theRur.IpAddressType == RecordUpdateRequest.IpAddressTypes.JsonIp) { _cbIpAddress.SelectedItem = strJsonIp; _toolTip.SetToolTip(_cbIpAddress, strJsonIp); } }
/// <summary> /// The main entry point for the application. /// </summary> static void Main() { // Local Variables bool bIsService = IsService(); // Are we a genuine service? if (bIsService) { // Run the service ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new MainService() }; ServiceBase.Run(ServicesToRun); } else { // Turn on visual styling Application.EnableVisualStyles(); // Run in interactive mode... DnsCymbalUpdater dcu = new DnsCymbalUpdater(); dcu.Start(); TrayIcon ti = new TrayIcon(dcu); ti.ShowDialog(); } }
public TrayIcon(DnsCymbalUpdater dcu) { _dcu = dcu; Init(); }