Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var result = default(TonalityMarkingOutputResult);

            using (var client = new TonalityMarkingWcfClient(ENDPOINT_CONFIGURATION_NAME))
            {
                var inputParams = new TonalityMarkingInputParams(this.InputText)
                {
                    InquiriesSynonyms = UseInquiry ? InquiryText.ToTextList() : null,
                };

                result = client.ExecuteTonalityMarking(inputParams);
            }

            var originalText     = this.InputText;
            var offsetsProcessor = new OffsetsProcessor(/*this.InputText*/);

            //var viewInWindowText = (this.ViewInWindow ? (this.InputText + Extensions.HR) : string.Empty);

            resultHtmlDiv.InnerHtml = result.InquiryAllocateStatus.ToHtml(this.UseInquiry, this.InquiryText) +
                                      result.AuthorTonalityMarkingTuple.ToHtml() +
                                      Extensions.HR +
                                      ((this.OutputType == OutputTypeEnum.Xml_Custom && this.ViewInWindow) ? (this.InputText + "<hr/>") : string.Empty) +
                                      result.ToHtml(OutputType, Server, offsetsProcessor, originalText, OffsetCreationXmlType);
        }
Ejemplo n.º 2
0
        public static string ToHtml
        (
            this TonalityMarkingOutputResult result,
            OutputTypeEnum outputType,
            HttpServerUtility server,
            OffsetsProcessor offsetsProcessor,
            string originalText,
            OffsetCreationXmlTypeEnum offsetCreationXmlType
        )
        {
            var xdoc = result.OutputXml.ToXDocument();

            var offsetsString = offsetsProcessor.CreateOffsetsString(xdoc.Root);
            //var offsetsXml    = offsetsProcessor.CreateOffsetsString( xdoc.Root, global::OffsetsBases.TextFormat.Xml );

            var xdoc2        = default(XDocument);
            var xsltFilename = default(string);

            switch (offsetCreationXmlType)
            {
            case OffsetCreationXmlTypeEnum.Flat:
                xdoc2 = OffsetsString2XDocumentConverter.ConvertToFlat(originalText, offsetsString);

                #region
                switch (outputType)
                {
                case OutputTypeEnum.Xml_Custom:
                    xsltFilename = XSLT_FILENAME_XML_CUSTOM;
                    break;

                case OutputTypeEnum.Html_FinalTonality:
                    xsltFilename = XSLT_FILENAME_OFFSETS_FLAT;
                    break;

                default:
                    throw (new ArgumentException(outputType.ToString()));
                }
                #endregion
                break;

            case OffsetCreationXmlTypeEnum.Hierarchy:
                xdoc2 = OffsetsString2XDocumentConverter.ConvertToHierarchy(originalText, offsetsString);

                #region
                switch (outputType)
                {
                case OutputTypeEnum.Xml_Custom:
                    xsltFilename = XSLT_FILENAME_XML_CUSTOM;
                    break;

                case OutputTypeEnum.Html_FinalTonality:
                    xsltFilename = XSLT_FILENAME_OFFSETS_HIERARCHY;
                    break;

                default:
                    throw (new ArgumentException(outputType.ToString()));
                }
                #endregion
                break;

            default:
                throw (new ArgumentException(offsetCreationXmlType.ToString()));
            }

            var html = xsltFilename.MakeXslt(xdoc2, server);
            return(html);
        }