" /> AddIn Tab that embed chrome via CEFSharp instead of Winforms browser - Genesys CTI User Forum

Author Topic: AddIn Tab that embed chrome via CEFSharp instead of Winforms browser  (Read 3062 times)

Offline ahmetsys

  • Newbie
  • *
  • Posts: 9
  • Karma: 0
Advertisement
We recently got a request that a customer is in need to have the chrome browser embedded into Interaction Desktop. We whought, fine, that should not be that hard of an issue to solve since there already is a browser addin that uses the native Windows Winforms webbrowser (IE). And atleast in CIC 2017R2 the CEFSharp libraries are available native for Interaction Desktop. We have look at numerous examples on how to create winforms that use CEFSharp to load the Chromium browser but to no avail. The browser doesnt seem to populate the panel since it is called from a UserControl-class (we guess) Has anyone done something similar? The project compiles properly but when adding the new addin-tab to Interaction Desktop, .NET crashes intermittently. Suggestions? And yes, We are not that used to develop in C#, its more trial and error here =)

Thanks

Offline jamesmurphyau

  • Full Member
  • ***
  • Posts: 123
  • Karma: 2
We have done this.. I will try lookup the code over the next few days (it's the weekend now) and provide some pointers

Offline jamesmurphyau

  • Full Member
  • ***
  • Posts: 123
  • Karma: 2
This is the BrowserView.xaml

[code]<UserControl x:Class="Module.Views.BrowserView"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
            xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
            xmlns:local="clr-namespace:GSNBrowserExtensionModule.Views"
            xmlns:cefSharp="clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf"
            mc:Ignorable="d"
            d:DesignHeight="300"
            d:DesignWidth="300"
            d:DataContext="{d:DesignInstance local:BrowserViewModel}">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <cefSharp:ChromiumWebBrowser x:Name="browser" Grid.Row="0" WebBrowser="{Binding WebBrowser, Mode=OneWayToSource}" Address="{Binding Address}">
            <FrameworkElement.ContextMenu>
                <ContextMenu>
                    <!--
                    <MenuItem Header="Back" Command="{Binding WebBrowser.BackCommand}" />
                    <MenuItem Header="Forward" Command="{Binding WebBrowser.ForwardCommand}" />
                    <Separator />
                    <MenuItem Header="Print ..." Command="{Binding WebBrowser.PrintCommand}" />
                    <Separator />
                    -->
                    <MenuItem Header="Zoom In" Command="{Binding WebBrowser.ZoomInCommand}" />
                    <MenuItem Header="Zoom Out"  Command="{Binding WebBrowser.ZoomOutCommand}" />
                    <MenuItem Header="Zoom Reset"  Command="{Binding WebBrowser.ZoomResetCommand}" />

                    <Separator />
                    <!--
                    <MenuItem Header="Show DevTools" Command="{Binding ShowDevToolsCommand}" />
                    <MenuItem Header="Close DevTools" Command="{Binding CloseDevToolsCommand}" />
                    <Separator />
                    <MenuItem Header="View Source" Command="{Binding WebBrowser.ViewSourceCommand}" />
                    -->
                    <MenuItem Header="Cut" Command="{Binding WebBrowser.CutCommand}"/>
                    <MenuItem Header="Copy" Command="{Binding WebBrowser.CopyCommand}"/>
                    <MenuItem Header="Paste" Command="{Binding WebBrowser.PasteCommand}"/>
                </ContextMenu>
            </FrameworkElement.ContextMenu>
        </cefSharp:ChromiumWebBrowser>
       
        <ProgressBar Grid.Row="1" IsIndeterminate="{Binding WebBrowser.IsLoading}"
                        Minimum="0"
                        Maximum="100"
                        Height="16"
                        HorizontalAlignment="Stretch"
                        HorizontalContentAlignment="Stretch"
                        Margin="3" />
    </Grid>
</UserControl>[/code]

Offline jamesmurphyau

  • Full Member
  • ***
  • Posts: 123
  • Karma: 2
You should use https://github.com/cefsharp/CefSharp/tree/master/CefSharp.Wpf.Example as an example of integrating CefSharp into a WPF application (which is what WDE is)

Offline vmc

  • Full Member
  • ***
  • Posts: 112
  • Karma: 0
Think our developer ran into some issues doing this for a client.  Some problem around being able to clean up the cache, and some javascript code not displaying correctly - think from memory it was some z-layering stuff.

Offline ahmetsys

  • Newbie
  • *
  • Posts: 9
  • Karma: 0
Hi, thanks for the answers,
but I was able to run it properly when I did the wpf test example, but I get this error when I try to integrate it into a workspace in genesys.

what should I do?
Thanks

Offline jamesmurphyau

  • Full Member
  • ***
  • Posts: 123
  • Karma: 2
Which error?