c# - Formatting a popup in CefSharp only when requested by download -


i want create specific popup when user downloads file in cefsharp, using onbeforepopup in ilifespanhandler cannot detect how popup called e.g. link or file download.

it there way of customising popups different types of calls?

this code using.

bool ilifespanhandler.onbeforepopup(iwebbrowser browsercontrol, ibrowser browser, iframe frame, string targeturl, string targetframename, windowopendisposition targetdisposition, bool usergesture, ipopupfeatures popupfeatures, iwindowinfo windowinfo, ibrowsersettings browsersettings, ref bool nojavascriptaccess, out iwebbrowser newbrowser) {     // set newbrowser null unless attempting host popup in new instance of chromiumwebbrowser     // should used in wpf/offscreen      newbrowser = null;      // hosting popup in own control/window     // use iwindowinfo.setaschild specify parent handle     // note: window resize not yet handled - need     // ibrowserhost newly created ibrowser instance represents popup     // subscribe window resize notifications , call notifymoveorresizestarted().     // chances in width/height need call setwindowpos on browsers hwnd     // use nativemethodwrapper.setwindowposition achieve - can hwnd using     // ibrowserhost method      var chromiumwebbrowser = (chromiumwebbrowser)browsercontrol;     chromiumwebbrowser.invoke(new action(() =>     {         var owner = chromiumwebbrowser.findform();         var popup = new downloadingpopup();         popup.createcontrol();         owner.addownedform(popup);         control[] lbfilename = popup.controls.find("lbfilename", true);         label lbfilename = (label)lbfilename[0];         lbfilename.text = "downloading";         lbfilename.font = new system.drawing.font("oswald", 14);         var control = new control();         control.dock = dockstyle.fill;         control.createcontrol();         popup.controls.add(control);         popup.show();         var rect = control.clientrectangle;         windowinfo.setaschild(control.handle, rect.left, rect.top, rect.right, rect.bottom);     }));      return false; //return true cancel popup creation } 


Comments

Popular posts from this blog

python - Selenium remoteWebDriver (& SauceLabs) Firefox moseMoveTo action exception -

html - How to custom Bootstrap grid height? -

transpose - Maple isnt executing function but prints function term -