private void scanToBuildDatabaseToolStripMenuItem_Click(object sender, EventArgs e) { if (Application.OpenForms.OfType <Dictionary>().Count() == 1) { Application.OpenForms.OfType <Dictionary>().First().Hide(); } Scanning scan = new Scanning(); scan.ShowDialog(this); if (Application.OpenForms.OfType <Dictionary>().Count() == 1) { Application.OpenForms.OfType <Dictionary>().First().Close(); } }
private void Form1_Shown(object sender, EventArgs e) { string dat = "Database.dat"; if (File.Exists(dat)) { using (StreamReader sr = new StreamReader(dat)) { string line; while ((line = sr.ReadLine()) != null) { Data.listpath.Add(line); Data.listfile.Add(Path.GetFileName(line).ToLower()); } } } else { Scanning scan = new Scanning(); scan.ShowDialog(this); } }