Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

AwesomiumSharp remodeling, additions and improvements. #1

Merged
merged 3 commits into from Jul 6, 2011

Conversation

Projects
None yet
3 participants
Collaborator

Perikles commented Jul 4, 2011

Major changes in WebView and WebCore. New WPF control (WebControl) introduced that takes advantage of WPF features.

New WPF WebControl Details:

 - Instead of wrapping the wrapper (meaning, wrapping WebView), we
   become the initial wrapper ourselves and directly implement all
   C API just as WebView does. This improves performance, allows more
   control and allows the developer to access the full API directly
   from this control.

 - Just like in the other files edited, here too, many changes
   with respect to standard .NET guidelines and naming convension
   were made.

 - Properties are available as dependency properties. This allows
   the developer to easily bind to properties and monitor their
   status in triggers etc.

 - WebControl is a now a FrameworkElement as it should be. This means
   styling is possible but templating is not. No useless elements in
   the visual tree and no children such as images. We render directly
   on the element's surface and override our own events' triggers.

 - WebControl includes an internal auto updater just as the one added
   in WebCore. It monitors WebCore's auto updater and starts or stops
   as needed.

 - Part of the Find logic is now handled by this class making it
   more straightforward. FindNext is added.

 - Extensive pro-exception verification of validity before every API
   call was added here too.

 - Most of the control's methods can be called using routed commands.
   We bind to many of the already available Application and Navigation
   commands, and we cover more functionality by providing our own
   commands through WebControlCommands. This makes it easy for the UI
   developer to manipulate the control directly from XAML. See
   InitializeCommandBindings() to get an idea of what we support.

WebCore Changes Details:

- Many changes with respect to standard .NET guidelines and naming
  convention were made. These include, among others:
      * Get/Set accessors were turned into Properties wherever
        this was appropriate.
      * The names of many members were changed to follow proper
        naming convention.
      * WebCoreConfig is created, documented and taken out of
        the class.

- Background auto-updating is added and can be configured during
  initialization through WebCoreConfig, or afterwards through
  the AutoUpdate property.

- Extensive pro-exception verification of validity before every API
  call is added.

WebView Changes Details:

- Many changes with respect to standard .NET guidelines and naming
  convention were made. These include, among others:
      * Get/Set accessors were turned into Properties wherever
        this was appropriate.
      * The names of many events were changed to follow proper
        naming convention.
      * Protected event triggers were added.
      * Former inner classes (such as the various EventArgs) are
        taken outside the class and moved to separate files. They
        can be found in the EventArgs project folder. All these
        classes have also been edited following the same guidelines.

- A base modeling class (ViewModel) implementing INotifyPropertyChanged
  is added and subclassed. This makes WebView MVVM friendly.

- Part of the Find logic is now handled by this class making it
  more straightforward. FindNext is added.

- Extensive pro-exception verification of validity before every API
  call is added.

Note to the original authors:

- Please contact me @: perikles@stephanidis.net to let me know
  what you think of my changes.
  If you do not wish to pull them, please let me know. 
  I will publish a separate project here or in CodePlex.
- I would love to contribute to the AwesomiumSharp wrapper
  officially. I'm an experienced .NET and WPF developer and teacher.

Thank You!
Perikles C. Stephanidis

Major changes in WebView and WebCore. New WPF control (WebControl) in…
…troduced that takes advantage of WPF features.

WPF WebControl Details:

     - Instead of wrapping the wrapper (meaning, wrapping WebView), we
       become the initial wrapper ourselves and directly implement all
       C API just as WebView does. This improves performance, allows more
       control and allows the developer to access the full API directly
       from this control.

     - Just like in the other files edited, here too, many changes
       with respect to standard .NET guidelines and naming convension
       were made.

     - Properties are available as dependency properties. This allows
       the developer to easily bind to properties and monitor their
       status in triggers etc.

     - WebControl is a now a FrameworkElement as it should be. This means
       styling is possible but templating is not. No useless elements in
       the visual tree and no children such as images. We render directly
       on the element's surface and override our own events' triggers.

     - WebControl includes an internal auto updater just as the one added
       in WebCore. It monitors WebCore's auto updater and starts or stops
       as needed.

     - Part of the Find logic is now handled by this class making it
       more straightforward. FindNext is added.

     - Extensive pro-exception verification of validity before every API
       call was added here too.

     - Most of the control's methods can be called using routed commands.
       We bind to many of the already available Application and Navigation
       commands, and we cover more functionality by providing our own
       commands through WebControlCommands. This makes it easy for the UI
       developer to manipulate the control directly from XAML. See
       InitializeCommandBindings() to get an idea of what we support.

WebCore Changes Details:

    - Many changes with respect to standard .NET guidelines and naming
      convention were made. These include, among others:
          * Get/Set accessors were turned into Properties wherever
            this was appropriate.
          * The names of many members were changed to follow proper
            naming convention.
          * WebCoreConfig is created, documented and taken out of
            the class.

    - Background auto-updating is added and can be configured during
      initialization through WebCoreConfig, or afterwards through
      the AutoUpdate property.

    - Extensive pro-exception verification of validity before every API
      call is added.

WebView Changes Details:

    - Many changes with respect to standard .NET guidelines and naming
      convention were made. These include, among others:
          * Get/Set accessors were turned into Properties wherever
            this was appropriate.
          * The names of many events were changed to follow proper
            naming convention.
          * Protected event triggers were added.
          * Former inner classes (such as the various EventArgs) are
            taken outside the class and moved to separate files. They
            can be found in the EventArgs project folder. All these
            classes have also been edited following the same guidelines.

    - A base modeling class (ViewModel) implementing INotifyPropertyChanged
      is added and subclassed. This makes WebView MVVM friendly.

    - Part of the Find logic is now handled by this class making it
      more straightforward. FindNext is added.

    - Extensive pro-exception verification of validity before every API
      call is added.

@Perikles Perikles commented on the diff Jul 4, 2011

VBWPFSample/MainWindow.xaml
@@ -0,0 +1,171 @@
@Perikles

Perikles Jul 4, 2011

Collaborator

This file (and the whole VBWPFSample), demonstrate the use of the new WPF WebControl.
Please read the README file included in this sample's folder.

lanwin commented Jul 5, 2011

+1

Perikles added some commits Jul 5, 2011

Major changes concerning auto-update, improvements and minor bug fixes.
WebCore Changes Details:

    - I have decided to completely isolate auto-update to the WebCore
      itself, and disallow access to to the auto-Update logic from outside
      the assembly. The scenario and analysis is:
          * If a developer creates many WebView instances and provides for
             them his/her own update logic, or if he/she uses many WebControls
             (that include their own auto-update) we may end up with
             awe_webcore_update being called tens of times almost
             simultaneously, for no reason. Documentation for awe_webcore_update
             says that this method is "...updating the RenderBuffer of each
             WebView, destroying any WebViews that are queued for destruction,
             and invoking any queued WebView events. You should call this
             as part of your application's update loop.". This means that one
             call is enough to cover all created views.
          * We could demand for a hwnd and hook into the host application's
             message loop, but the idea of calling awe_webcore_update
             from inside our application's message loop is actually not
             appropriate. Awesomium runs as a separate process and has its
             own message loop. Our application may be idle while Awesomium
             is not. So we will keep relying on a timer.

    - WebCoreConfig is moved to a separate file.

    - Changes in initialization logic and minor bug fixes.

    - Added and improved existing documentation to reflect changes and
      help with the understanding of the new logic.

WPF WebControl Details:

    - Changes in respect to the changes of the WebCore's auto-update
      logic.

    - Minor fixes and improvements.

WebView Changes Details:

    - Changes in respect to the changes of the WebCore's auto-update
      logic.

    - Minor fixes and improvements.
Collaborator

adamkhrona commented Jul 6, 2011

Wow, there are some really awesome contributions! Great work, reviewing this now.

adamkhrona added a commit that referenced this pull request Jul 6, 2011

Merge pull request #1 from Perikles/master
AwesomiumSharp remodeling, additions and improvements. Absolutely stellar modifications courtesy of Perikles Stephanidis. Thanks!

@adamkhrona adamkhrona merged commit 712f6a3 into khrona:master Jul 6, 2011

Collaborator

Perikles commented Jul 6, 2011

Thank you for accepting the Pull Request and for your comments. I will keep working on this and committing changes. I have sent you a message asking for some info regarding future commits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment