Skip to content
This repository has been archived by the owner on Nov 15, 2021. It is now read-only.

Commit

Permalink
Replaced WebBrowser with HtmlRenderer
Browse files Browse the repository at this point in the history
  • Loading branch information
Aragas committed Dec 18, 2016
1 parent 7f013b5 commit 5eed704
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 44 deletions.
14 changes: 2 additions & 12 deletions P3D-Legacy Launcher/Forms/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 19 additions & 3 deletions P3D-Legacy Launcher/Forms/MainForm.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Text;
using System.Threading;
Expand All @@ -16,13 +18,17 @@
using P3D.Legacy.Launcher.Data;
using P3D.Legacy.Launcher.Extensions;

using TheArtOfDev.HtmlRenderer.WinForms;

using YamlDotNet.Core;

namespace P3D.Legacy.Launcher.Forms
{
public partial class MainForm : Form
{
public static StringBuilder Logger { get; } = new StringBuilder();
private static StringBuilder Logger { get; } = new StringBuilder();

private const string NewsUri = "https://p3d-legacy.github.io/launcher/";

#region GitHub

Expand Down Expand Up @@ -52,6 +58,7 @@ public MainForm()
}
private void FormPreInitialize()
{
Logger?.Clear();
foreach (Control control in Controls)
control.Dispose();
Controls.Clear();
Expand All @@ -62,9 +69,17 @@ private void FormPreInitialize()
}
private void FormInitialize()
{
Logger.Clear();
Log($"System Language: {CultureInfo.InstalledUICulture.EnglishName}");

var htmlPanel = new HtmlPanel
{
Text = new WebClient { Encoding = Encoding.UTF8 }.DownloadString(NewsUri),
Dock = DockStyle.Fill,
//BackColor = Color.FromArgb(255, 231, 231, 231),
//BackgroundImage = GetImage("https://github.com/P3D-Legacy/p3d-legacy.github.io/raw/master/images/body-bg.png")
};
TabPage_News.Controls.Add(htmlPanel);

Label_Version.Text = Assembly.GetExecutingAssembly().GetName().Version.ToString();
TabPage_Settings.VisibleChanged += TabPage_Settings_VisibleChanged;

Expand Down Expand Up @@ -214,7 +229,8 @@ private void LinkLabel_Pokemon3D_LinkClicked(object sender, LinkLabelLinkClicked
private void Log(string message)
{
Logger.AppendLine(message);
TextBox_Logger.Text = Logger.ToString();
if(TextBox_Logger != null)
TextBox_Logger.Text = Logger.ToString();
}

private void CheckLauncherForUpdate()
Expand Down
27 changes: 0 additions & 27 deletions P3D-Legacy Launcher/Forms/MainForm.resx
Original file line number Diff line number Diff line change
Expand Up @@ -276,33 +276,6 @@
<data name="TabControl.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
<value>Top, Left, Right</value>
</data>
<data name="WebBrowser_News.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
<data name="WebBrowser_News.Location" type="System.Drawing.Point, System.Drawing">
<value>3, 3</value>
</data>
<data name="WebBrowser_News.MinimumSize" type="System.Drawing.Size, System.Drawing">
<value>20, 20</value>
</data>
<data name="WebBrowser_News.Size" type="System.Drawing.Size, System.Drawing">
<value>830, 376</value>
</data>
<data name="WebBrowser_News.TabIndex" type="System.Int32, mscorlib">
<value>0</value>
</data>
<data name="&gt;&gt;WebBrowser_News.Name" xml:space="preserve">
<value>WebBrowser_News</value>
</data>
<data name="&gt;&gt;WebBrowser_News.Type" xml:space="preserve">
<value>System.Windows.Forms.WebBrowser, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;WebBrowser_News.Parent" xml:space="preserve">
<value>TabPage_News</value>
</data>
<data name="&gt;&gt;WebBrowser_News.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="TabPage_News.Location" type="System.Drawing.Point, System.Drawing">
<value>4, 22</value>
</data>
Expand Down
8 changes: 8 additions & 0 deletions P3D-Legacy Launcher/P3D-Legacy Launcher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@
<HintPath>..\packages\DotNetZip.1.10.1\lib\net20\DotNetZip.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="HtmlRenderer, Version=1.5.0.5, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\HtmlRenderer.Core.1.5.0.5\lib\net45\HtmlRenderer.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="HtmlRenderer.WinForms, Version=1.5.0.6, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\HtmlRenderer.Mono.1.5.0.6\lib\net45\HtmlRenderer.WinForms.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Octokit, Version=0.23.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Octokit.0.23.0\lib\net45\Octokit.dll</HintPath>
<Private>True</Private>
Expand Down
4 changes: 2 additions & 2 deletions P3D-Legacy Launcher/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@

[assembly: Guid("d2a9c01e-686f-4aea-8b8c-5ae04387f0e0")]

[assembly: AssemblyVersion("1.2.5.0")]
[assembly: AssemblyFileVersion("1.2.5.0")]
[assembly: AssemblyVersion("1.2.6.0")]
[assembly: AssemblyFileVersion("1.2.6.0")]
3 changes: 3 additions & 0 deletions P3D-Legacy Launcher/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="DotNetZip" version="1.10.1" targetFramework="net452" />
<package id="HtmlRenderer.Core" version="1.5.0.5" targetFramework="net452" />
<package id="HtmlRenderer.Mono" version="1.5.0.6" targetFramework="net452" />
<package id="HtmlRenderer.WinForms" version="1.5.0.6" targetFramework="net452" />
<package id="Octokit" version="0.23.0" targetFramework="net452" />
<package id="SystemInfoLibrary" version="1.4.0" targetFramework="net452" />
<package id="YamlDotNet" version="4.0.0" targetFramework="net452" />
Expand Down

0 comments on commit 5eed704

Please sign in to comment.