/// <summary> /// Converts onlyconnect.IHTMLDocument2 class to HtmlAgilityPack.HtmlDocument /// </summary> /// <param name="doc">IHTMLDocument2 document</param> /// <returns>Converted HtmlDocument</returns> public static HtmlAgilityPack.HtmlDocument mshtmlDocToAgilityPackDoc(onlyconnect.IHTMLDocument2 doc) { HtmlAgilityPack.HtmlDocument outDoc = new HtmlAgilityPack.HtmlDocument(); string html = doc.GetBody().innerHTML; outDoc.LoadHtml(html); return outDoc; }
private void htmlEditor1_ReadyStateChanged(object sender, onlyconnect.ReadyStateChangedEventArgs e) { if (e.ReadyState == "complete") { SetStyleSheet(); } }
private void htmlEditor1_BeforeNavigate(object s, onlyconnect.BeforeNavigateEventArgs e) { Console.WriteLine(e.NewTarget); string[] splitUrl = e.Target.Split('/'); string fullName = splitUrl[splitUrl.Length-1]; string[] split = fullName.Split('.'); if (split.Length == 2) { AbsoluteTopicName currentTopicName = new AbsoluteTopicName(); currentTopicName.Fullname = fullName; currentTopicName.Namespace = split[0]; currentTopicName.Name = split[1]; if (currentTopicName.Namespace == currentContentBase.Namespace) { foreach (ListViewItem lvi in listViewTopicNames.Items) { AbsoluteTopicName topicName = (AbsoluteTopicName)lvi.Tag; if (currentTopicName.Name == topicName.Name) { lvi.Selected = true; e.Cancel = true; break; } } } else { foreach(ContentBase cb in contentBases) { if (cb.Namespace == currentTopicName.Namespace ) { comboBoxContentBase.SelectedValue = currentTopicName.Namespace; foreach (ListViewItem lvi in listViewTopicNames.Items) { AbsoluteTopicName topicName = (AbsoluteTopicName)lvi.Tag; if (currentTopicName.Name == topicName.Name) { lvi.Selected = true; e.Cancel = true; break; } } } } } } }
/// <summary> /// Fires the BeforeNavigateEvent /// </summary> /// <param name="e">Cancellable event args</param> protected internal virtual void OnBeforeNavigate(onlyconnect.BeforeNavigateEventArgs e) { if (BeforeNavigate != null) BeforeNavigate(this, e); }
/// <summary> /// Fires the BeforeShortcut event. Handle this event to pre-process or cancel the /// HtmlEditor's shortcut events. /// </summary> /// <param name="e">Cancellable event args</param> protected virtual void OnBeforeShortcut(onlyconnect.BeforeShortcutEventArgs e) { if (BeforeShortcut != null) BeforeShortcut(this, e); }