Archive

Archive for the ‘WPF’ Category

CefSharp Example WPF Getting Started

08/11/2014 1 comment

Q1. What is CefSharp?

Ans: .NET (WPF and Windows Forms) bindings for the Chromium Embedded Framework

CefSharp would be preferable over Awesomium considering the implications of getting the
wrapper to work with x64 which would definitely be a challenge (You may have code it all
in your home time since you may not be able to at work,so consider how you are going
to balance home and work,yes sarcasm)

Q2. Where are the CefSharp binaries  for Microsoft dot net(.NET) ?

Ans: Currently at https://github.com/cefsharp/CefSharp/releases and going strong until thedevelopers abandon ship.But where are the binaries? I do’nt see them all I see are source
codes zip and tars (for windows seesh overkill). You can scroll down the page and you’ll
see ‘older’ binaries…who needs them.WELL I THINK YOU HAVE TO DOWNLOAD THE
BUILD IT YOURSELF.(This is good in away,so get VS2013 and build it)

Q3. Is there an example of how to embed and use CefSharp with WPF? (Thats what you want it for right?)

Ans: https://codeload.github.com/cefsharp/CefSharp.MinimalExample/zip/master (until this link lasts) has a ‘minimal example’

Q4. But that looks like an overkill minimal example and it won’t build ?

Ans: You have to get the release from the link in Answer 2 and build the dll (say for x64) and
add reference to the files , plus all the other c++ dll should be in the bin or so.

DOESN’T WORK ?

1. YOU NEED TO BUILD FOR X64 OR X86 YOU CAN NOT SIMPLY BUILD FOR ANY.

one-does-not-8oq0q4
2. SO YOU NEED TO HAVE TO BUILDS FOR YOUR WPF APPLICATION (CORRECT ME IF I’M WRONG IN THE COMMENTS)3. SO CHANGE YOU BUILD CONFIGURATION TO X64 FROM BUILD MENU – CONFIGURATION MANAGER (OR X86 PROVIDED YOU HAVE THE CEFSHARP BUILD FOR 32BIT (COMPLICATED EMBEDDED FRAMEWORK INDEED) (Blame it on Chromium for waiting till 2014 for a x64 build) (Well don’t blame anyone since things are really made easy for you or so to get started,yes this is just the painful beginning depending on how you plan to use its powers sigh!)

Below is the dll ref to a sample WPF app I created in the same example I downloaded

D:\CEF\CefSharp.MinimalExample-master\packages\CefSharp.Wpf.33.0.2\CefSharp\x64\CefSharp.Wpf.dll
D:\CEF\CefSharp.MinimalExample-master\packages\CefSharp.Common.33.0.2\CefSharp\x64\CefSharp.Core.dll
D:\CEF\CefSharp.MinimalExample-master\packages\CefSharp.Common.33.0.2\CefSharp\x64\CefSharp.dll

Code is as below:

YOU NEED TO INIT AS BELOW OR FAIL !!!!

public partial class App : Application
   {
       public App()
       {
           Cef.Initialize(new CefSettings());
       }
   }

XAML WINDOW

<Window x:Class="WpfApplication2.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:wpf="clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf"
        Title="MainWindow" Height="350" Width="525">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <wpf:ChromiumWebBrowser Grid.Row="0"
                          Address="http://google.com/"
                          WebBrowser="{Binding WebBrowser, Mode=OneWayToSource}"
                          Title="{Binding Title, Mode=TwoWay}" />
        <StatusBar Grid.Row="1">
            <ProgressBar HorizontalAlignment="Right"
                         IsIndeterminate="{Binding WebBrowser.IsLoading}"
                         Width="100"
                         Height="16"
                         Margin="3" />
            <Separator />
            <!-- TODO: Could show hover link URL here -->
            <TextBlock />
        </StatusBar>
    </Grid>
</Window>
Advertisements
Categories: C#, MSBuild, WPF Tags:

WPF & the Yahoo Messenger!

Some time back when Windows Presentation Foundation was release along with the now infamous Windows Vista Yahoo messenger team had started a version of Yahoo Messenger written in WPF messenger.But it was shot lived for some reason

The WPF Yahoo Messenger

Yahoo! Messenger for Vista version is no longer available

As of today, Yahoo! Messenger for Vista will no longer be available for download from the Yahoo! Messenger website. We have discontinued stand-alone releases of the Yahoo! Messenger for Vista application in order to focus on delivering one Windows experience that is optimized for all Windows users.

Sarah Bacon
Product Manager

The comment on the blog post are hilarious if you read it now especially with the launch of Windows 7 and the problems at Yahoo!.Well at least the decision looking back seems to have been good though.Well it was a small failure for Microsoft since WPF was no adopted here.Well what can you expect it the OS never took off ? Don’t blame

Categories: WPF

How to properly handle exceptions in WinForms and WPF

Also have a look at Exception Reporter

ExceptionReporter is a .NET component that shows a dialog with detailed information on an Exception and the application/system running it. It allows the application user to copy, save and/or email a textual report of the incident.

Categories: WPF