コード例 #1
0
        private void PrepareImportPreview(ImportExportPackage package, List <ActionStep> steps, string title)
        {
            Markdig.MarkdownPipeline _markdownPipeline;
            string _css = "";


            var _markdownPipelineBuilder = new Markdig.MarkdownPipelineBuilder();

            _markdownPipelineBuilder.Extensions.Add(new Markdig.Extensions.Tables.PipeTableExtension());
            _markdownPipeline = _markdownPipelineBuilder.Build();

            try
            {
                var cssPath = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "Assets", "CSS", "markdown.css");
                _css = System.IO.File.ReadAllText(cssPath);

                if (MainViewModel.UISettings?.UITheme?.ToLower() == "dark")
                {
                    cssPath = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "Assets", "CSS", "dark-mode.css");
                    _css   += System.IO.File.ReadAllText(cssPath);
                }
            }
            catch
            {
            }
            var intro    = $"Importing from source: {package.SourceName}, exported {package.ExportDate.ToLongDateString()}, app version {package.SystemVersion?.ToString() ?? "(unknown)"}";
            var markdown = GetStepsAsMarkdown(steps, title, intro);

            var result = Markdig.Markdown.ToHtml(markdown, _markdownPipeline);

            result = "<html><head><meta http-equiv='Content-Type' content='text/html;charset=UTF-8'><meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />" +
                     "<style>" + _css + "</style></head><body>" + result + "</body></html>";


            MarkdownView.NavigateToString(result);
        }
コード例 #2
0
        /// <summary>
        /// Perform import of app configuration
        /// </summary>
        /// <param name="package"></param>
        /// <param name="settings"></param>
        /// <param name="isPreviewMode">If true, import is a preview only</param>
        /// <returns></returns>
        public async Task <List <ActionStep> > PerformSettingsImport(ImportExportPackage package, ImportSettings settings, bool isPreviewMode)
        {
            var results = await _certifyClient.PerformImport(new ImportRequest { Package = package, Settings = settings, IsPreviewMode = isPreviewMode });

            return(results);
        }