public CustomApplicationContext() { TrayIcon.Icon = Properties.Resources.Icon; ContextMenu.Items.Add("&Adapter", null, AdapterContextMenuClickHandler); ContextMenu.Items.Add("-"); ContextMenu.Items.Add("E&xit", null, ExitContextMenuClickHandler); if (Properties.Settings.Default.SelectedAdapterID == "empty") { ShowAdapterChooser(); } DocumentWriter.WriteProperties(StatisticsCollector.GetStatistics(StatistiscType.undef)); statisticsThread = new Thread(() => GetStatistics()); statisticsThread.IsBackground = true; statisticsThread.Priority = ThreadPriority.BelowNormal; statisticsThread.Start(); }
private void GetStatistics() { while (!Program.exitFlag) { DocumentWriter.WriteIPInterfaceStatistics(StatisticsCollector.GetIPIntefaceStatistics()); DocumentWriter.WriteTCPStatistics(StatisticsCollector.GetTCPStatistics()); DocumentWriter.WriteIPStatistics(StatisticsCollector.GetIPStatistics()); DocumentWriter.WriteICMPStatistics(StatisticsCollector.GetICMPStatistics()); DocumentWriter.WriteUDPStatistics(StatisticsCollector.GetUDPStatistics()); try { Thread.Sleep(new TimeSpan(0, 1, 0)); } catch { ExitThread(); } } }