Σάββατο 26 Νοεμβρίου 2011

Tutorial #2 - OpenWebKitSharp's Development System (Updating, Commiting, Patches, Issues)

In this tutorial I am going to show you how to take the most out of the new development system of OpenWebKitSharp. The new system aims to make everybody able to help the development of OpenWebKitSharp either by source or by reporting bugs/issues.

Requirements:

TortoiseSVN: http://tortoisesvn.net/downloads.html - Used for downloading Source and updating it and for Commiting

If you don't want to download external software you can download the whole packs whenever a new build is available: http://code.google.com/p/open-webkit-sharp/downloads/list

Getting the source

If you have TortoiseSVN installed then it is very easy to get the source. Follow these steps:

  1. Create a folder where you want to store OpenWebKitSharp's files
  2. Right-Click on that folder and select SVN Update.
  3. When prompted, enter the following URL: http://open-webkit-sharp.googlecode.com/svn/
  4. OpenWebKitSharp requires Visual Studio 2008/2010/2011 to be built (support for earlier versions is uknown)
Being up-to-date

Whenever you want you can run the SVN Update command to download the latest OpenWebKitSharp files. When a newer version is available the folder where your OpenWebKitSharp files are stored will have an exclamation mark (this will also happen when you make changes to the files inside). If you see this icon then you can right-click on that folder and select SVN Update and enter this url: http://open-webkit-sharp.googlecode.com/svn/

When the files are downloaded you will see the correct icon to the folder.

Posting Patches and Commiting

If you think that OpenWebKitSharp needs some changes and you know how to make them then you can do so either by posting a patch or by using the SVN Commit method. To use the SVN Commit method you must firstly qualify as an OpenWebKitSharp Developer and then you will receive information on how to commit.

As for patches, adding a patch can be done in 2 ways:


  1. (Recommended) Make the changes you want and then go to the folder where your OpenWebKitSharp files are stored and then right-click->TortoiseSVN->Create Patches. Then select the files that you want to update and save it to a local directory. Then, go again to the right-click menu of the OpenWebKitSharp directory, select TortoiseSVN->Apply Patch and select the file you previously saved. When TortoiseMerge pops up go to the window to the left and select Patch All to patch all the files or Patch Selected to patch the selected files.
  2. If you don't want to use TortoiseSVN then you simply have to navigate here: http://code.google.com/p/open-webkit-sharp/source/browse/ and select the file that you want to edit. When you find the file you want click Edit File and make the changes you want.


Issues

By posting issues you can help the developer team to solve present bugs or add new features! Go to: http://code.google.com/p/open-webkit-sharp/issues/entry and fill in the form. Then click submit and you have completed the whole process!

Δευτέρα 14 Νοεμβρίου 2011

Tutorial #1 - WebKit Initialization and Page Rendering (Applies to all OpenWebKitSharp Versions)

Welcome to the OpenWebKitSharp tutorials. This is the first tutorial and the most important one for beginners.

To start with, you must firstly understand how OpenWebKitSharp works. OpenWebKitSharp is a library developed by GT Web Software which uses a manifest file in order to access the WebKit COM Objects that are included in the webkit engine and create a .NET bridge that will help you embed the engine in your .NET application.

Before you begin make sure that you have obtained the latest copy of OpenWebKitSharp archive. After that, if you are using the latest version of it please go to the folder where you have extracted the files. You should see the folder called "Core". Inside that folder you will find all the needed WebKit files by your application. You must copy them to the same folder as your executable of your project.








In order to use OpenWebKitSharp correctly you must add some references to your project. These include the following files (only DLL files), which can be found inside the "WebKit" folder:




















If you have already referenced OpenWebKitSharp.dll then you are ready to start using it inside your project! If you want to use the designer to draw a WebKitBrowser object and render pages to it then you have to add OpenWebKitSharp.dll to your Toolbox. This can be done by selecting Choose items in the right-click menu of the Visual Studio's toolbox.

From that point, rendering HTML to the WebView of the WebKitBrowser object is easier than you can imagine. If you are trying to render a page from the internet then you need to use the Navigate() method. [e.g. <WebKitBrowser>.Navigate(http://www.google.com/)]

OpenWebKitSharp also provides the ability to load content from a local file. For this reason the WebKitBroser.OpenDocument has been implemented. You can use it according to this example:
<WebKitBrowser>.OpenDocument(@"C:\test.html")

Last but not least, you can use the property <WebKitBrowser>.DocumentText in order to set the document by its source. This way the WebKitBrowser can also be used in an offline mode.

The next tutorial is going to provide you information on how to handle events related to the loading of a wepage.