Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Enabled = false;
            Close();

            string maxFile  = textBox1.Text;
            string schFile  = textBox2.Text;
            string svrlFile = textBox3.Text;

            // Update Package SchematronFile
            EA.TaggedValue tvSchematronFile = GetSchematronTaggedValue(repository);
            tvSchematronFile.Value = schFile;
            tvSchematronFile.Update();

            // Create MAX file
            MAX_EA.MAXExporter3 exporter = new MAX_EA.MAXExporter3();
            EA.ObjectType       type     = repository.GetTreeSelectedItemType();
            if (type == EA.ObjectType.otPackage)
            {
                EA.Package package = repository.GetTreeSelectedPackage();
                exporter.exportPackage(repository, package, maxFile);
            }
            else if (type == EA.ObjectType.otDiagram)
            {
                EA.Diagram diagram = (EA.Diagram)repository.GetTreeSelectedObject();
                exporter.exportDiagram(repository, diagram, maxFile);
            }

            // Execute Transform
            issues = new MAXValidator().validate(repository, maxFile, schFile, svrlFile);
        }
Exemplo n.º 2
0
        private void go(bool openOutput)
        {
            Enabled = false;
            Close();

            string maxFile    = textBox1.Text;
            string xsltFile   = textBox2.Text;
            string outputFile = textBox3.Text;

            // Update project XSLTFile
            EA.TaggedValue tvXsltFile = GetXsltTaggedValue(repository);
            tvXsltFile.Value = xsltFile;
            tvXsltFile.Update();

            // Create MAX file
            MAX_EA.MAXExporter3 exporter = new MAX_EA.MAXExporter3();
            EA.ObjectType       type     = repository.GetTreeSelectedItemType();
            if (type == EA.ObjectType.otPackage)
            {
                EA.Package package = repository.GetTreeSelectedPackage();
                exporter.exportPackage(repository, package, maxFile);
            }
            else if (type == EA.ObjectType.otDiagram)
            {
                EA.Diagram diagram = (EA.Diagram)repository.GetTreeSelectedObject();
                exporter.exportDiagram(repository, diagram, maxFile);
            }

            // Execute Transform
            // TODO: Show feedback about the transform steps
            if (transform(repository, maxFile, xsltFile, outputFile))
            {
                if (openOutput)
                {
                    string outputURL = new Uri(outputFile).ToString();
                    System.Diagnostics.Process.Start(outputURL);
                }
            }
            else
            {
                issues = true;
            }
        }