Пример #1
0
        private void GenerateBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            var rows = (IEnumerable <cBIV>)e.Argument;
            int i    = 0;

            foreach (var row in rows)
            {
                if (GenerateBackgroundWorker.CancellationPending)
                {
                    break;
                }
                //set status
                row.status = "Generating";
                GenerateBackgroundWorker.ReportProgress((i * 100 / rows.Count() * 100) / 100, row);
                var cDoc = row.DOC;
                if (cDoc != null)
                {
                    var generationContext = new GeneratorContext(cctsR, cDoc.TargetNamespace, cDoc.BaseUrn,
                                                                 cDoc.TargetNamespacePrefix, false, true,
                                                                 this.destinationFolderTextBox.Text, cDoc.BIV.DocL);
                    XSDGenerator.GenerateSchemas(generationContext);
                }
                i++;
                //set status
                row.status = "Finished";
                GenerateBackgroundWorker.ReportProgress((i * 100 / rows.Count() * 100) / 100, row);
            }
        }
        private void buttonExport_Click(object sender, RoutedEventArgs e)
        {
            var startTime = DateTime.Now;

            Cursor             = Cursors.Wait;
            textBoxStatus.Text = "Starting to generate XML schemas ...\n\n";
            GatherUserInput();
            var generationContexts = new List <GeneratorContext>();

            foreach (var cBiv in this.documentsListBox.Items
                     .OfType <CheckBox>()
                     .Where(x => x.IsChecked.HasValue && x.IsChecked.Value)
                     .Select(y => y.Tag as cBIV))
            {
                var cDoc = cBiv.DOC;
                if (cDoc != null)
                {
                    var generationContext = new GeneratorContext(cctsR, cDoc.TargetNamespace, cDoc.BaseUrn,
                                                                 cDoc.TargetNamespacePrefix, false, true,
                                                                 outputDirectory, cDoc.BIV.DocL);
                    generationContext.SchemaAdded += HandleSchemaAdded;
                    generationContexts.Add(generationContext);
                }
            }
            XSDGenerator.GenerateSchemas(generationContexts);

            textBoxStatus.Text += "\nGenerating XML schemas completed in " + (DateTime.Now - startTime).TotalSeconds + " seconds";

            Cursor = Cursors.Arrow;
        }
Пример #3
0
        public static void DoIt(
            string filePathExtendedMetadata_in
            )
        {
            XSDGenerator _generator = new XSDGenerator();

            _generator.Open(
                filePathExtendedMetadata_in,
                true,
                Notify
                );
            _generator.Build(Notify);
        }
        private void buttonExport_Click(object sender, RoutedEventArgs e)
        {
            Cursor             = Cursors.Wait;
            textBoxStatus.Text = "Starting to generate XML schemas ...\n\n";
            GatherUserInput();
            cBIV currentBIV = cache.BIVs[selectedBIVName];


            IDocLibrary docl = cctsR.GetDocLibraryById(currentBIV.Id);

            // TODO: xsd generator needs to be adapted - currently all doc libraries are being generated whereas
            // only the ones that are checked should be generated..

            //TODO: currently the wizard just takes the input from the text fields whereas the prefix and the
            // target namespace should be (a) stored in the cache and (b) read from there while generation..

            if (comboboxDocumentModel.SelectedItem.Equals("CCTS"))
            {
                // TODO: check if path is valid
                cDOC document = currentBIV.DOC;
                if (document != null && document.State == CheckState.Checked)
                {
                }
                string targetNamespace   = textboxTagetNamespace.Text;
                string namespacePrefix   = textboxPrefix.Text;
                bool   annotate          = checkboxDocumentationAnnotations.IsChecked == true ? true : false;
                bool   allschemas        = checkboxGenerateCcSchemas.IsChecked == true ? true : false;
                var    generationContext = new GeneratorContext(cctsR, targetNamespace,
                                                                namespacePrefix, annotate, allschemas,
                                                                outputDirectory, docl);
                generationContext.SchemaAdded += HandleSchemaAdded;
                XSDGenerator.GenerateSchemas(generationContext);
            }
            else
            {
                SubsetExporter.ExportSubset(docl, originalXMLSchema, outputDirectory);
            }
            textBoxStatus.Text += "\nGenerating XML schemas completed!";
            Cursor              = Cursors.Arrow;
        }