ilk Versiyon
This commit is contained in:
70
hMarkdown/Form1.cs
Normal file
70
hMarkdown/Form1.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
using Markdig;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
||||
namespace hMarkdown
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
this.AllowDrop = true;
|
||||
}
|
||||
|
||||
private void tbGozat_Click(object sender, EventArgs e)
|
||||
{
|
||||
openFileDialog.Filter = "(*.md)|*.md|Tüm Dosyalar (*.*)|*.*";
|
||||
openFileDialog.FilterIndex = 2;
|
||||
openFileDialog.RestoreDirectory = true;
|
||||
|
||||
if (openFileDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
tbDosya.Text = openFileDialog.FileName;
|
||||
string contents = File.ReadAllText(@tbDosya.Text);
|
||||
|
||||
var result = Markdown.ToHtml(contents);
|
||||
|
||||
webBrowser.DocumentText = result;
|
||||
webBrowser.Document.Body.Style = "font-family: Tahoma, Threbucet, Verdana; font-size: large;";
|
||||
webBrowser.Document.ExecCommand("SelectAll", false, "null");
|
||||
webBrowser.Document.ExecCommand("font-family", false, "Tahoma");
|
||||
webBrowser.Document.ExecCommand("Unselect", false, "null");
|
||||
}
|
||||
}
|
||||
|
||||
private void Form1_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||
foreach (string file in files) Console.WriteLine(file);
|
||||
}
|
||||
|
||||
private void webBrowser_Navigated(object sender, WebBrowserNavigatedEventArgs e)
|
||||
{
|
||||
string file = e.Url.LocalPath.ToString();
|
||||
|
||||
if (file!="blank")
|
||||
{
|
||||
|
||||
tbDosya.Text = file.Replace("file:///", ""); ;
|
||||
string contents = File.ReadAllText(@tbDosya.Text);
|
||||
|
||||
var result = Markdown.ToHtml(contents);
|
||||
|
||||
webBrowser.DocumentText = result;
|
||||
webBrowser.Document.ExecCommand("SelectAll", false, "null");
|
||||
webBrowser.Document.ExecCommand("FontName", false, "Tahoma");
|
||||
webBrowser.Document.ExecCommand("Unselect", false, "null");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user