private void openExsistingToolStripMenuItem_Click(object sender, EventArgs e) { bool close = true; if (NeedSaving) { DialogResult result = MessageBox.Show("Save Current File?", "Saving", MessageBoxButtons.YesNoCancel); switch (result) { case DialogResult.Yes: if (work.PutInfoToFile(students, WorkWithFile.Ext, NeedSaving)) { NeedSaving = false; } else { close = false; } break; case DialogResult.No: break; case DialogResult.Cancel: close = false; break; } } if (close || !NeedSaving) { WorkWithFile.ChoseFileDialog(); if (WorkWithFile.FileName == "") { } else { if (work.GetInfoFromFile(WorkWithFile.Ext, ref students)) { visualization.Clean(); visualization.Source = students.Collection; visualization.Display(true); visualization.DisplayOnForm(this); this.Text = WorkWithFile.FileName; NeedSaving = false; IsOpened = true; } else { MessageBox.Show("File was corrupted", "Incorrect file", MessageBoxButtons.OK, MessageBoxIcon.Error); visualization.Clean(); visualization.Source = students.Collection; } } } }
private void makeTheTaskToolStripMenuItem_Click(object sender, EventArgs e) { if (IsOpened) { byte c = 0; bool ok = true; do { string course = Interaction.InputBox("Input The course"); ok = (course == "" || byte.TryParse(course, out c)); if (!ok) { c = 0; } } while (!ok); if (c != 0) { CStudents res = students.MainTAsk(c); Form ResForm = new Form(); ResForm.Width = 830; ResForm.Height = 600; ResForm.MaximumSize = ResForm.MinimumSize = new Size(830, 600); CVisualization resV = new CVisualization(res.Collection, new Point(40, 40)); resV.Display(false); resV.MakeUnAviable(); resV.DisplayOnForm(ResForm); ResForm.Show(); } } else { MessageBox.Show("You did not chose a file"); } }