示例#1
0
        public UmlToolWindowViewModel()
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            try
            {
                var fileCode = GetFileContent();

                if (fileCode.Equals(string.Empty))
                {
                    return;
                }

                var classCode = ClassParser.Parse(fileCode);

                var plantCode = UmlRenderer.Render(classCode);

                var renderFactory = new PlantUml.Net.RendererFactory();

                var plantUmlRenderer = renderFactory.CreateRenderer();

                using (var mStream = new MemoryStream(plantUmlRenderer.Render(plantCode, OutputFormat.Png)))
                {
                    UmlOutput = BitmapFrame.Create(mStream, BitmapCreateOptions.None, BitmapCacheOption.OnLoad);
                }
            }
            catch (HttpRequestException e)
            {
                Console.WriteLine(e);
            }
        }
示例#2
0
        public PlantUmlRenderer(MarkdownPipeline pipeline)
        {
            var renderFactory = new PlantUml.Net.RendererFactory();

            _render = renderFactory.CreateRenderer(new PlantUml.Net.PlantUmlSettings
            {
                RemoteUrl     = "https://www.plantuml.com/plantuml/", //TODO: expose these are configurable
                RenderingMode = PlantUml.Net.RenderingMode.Remote,
            });

            this._pipeline = pipeline;
        }