Beispiel #1
0
        private void OnRenderTimerElapsed(object source, EventArgs e)
        {
            renderTimer.Stop();
            try
            {
                if (ValidateMkdnExtension())
                {
                    markdownPreviewForm.RenderMarkdown(GetCurrentEditorText(), notepadPPGateway.GetCurrentFilePath());
                }
                else if (ValidateHtmlExtension())
                {
                    markdownPreviewForm.RenderHtml(GetCurrentEditorText(), notepadPPGateway.GetCurrentFilePath());
                }
                else
                {
                    int filter = ValidateFilterExtension();
                    if (filter >= 0)
                    {
                        var filterProgram   = filterProgs[filter];
                        var filterArguments = filterArgs[filter];
                        var process         = new Process
                        {
                            StartInfo = new ProcessStartInfo
                            {
                                FileName               = filterProgram,
                                Arguments              = $"{filterArguments} \"{notepadPPGateway.GetCurrentFilePath()}\"",
                                UseShellExecute        = false,
                                RedirectStandardOutput = true,
                                CreateNoWindow         = true
                            }
                        };

                        process.Start();
                        string data = process.StandardOutput.ReadToEnd();
                        process.WaitForExit();
                        markdownPreviewForm.RenderHtml(data, notepadPPGateway.GetCurrentFilePath());
                    }
                    else
                    {
                        markdownPreviewForm.RenderMarkdown($"Not a valid Markdown file extension: {MkdnExtensions}\n\nNot a valid HTML file extension: {HtmlExtensions}", notepadPPGateway.GetCurrentFilePath());
                    }
                }
            }
            catch
            {
            }
        }
 private void OnRenderTimerElapsed(object source, EventArgs e)
 {
     renderTimer.Stop();
     try
     {
         markdownPreviewForm.RenderMarkdown(GetCurrentEditorText(), notepadPPGateway.GetCurrentFilePath());
     }
     catch
     {
     }
 }
 private void OnRenderTimerElapsed(object source, EventArgs e)
 {
     renderTimer.Stop();
     try
     {
         markdownPreviewForm.RenderMarkdown(scintillaGateway.GetText(scintillaGateway.GetLength()), notepadPPGateway.GetCurrentFilePath());
     }
     catch (Exception ex)
     {
     }
 }