//--------------------------------------------------------------- protected override void MyUpdateValeursCalculees() { C2iWndWebBrowser wndBrowser = WndAssociee as C2iWndWebBrowser; if (wndBrowser == null | m_browser == null) { return; } CContexteEvaluationExpression contexte = CUtilControlesWnd.GetContexteEval(this, EditedElement); try { if (wndBrowser.UrlFormula != null) { CResultAErreur result = wndBrowser.UrlFormula.Eval(contexte); string strUrl = null; if (result) { strUrl = result.Data == null ? null : result.Data.ToString(); } m_browser.Url = new Uri(strUrl); } } catch { } }
//-------------------------------------------- protected override void MyCreateControle( CCreateur2iFormulaireV2 createur, C2iWnd wnd, Control parent, IFournisseurProprietesDynamiques fournisseurProprietes) { C2iWndWebBrowser wndBrowser = wnd as C2iWndWebBrowser; if (wndBrowser == null) { return; } CCreateur2iFormulaireV2.AffecteProprietesCommunes(wndBrowser, m_browser); m_browser.ScriptErrorsSuppressed = wndBrowser.HideErrors; m_browser.IsWebBrowserContextMenuEnabled = wndBrowser.BrowserContextMenu; m_browser.WebBrowserShortcutsEnabled = wndBrowser.EnableShortCuts; m_browser.AllowNavigation = wndBrowser.AllowNavigation; parent.Controls.Add(m_browser); }
//-------------------------------------------- void m_browser_Navigating(object sender, WebBrowserNavigatingEventArgs e) { C2iWndWebBrowser browser = WndAssociee as C2iWndWebBrowser; if (browser != null && browser.PreventDownload) { try { WebRequest req = WebRequest.Create(e.Url); WebResponse res = req.GetResponse(); if (!res.ContentType.ToUpper().Contains("OCTET-STREAM")) { return; } e.Cancel = true; } catch { } } }