Пример #1
0
        private async void ContentDialog_PrimaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
        {
            String richText;

            this.RichBox.Document.GetText(TextGetOptions.FormatRtf, out richText);

            var structureBuilder = new RtfParserListenerStructureBuilder();
            var parser           = new RtfParser(structureBuilder);

            parser.IgnoreContentAfterRootGroup = true; // support WordPad documents

            parser.Parse(new RtfSource(richText));

            var rtfStructure = structureBuilder.StructureRoot;

            // image converter
            var imageAdapter         = new RtfVisualImageAdapter(ImageFormat.Jpeg);
            var imageConvertSettings = new RtfImageConvertSettings(imageAdapter);

            imageConvertSettings.ScaleImage = true; // scale images
            var imageConverter = new RtfImageConverter(imageConvertSettings);

            // rtf interpreter
            var interpreterSettings = new RtfInterpreterSettings();

            var rtfDocument = RtfInterpreterTool.BuildDoc(rtfStructure, interpreterSettings, imageConverter);

            var htmlSegments = await RtfToHtmlSegments(rtfDocument.VisualContent);

            var anonymited = this.Anonymity.IsChecked.HasValue && this.Anonymity.IsChecked.Value == true;

            this.Result = new UgcDialogResult(anonymited, htmlSegments);

            //var deferral = args.GetDeferral();

            //deferral.Complete();
        }
Пример #2
0
        private UgcDialog()
        {
            this.InitializeComponent();

            this.Result = new UgcDialogResult();
        }
Пример #3
0
 private void ContentDialog_SecondaryButtonClick(ContentDialog sender, ContentDialogButtonClickEventArgs args)
 {
     this.Result = new UgcDialogResult();
 }