Skip to content

Commit 786c167

Browse files
author
Rob Wilmshurst
committed
Mono support: no webbrowser under mono so write diff to diff.html local text file instead (better than nothing)
git-svn-id: https://svn.code.sf.net/p/autowikibrowser/code/AWB@12781 5227b50d-9349-4574-b055-4b0a7525e11c
1 parent e07b76a commit 786c167

1 file changed

Lines changed: 29 additions & 19 deletions

File tree

AWB/Main.cs

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1860,33 +1860,43 @@ private void GetDiff()
18601860

18611861
try
18621862
{
1863-
if (webBrowser.Document == null)
1864-
{
1865-
Tools.WriteDebug("GetDiff", "GetDiff called but webBrowser.Document null");
1866-
return;
1867-
}
1868-
1869-
webBrowser.Document.OpenNew(false);
1870-
webBrowser.Document.MouseMove -= Document_MouseMove;
1863+
string diffHtml = "";
18711864
if (TheArticle.OriginalArticleText.Equals(txtEdit.Text))
18721865
{
1873-
webBrowser.Document.Write(
1874-
@"<h2 style='padding-top: .5em;
1866+
diffHtml = @"<h2 style='padding-top: .5em;
18751867
padding-bottom: .17em;
18761868
border-bottom: 1px solid #aaa;
1877-
font-size: 150%;'>No changes</h2><p>Press the ""Skip"" button below to skip to the next page.</p>");
1869+
font-size: 150%;'>No changes</h2><p>Press the ""Skip"" button below to skip to the next page.</p>";
1870+
18781871
}
18791872
else
18801873
{
18811874
// when less than 10 edits show user help info on double click to undo etc.
1882-
webBrowser.Document.Write("<!DOCTYPE HTML PUBLIC \" -//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">"
1883-
+ "<html><head>" +
1884-
WikiDiff.DiffHead() + @"</head><body>" +
1885-
((NumberOfEdits < 10)
1886-
? WikiDiff.TableHeader
1887-
: WikiDiff.TableHeaderNoMessages) +
1888-
Diff.GetDiff(TheArticle.OriginalArticleText, txtEdit.Text, 2) +
1889-
"</table></body></html>");
1875+
diffHtml = "<!DOCTYPE HTML PUBLIC \" -//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">"
1876+
+ "<html><head>" +
1877+
WikiDiff.DiffHead() + @"</head><body>" +
1878+
((NumberOfEdits < 10)
1879+
? WikiDiff.TableHeader
1880+
: WikiDiff.TableHeaderNoMessages) +
1881+
Diff.GetDiff(TheArticle.OriginalArticleText, txtEdit.Text, 2) +
1882+
"</table></body></html>";
1883+
}
1884+
1885+
// no webbrowser available under Mono so write diff to file instead
1886+
if (Globals.UsingMono)
1887+
{
1888+
Tools.WriteTextFile(diffHtml, "Diff.html", false);
1889+
}
1890+
else if (webBrowser.Document == null)
1891+
{
1892+
Tools.WriteDebug("GetDiff", "GetDiff called but webBrowser.Document null");
1893+
return;
1894+
}
1895+
else
1896+
{
1897+
webBrowser.Document.OpenNew(false);
1898+
webBrowser.Document.MouseMove -= Document_MouseMove;
1899+
webBrowser.Document.Write(diffHtml);
18901900
}
18911901

18921902
txtEdit.Focus();

0 commit comments

Comments
 (0)