Esempio n. 1
0
        private void сохранитьТестыToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var editableTests = ListTests.Where(p => p.Value.Editable);
            var jsonCreator   = new JsonCreator();

            foreach (var keyValue in editableTests)
            {
                var filename = new DynamicParams().GetPath() + "\\" + keyValue.Value.TestName + ".test";
                var testJson = jsonCreator.CreateTestCollection(new List <Test> {
                    keyValue.Value
                });
                // сохраняем текст в файл
                File.WriteAllText(filename, testJson);
            }
            File.WriteAllText(new DynamicParams().GetPath() + "\\PlatoonAndCourses.test", jsonCreator.CreatePlatoonAndCourses());

            var picureCreator = new PictureCreator();

            foreach (var keyValue in editableTests)
            {
                picureCreator.CreatePictures(keyValue.Value, new DynamicParams().GetPath());
            }

            MessageBox.Show("Файл сохранен");
        }
Esempio n. 2
0
        private void сохранитьТестыToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //Directory.Delete(new DynamicParams().GetPath(), true);

            DirectoryInfo dirTests = new DirectoryInfo(new DynamicParams().GetPath());
            DirectoryInfo dirPics  = new DirectoryInfo(new DynamicParams().GetPath() + "\\" + "picture");

            foreach (FileInfo file in dirTests.GetFiles())
            {
                file.Delete();
            }

            foreach (FileInfo file in dirPics.GetFiles())
            {
                file.Delete();
            }
            //string sadasd = new DynamicParams().GetPath() + "\\" + "picture";
            //dirTests.CreateSubdirectory(sadasd);

            foreach (KeyValuePair <Panel, Test> keyValue in ListTests)
            {
                string filename = new DynamicParams().GetPath() + "\\" + keyValue.Value.TestName + ".test";
                string testJson = new JsonCreator().CreateTestCollection(new List <Test> {
                    keyValue.Value
                });
                // сохраняем текст в файл
                File.WriteAllText(filename, testJson);
            }

            var picureCreator = new PictureCreator();

            foreach (KeyValuePair <Panel, Test> keyValue in ListTests)
            {
                picureCreator.CreatePictures(keyValue.Value, new DynamicParams().GetPath());
            }

            MessageBox.Show(@"Пожалуйста, введите имя пользователя и пароль");
        }