0

I'm having issues embedding CefSharp (WPF) in a addin for Revit:

  1. My addin cannot be loaded by Revit unless all files are in the Revit folder alongside with the main exe. This is not good because it messes with all Revit files. I've tried to set the PATH env variable to my private folder but it does not work. Any ideas how to make my libraries loadable? I'm not an expert of .NET assemblies etc...
  2. CEFSharp in the addin renders webpages but they occassionally flicker. Is there any flag to set?
  3. CEFSharp in the addin refuses to render WebGL. Any flag to set?

Note: outside of Revit, CEFSharp works fine (tried MinimalExample.WPF)

Marco Fiocco
  • 352
  • 2
  • 15

2 Answers2

1

For the first part of your question, you'll need to subscribe to the AppDomain.AssemblyResolve event and point the program towards the location of your DLL files. The alternative is to manually load the DLLs in the IExternalApplication.OnStartup method using the Assembly.Load command.

For more info on the AssemblyResolve event, see here: https://msdn.microsoft.com/en-us/library/system.appdomain.assemblyresolve(v=vs.110).aspx

Colin Stark
  • 591
  • 3
  • 15
0

I just done exactly the same thing and it works pretty well

I've a dockable CEF windows (WPF) in Revit2018 by following DockableDialogs sample in Revit 2018.2

SDK found here: http://usa.autodesk.com/adsk/servlet/index?siteID=123112&id=2484975)

I'm currently using CEFSharp.Wpf version 57.0.0.0

And yes you should remap Cef third parties like this:

CefSettings settings = new CefSettings(); settings.CachePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "CefSharp\\Cache"); string rootPath = FileUtility.GetAssemblyPath(); settings.BrowserSubprocessPath = Path.Combine(rootPath, "CefSharp.BrowserSubprocess.exe"); settings.LocalesDirPath = Path.Combine(rootPath, "locales"); settings.ResourcesDirPath = Path.Combine(rootPath); Cef.EnableHighDPISupport(); //settings.CefCommandLineArgs.Add("disable-gpu", "1"); Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null);

Don't forget to call Cef.Shutdown(); at the end also

chtimi59
  • 469
  • 6
  • 9