//инициализация формы public formMain() { InitializeComponent(); HidePanels(); patientsList = new Patients(); patientsList.currentPatient = -1; patientsList.patients = new List<Patient>(); //загрузка из файлов if (File.Exists(screenFile)) screenData = ClassesLib.Screen.Read(screenFile); if (File.Exists(file)) { patientsList = Patients.Read(file); if (File.Exists(resultsFile)) ResultsToPatients(); } //обновление модели данных if (patientsList.patients.Count != 0) { if (patientsList.currentPatient == -1 && patientsList.currentPatient > patientsList.patients.Count) patientsList.currentPatient = 0; panelMain.Visible = true; MainPanelShowInfo(patientsList.patients[patientsList.currentPatient]); } else { panelPacients.Visible = true; PatientShowInfo(patientsList); ShowButtons(); buttonPacients.Visible = false; buttonStart.Visible = false; buttonSessions.Visible = false; buttonLevels.Visible = false; buttonResults.Visible = false; buttonPalitre.Visible = false; buttonMain.Visible = false; MessageBox.Show("Выберите пациента или создайте нового", "Внимание"); } }
//сохранение private void buttonScreenSave_Click(object sender, EventArgs e) { PixelParams(); screenData = bufferScreen; saved = true; ScreenActivateSaving(false); ClassesLib.Screen.Write(screenFile, screenData); }
//отмена private void buttonScreenCancel_Click(object sender, EventArgs e) { textBoxScreenHeight.Text = screenData.Height.ToString(); textBoxScreenWidth.Text = screenData.Width.ToString(); screenData = ClassesLib.Screen.Read(screenFile); ScreenShowInfo(screenData); saved = true; ScreenActivateSaving(false); }