private void zapiszToolStripMenuItem_Click(object sender, EventArgs e) { if (savePath == "") { FolderBrowserDialog sfd = new FolderBrowserDialog(); if (sfd.ShowDialog() == DialogResult.OK && sfd.SelectedPath != "") { savePath = sfd.SelectedPath; } else { MessageBox.Show("Nie wybrano pliku", "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } SchoolFactory sf = new SchoolFactory(s, savePath); if (sf.Save()) { MessageBox.Show("Zapisano", "Sukces", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Cos nie dziala", "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void wczytajSzkoleToolStripMenuItem_Click(object sender, EventArgs e) { FolderBrowserDialog sfd = new FolderBrowserDialog(); if (sfd.ShowDialog() == DialogResult.OK && sfd.SelectedPath != "") { SchoolFactory sf = new SchoolFactory(sfd.SelectedPath); SchoolForm sForm = new SchoolForm(sf.Open(), sfd.SelectedPath.Remove(sfd.SelectedPath.LastIndexOf('\\'))); sForm.MdiParent = this; sForm.Show(); } else { MessageBox.Show("Nie wybrano pliku", "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }