Ejemplo n.º 1
0
 void IPresenter.SetFormatRoot(XmlElement formatRoot)
 {
     this.formatRoot    = formatRoot;
     this.reGrammarRoot = formatRoot.SelectSingleNode("regular-grammar");
     if (this.reGrammarRoot == null)
     {
         this.reGrammarRoot = formatRoot.AppendChild(formatRoot.OwnerDocument.CreateElement("regular-grammar"));
     }
     this.sampleLogAccess = new SampleLogAccess(reGrammarRoot);
     UpdateView();
 }
        void IPresenter.ShowDialog(
            XmlNode root,
            ISampleLogAccess sampleLogAccess
            )
        {
            this.currentFormatRoot = root;
            this.sampleLogAccess   = sampleLogAccess;

            dialog.CodeTextBoxValue = root.SelectSingleNode("json/transform")?.InnerText ?? "";
            dialog.Show();
        }
Ejemplo n.º 3
0
        void IPresenter.ShowDialog(
            XmlNode root,
            ISampleLogAccess sampleLogAccess
            )
        {
            this.currentFormatRoot = root;
            this.sampleLogAccess   = sampleLogAccess;

            using (var sw = new StringWriter())
                using (var xw = new XmlTextWriter(sw)
                {
                    Formatting = Formatting.Indented
                })
                {
                    var nsMgr = XmlFormat.UserDefinedFormatFactory.NamespaceManager;
                    root.SelectSingleNode("xml/xsl:stylesheet", nsMgr)?.WriteTo(xw);
                    dialog.CodeTextBoxValue = sw.ToString();
                }

            dialog.Show();
        }
        void IPresenter.ShowDialog(
            XmlNode formatRootNode,
            bool headerReMode,
            ISampleLogAccess sampleLog
            )
        {
            this.formatRootNode       = formatRootNode;
            this.headerReMode         = headerReMode;
            this.sampleLog            = sampleLog;
            this.emptyReModeIsAllowed = !headerReMode;
            this.headerRe             = ReadRe(formatRootNode, "head-re");
            this.bodyRe = ReadRe(formatRootNode, "body-re");

            UpdateStaticTexts(headerReMode);

            dialog.WriteControl(ControlId.RegExTextBox, headerReMode ? headerRe : bodyRe);
            dialog.ResetSelection(ControlId.RegExTextBox);

            dialog.WriteControl(ControlId.SampleLogTextBox, sampleLog.SampleLog);

            UpdateMatchesLabel(0);

            if (emptyReModeIsAllowed || string.IsNullOrWhiteSpace(dialog.ReadControl(ControlId.RegExTextBox)))
            {
                ExecRegex();
            }
            else
            {
                ResetReHilight();
            }

            UpdateEmptyReLabelVisibility();
            UpdateLegendVisibility();

            dialog.Show();
        }
Ejemplo n.º 5
0
 void IPresenter.ShowDialog(ISampleLogAccess sampleLog)
 {
     this.sampleLog             = sampleLog;
     view.SampleLogTextBoxValue = sampleLog.SampleLog;
     view.Show();
 }