Example #1
0
        private void monitor_Elapsed(object sender, ElapsedEventArgs e)
        {
            var NewIpAddress = GetIp.GetLocalIps();

            if (!NewIpAddress.SequenceEqual(LastIpAddress))
            {
                LastIpAddress = NewIpAddress;
                if (Config.CurrentConfig.SendWhenChange)
                {
                    SendIpAddressViaSMTP("IP address changed");
                }
            }
        }
Example #2
0
        public IpMonitor()
        {
            LastIpAddress = GetIp.GetLocalIps();
            if (Config.CurrentConfig.SendAtStartUp)
            {
                SendIpAddressViaSMTP("Program Initialed");
            }

            //监视时间
            monitor          = new Timer(60000);
            monitor.Elapsed += monitor_Elapsed;
            monitor.Start();
        }