public MainWindow() { InitializeComponent(); try { PdfPreview.OpenFile(previewPath); System.Windows.Threading.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer(); dispatcherTimer.Tick += dispatcherTimer_Tick; TextEntry.TextChanged += dispatcherTimer_Tick; dispatcherTimer.Interval = new TimeSpan(0, 0, 120); dispatcherTimer.Start(); } catch { } }
private void dispatcherTimer_Tick(object sender, EventArgs e) { // formatting to PDF and save result to file MarkdownPdf.Transform(TextEntry.Text, previewPath); PdfPreview.OpenFile(previewPath); }