Genesys CTI User Forum

Genesys CTI User Forum => Genesys CTI Technical Discussion => Topic started by: ahmetsys on May 17, 2019, 01:41:26 PM

Title: AddIn Tab that embed chrome via CEFSharp instead of Winforms browser
Post by: ahmetsys on May 17, 2019, 01:41:26 PM
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
Title: Re: AddIn Tab that embed chrome via CEFSharp instead of Winforms browser
Post by: jamesmurphyau on May 17, 2019, 09:28:16 PM
We have done this.. I will try lookup the code over the next few days (it's the weekend now) and provide some pointers
Title: Re: AddIn Tab that embed chrome via CEFSharp instead of Winforms browser
Post by: jamesmurphyau on May 20, 2019, 01:27:50 AM
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]
Title: Re: AddIn Tab that embed chrome via CEFSharp instead of Winforms browser
Post by: jamesmurphyau on May 20, 2019, 01:28:59 AM
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)
Title: Re: AddIn Tab that embed chrome via CEFSharp instead of Winforms browser
Post by: vmc on May 20, 2019, 07:09:04 AM
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.
Title: Re: AddIn Tab that embed chrome via CEFSharp instead of Winforms browser
Post by: ahmetsys on May 20, 2019, 08:33:56 AM
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
Title: Re: AddIn Tab that embed chrome via CEFSharp instead of Winforms browser
Post by: jamesmurphyau on May 20, 2019, 10:40:58 AM
Which error?