private void button4load_Click(object sender, EventArgs e) { try { string t = openFileDialog2continue.Title; okFileOprosOpen = false; openFileDialog2continue.Title = "Выберите исходный опрос"; openFileDialog2continue.ShowDialog(); if (!okFileOprosOpen) return; string source = openFileDialog2continue.FileName; okFileOprosOpen = false; openFileDialog2continue.Title = "Выберите догружаемый опрос"; openFileDialog2continue.ShowDialog(); if (!okFileOprosOpen) return; string add = openFileDialog2continue.FileName; opros res = new opros(); if (!res.load(source)) { MessageBox.Show("Выбраный файл не является опросом"); }; if (!res.connectOpr(add)) { MessageBox.Show("У опросников должны быть одинаковые анкеты" + Environment.NewLine + "Кроме того, они должны быть основаны на одном и том же опроснике"); return; } openFileDialog2continue.Title = t; okFileOprosSave = false; saveFileDialog1.ShowDialog(); if (!okFileOprosSave) return; res.save(saveFileDialog1.FileName); MessageBox.Show("Результат сохранён"); } catch (System.Exception ex) { MessageBox.Show(ex.Message); } }
private void button3continue_Click(object sender, EventArgs e) { try { okFileOprosOpen = false; openFileDialog2continue.ShowDialog(); if (okFileOprosOpen) { opros res = new opros(); FormBeginOpros fb = new FormBeginOpros(openFileDialog2continue.FileName, res); fb.ShowDialog(); if (fb.DialogResult != DialogResult.OK) return; res.testers.Insert(0, new tester()); //0ой тестер if (res.IsAnonimus == false) { anketaFill af = new anketaFill(res); af.ShowDialog(); if (af.DialogResult != DialogResult.OK) return; } mainOpros mo = new mainOpros(res); mo.ShowDialog(); if (mo.DialogResult != DialogResult.OK) return; res.save(openFileDialog2continue.FileName); MessageBox.Show("Опрос пройден. Результаты сохранены."); } } catch (System.Exception ex) { MessageBox.Show(ex.Message); } }