public ListWindow() { InitializeComponent(); Instance = this; if (AdminUtil.IsRunAsAdmin()) { RegUtil.SelfRunning(); } WindowStartupLocation = WindowStartupLocation.CenterScreen; string appPath = System.Windows.Forms.Application.StartupPath; FileInfo[] files = new DirectoryInfo(appPath).GetFiles(); foreach (FileInfo file in files) { string fileName = file.Name.ToLower(); if (fileName.StartsWith("content-") && fileName.EndsWith(".txt")) { string time = fileName.Substring(8, 13); Trip trip = new Trip(time); MainWindow mainWindow = new MainWindow(trip); mainWindows.Add(mainWindow); listView.Items.Add(trip); mainWindow.Show(); } } InitialTray(); //一启动就最小化至托盘 }