private void SubmitButton(object sender, RoutedEventArgs e)
        {
            string file = nameBox.Text;

            //checks if the name already has .xml in it or not and add accordingly
            if (!file.EndsWith(".xml"))
            {
                file += ".xml";
            }

            path = Directory.GetCurrentDirectory();
            path = path.Substring(0, path.Length - 9);
            file = path + file;
            var f = File.Create(file);

            f.Close();
            using (StreamWriter sw = File.AppendText(file))
            {
                sw.WriteLine("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n");
                sw.WriteLine("<Test_Procedure rev=\"\">\n");
                sw.WriteLine("<Procedure_Heading>\n");
                sw.WriteLine("<System />\n"
                             + "<Description />\n"
                             + "<Name />\n"
                             + "<Date />\n"
                             + "<Time/>\n"
                             + "<Software_Load_Version />\n"
                             + "<Program_Phase />\n"
                             + "<Classification />\n"
                             + "<Signature />\n"
                             + "<Start_Time />\n"
                             + "<Stop_Time />\n"
                             + "</Procedure_Heading >\n");
                sw.WriteLine("<Sections>\n");
                sw.WriteLine("<Section id=\"1\">\n");
                sw.WriteLine("<Heading> 1.0 IOS DORT TESTS </Heading>\n");
                sw.WriteLine("<Description> short description </Description>\n");
                sw.WriteLine("<Test_Step id=\"1\">\n" +
                             "<Station></Station>\n" +
                             "<Control_Action></Control_Action>\n" +
                             "<Expected_Result></Expected_Result>\n" +
                             "<Result result=\"\"></Result>\n" +
                             "<Station></Station>\n" +
                             "<Station_Redline></Station_Redline>\n" +
                             "<Control_Action></Control_Action>\n" +
                             "<Control_Action_Redline></Control_Action_Redline>\n" +
                             "<Expected_Result></Expected_Result>\n" +
                             "<Expected_Result_Redline></Expected_Result_Redline>\n" +
                             "<Result result=\"\"></Result>\n" +
                             "<Comments/></Test_Step>\n");
                sw.WriteLine("</Section>\n");
                sw.WriteLine("</Sections>\n");
                sw.WriteLine("</Test_Procedure>");
            }

            TestAdmin admin = new TestAdmin(main, file);

            admin.Show();
        }
예제 #2
0
        private void edit_btn(object sender, RoutedEventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "XML files|*.xml";

            if ((bool)openFileDialog.ShowDialog())
            {
                this.Hide();
                TestAdmin admin = new TestAdmin(this, openFileDialog.FileName);

                admin.Show();
                // this.Close();
            }
            else
            {
                MessageBox.Show("No valid XML has been selected", "Error");
            }
        }
예제 #3
0
        public Redlines(bool createNewTP)
        {
            InitializeComponent();

            testAdmin = new TestAdmin(mw, "tmp.xml"); //creates the test admin object with the pre-existing test procedure
        }