Beispiel #1
0
        private void menuCollapseAllGeneric_Click(object sender, EventArgs e)
        {
            var source = (ToolStripMenuItem)sender;
            var p      = (ContextMenuStrip)source.Owner;

            UIService.CollapseAll(((TreeView)p.SourceControl).SelectedNode);
        }
Beispiel #2
0
        private void menuDestinationGenerateXML_Click(object sender, EventArgs e)
        {
            var node = treeDestinationSchema.SelectedNode;

            if (node.Tag == null || !node.Tag.ToString().StartsWith("XML_ELEMENT"))
            {
                MessageBox.Show("Can only generate XML from element");
                return;
            }
            var xml = XmlService.PrettyPrint(UIService.GenerateXml(node), false);

            Clipboard.SetText(xml);
        }
Beispiel #3
0
        private void tab_SelectedIndexChanged(object sender, EventArgs e)
        {
            var caller = (TabControl)sender;

            if (caller.SelectedIndex != 2)
            {
                return;
            }
            caller.SelectedIndex = 0;
            var isSource = caller.Name == "tabSource";
            var schema   = isSource ? sourceSchema : destinationSchema;
            var instance = isSource ? sourceInstance : destinationInstane;

            using (var selectSchema = new SelectSchemaForm(isSource, schema, instance))
            {
                if (selectSchema.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
                {
                    return;
                }
                if (isSource)
                {
                    sourceSchema   = selectSchema.XmlSchema;
                    sourceInstance = selectSchema.XmlInstance;
                }
                else
                {
                    destinationSchema  = selectSchema.XmlSchema;
                    destinationInstane = selectSchema.XmlInstance;
                }
                var targetTreeSchema   = isSource ? treeSourceSchema : treeDestinationSchema;
                var targetTreeInstance = isSource ? treeSourceFile : treeDestinationFile;
                targetTreeSchema.Nodes.Clear();
                targetTreeInstance.Nodes.Clear();
                Enabled = false;
                if (!string.IsNullOrEmpty(selectSchema.XmlSchema))
                {
                    UIService.PopulateSchemaTree(targetTreeSchema, XmlService.CreateSchemaSet, selectSchema.XmlSchema, UIService.SelectRootElementCallback);
                }
                if (!string.IsNullOrEmpty(selectSchema.XmlInstance))
                {
                    UIService.PopulateInstanceTree(targetTreeInstance, XmlService.CreateReader, selectSchema.XmlInstance);
                }
                Enabled = true;
            }
        }
Beispiel #4
0
 private void btnBrowseInstance_Click(object sender, EventArgs e)
 {
     UIService.OpenFile("XML instance (*.xml)|*.xml", file => txtInstancePath.Text = file);
 }
Beispiel #5
0
 private void btnBrowseSchema_Click(object sender, EventArgs e)
 {
     UIService.OpenFile("XML schema (*.xsd)|*.xsd", file => txtSchemaPath.Text = file);
 }