public static HelpInfo FromText(string topic, string desc, string id = null) { HelpInfo info = new HelpInfo(); info.id = id; info.topic = topic; info.desc = desc; return info; }
public void UpdateFromProvider(IHelpProvider provider, HelpInfo info) { if (this.ActiveHelpProvider == provider) { if (info != null) { this.Switch(provider, info); } else { this.Pop(provider); } } else if (info != null) { this.Push(provider, info); } }
public void Push(IHelpProvider sender, HelpInfo info) { if (sender == null) { throw new ArgumentNullException("sender"); } if (info == null) { throw new ArgumentNullException("info"); } HelpInfo lastActiveHelp = this.ActiveHelp; stack.Add(new KeyValuePair <IHelpProvider, HelpInfo>(sender, info)); if (lastActiveHelp != this.ActiveHelp) { this.OnActiveHelpChanged(lastActiveHelp, this.ActiveHelp); } }
public static HelpInfo FromMember(MemberInfo member) { if (member == null) return null; XmlCodeDoc.Entry doc = HelpSystem.GetXmlCodeDoc(member); if (doc != null) { HelpInfo info = new HelpInfo(); info.id = member.GetMemberId(); info.topic = member.Name; info.desc = ""; if (doc.Summary != null) info.desc += doc.Summary; if (doc.Remarks != null) info.desc += "\n\n" + doc.Remarks; return info; } return CreateNotAvailable(member.Name); }
public void Pop(IHelpProvider sender) { if (sender == null) { throw new ArgumentNullException("sender"); } HelpInfo lastActiveHelp = this.ActiveHelp; for (int i = stack.Count - 1; i >= 0; i--) { if (stack[i].Key == sender) { stack.RemoveAt(i); break; } } if (lastActiveHelp != this.ActiveHelp) { this.OnActiveHelpChanged(lastActiveHelp, this.ActiveHelp); } }
private void OnActiveHelpChanged(HelpInfo last, HelpInfo current) { if (this.ActiveHelpChanged != null) this.ActiveHelpChanged(this, new HelpStackChangedEventArgs(last, current)); }
public void UpdateFromProvider(IHelpProvider provider, HelpInfo info) { if (this.ActiveHelpProvider == provider) { if (info != null) this.Switch(provider, info); else this.Pop(provider); } else if (info != null) this.Push(provider, info); }
public void UpdateFromProvider(IHelpProvider oldProvider, IHelpProvider newProvider, HelpInfo info) { if (oldProvider != null) this.Pop(oldProvider); if (info != null) this.Push(newProvider, info); }
public void Switch(IHelpProvider sender, HelpInfo newInfo) { if (sender == null) throw new ArgumentNullException("sender"); if (newInfo == null) throw new ArgumentNullException("newInfo"); HelpInfo lastActiveHelp = this.ActiveHelp; for (int i = stack.Count - 1; i >= 0; i--) { if (stack[i].Key == sender) { stack[i] = new KeyValuePair<IHelpProvider,HelpInfo>(sender, newInfo); break; } } if (lastActiveHelp != this.ActiveHelp) this.OnActiveHelpChanged(lastActiveHelp, this.ActiveHelp); }
public void Push(IHelpProvider sender, HelpInfo info) { if (sender == null) throw new ArgumentNullException("sender"); if (info == null) throw new ArgumentNullException("info"); HelpInfo lastActiveHelp = this.ActiveHelp; stack.Add(new KeyValuePair<IHelpProvider,HelpInfo>(sender, info)); if (lastActiveHelp != this.ActiveHelp) this.OnActiveHelpChanged(lastActiveHelp, this.ActiveHelp); }
public static bool DefaultPerformHelpAction(HelpInfo info) { MemberInfo member = !string.IsNullOrEmpty(info.Id) ? ReflectionHelper.ResolveMember(info.Id) : null; if (member != null) { string memberHtmlName; if (member is FieldInfo && member.DeclaringType.IsEnum) memberHtmlName = member.DeclaringType.GetMemberId(); else memberHtmlName = info.Id; memberHtmlName = memberHtmlName.Replace('.', '_').Replace(':', '_').Replace('+', '_'); string ddocPath = Path.GetFullPath("DDoc.chm"); string cmdLine = string.Format("{0}::/html/{1}.htm", ddocPath, memberHtmlName); Process[] proc = Process.GetProcessesByName("hh"); if (proc.Length > 0) proc[0].CloseMainWindow(); Process.Start("HH.exe", cmdLine); return true; } return false; }
public HelpStackChangedEventArgs(HelpInfo last, HelpInfo current) { this.last = last; this.current = current; }
public void UpdateFromProvider(IHelpProvider oldProvider, IHelpProvider newProvider, HelpInfo info) { if (oldProvider != null) { this.Pop(oldProvider); } if (info != null) { this.Push(newProvider, info); } }