/// <summary> /// Initialize /// </summary> private void InitializeComponent() { run = new WinLLDP(OsInfo.GetStaticInfo()); ServiceName = MyServiceName; CanStop = true; EventLog.Source = ServiceName; EventLog.Log = "Application"; if (!EventLog.SourceExists(EventLog.Source)) { // Create Windows Event Log source if it doesn't exist EventLog.CreateEventSource(EventLog.Source, this.EventLog.Log); } ReduceMemory(); // Run the LLDP packet sender every 30 seconds timer = new Timer(TimeSpan.FromSeconds(30).TotalMilliseconds) { AutoReset = true }; timer.Elapsed += SendPacket; }
/// <summary> /// Initialize /// </summary> private void InitializeComponent() { run = new WinLLDP(); ServiceName = MyServiceName; CanStop = true; EventLog.Source = ServiceName; EventLog.Log = "Application"; if (!EventLog.SourceExists(EventLog.Source)) { // Create Windows Event Log source if it doesn't exist EventLog.CreateEventSource(EventLog.Source, this.EventLog.Log); } // Run the LLDP packet sender every 30 seconds timer = new Timer(TimeSpan.FromSeconds(30).TotalMilliseconds); //timer = new Timer(30 * 1000); timer.AutoReset = true; timer.Elapsed += sendPacket; }