private void allButton_Click(object sender, EventArgs e) { this.Hide(); Program.Adress = System.IO.Path.GetFullPath(@"ex.xml"); Practics practics = new Practics(); practics.Closed += (o, args) => { Show(); practics.Dispose(); }; practics.Show(); }
private void CreateButtons() { foreach (var file in Directory.EnumerateFiles(Path.GetFullPath("xml"))) { var doc = XDocument.Load(file); var btn = Program.CreateButton(doc.Root.Attribute("title").Value, Font); //Клик по создаваемой кнопке btn.Click += (sender, args) => { Hide(); Program.Adress = file; Program.TAdress = Path.GetFullPath(doc.Root.Attribute("theory").Value); Practics practics = new Practics(); //Закрытие формы практики practics.Closed += (_, __) => { Show(); practics.Dispose(); }; practics.Show(); }; flowLayoutPanel1.Controls.Add(btn); } }