/// <summary> /// Respond to user clicks in references display. /// </summary> private void webBrowser_BeforeNavigate(object s, onlyconnect.BeforeNavigateEventArgs e) { string link = e.Target; // Deny that missing reference rendering is a problem if (link.StartsWith("userclick:deny")) { DenyReference(link.Substring(15), true); e.Cancel = true; } // Remove denial that missing reference is a problem else if (link.StartsWith("userclick:undeny")) { DenyReference(link.Substring(17), false); e.Cancel = true; } // Scroll the editor to this reference. else if (link.StartsWith("userclick:scripref")) { string thisRef = link.Substring(19).Replace('_', ' '); string strStoryName, strAnchor; int nLineNumber; BiblicalTermsHTMLBuilder.ParseReference(thisRef, out strStoryName, out nLineNumber, out strAnchor); _theSE.NavigateTo(strStoryName, nLineNumber, strAnchor); e.Cancel = true; } }
public int TranslateUrl(int dwTranslate, String strURLIn, out String pstrURLOut) { pstrURLOut = null; BeforeNavigateEventArgs e = new BeforeNavigateEventArgs(strURLIn); container.OnBeforeNavigate(e); bool translated = false; if (e.Cancel) { if (e.Target.StartsWith("javascript")) { pstrURLOut = null; } else { pstrURLOut = " "; } translated = true; } else if (e.NewTarget != e.Target) { pstrURLOut = e.NewTarget; translated = true; } //if scripts are disabled we can't navigate to javascript links else if ((e.Target.StartsWith("javascript")) & (!container.mEnableActiveContent)) { pstrURLOut = null; translated = true; } else if ((container.mLinksNewWindow)) { pstrURLOut = " "; // Ashish Datta - THIS IS A HACK! //MainApplication nt = (MainApplication) container.FindForm().Owner; //nt.BrowseTo(e.NewTarget); //Load the link in an external window. System.Diagnostics.Process p = new System.Diagnostics.Process(); p.StartInfo.FileName = e.NewTarget; p.Start(); translated = true; } if (e.Target.StartsWith("res://shdoclc")) { //error condition - redirect to about blank pstrURLOut = "about:blank"; translated = true; } if (translated) { return(HRESULT.S_OK); } else { return(HRESULT.S_FALSE); //False = not translated. } }
public int TranslateUrl(int dwTranslate, String strURLIn, out String pstrURLOut) { pstrURLOut = null; BeforeNavigateEventArgs e = new BeforeNavigateEventArgs(strURLIn); container.OnBeforeNavigate(e); bool translated = false; if (e.Cancel) { if (e.Target.StartsWith("javascript")) { pstrURLOut = null; } else { pstrURLOut = " "; } translated = true; } else if (e.NewTarget != e.Target) { pstrURLOut = e.NewTarget; translated = true; } //if scripts are disabled we can't navigate to javascript links else if ((e.Target.StartsWith("javascript")) & (!container.mEnableActiveContent)) { pstrURLOut = null; translated = true; } else if ((container.mLinksNewWindow)) { pstrURLOut = " "; //Load the link in an external window. System.Diagnostics.Process p = new System.Diagnostics.Process(); p.StartInfo.FileName = e.NewTarget; p.Start(); translated = true; } if (e.Target.StartsWith("res://shdoclc")) { //error condition - redirect to about blank pstrURLOut = "about:blank"; translated = true; } if (translated) { return HRESULT.S_OK; } else { return HRESULT.S_FALSE; //False = not translated. } }