Esempio n. 1
0
		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;
		}
Esempio n. 2
0
 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);
     }
 }
Esempio n. 3
0
        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);
            }
        }
Esempio n. 4
0
		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);
		}
Esempio n. 5
0
        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);
            }
        }
Esempio n. 6
0
		private void OnActiveHelpChanged(HelpInfo last, HelpInfo current)
		{
			if (this.ActiveHelpChanged != null)
				this.ActiveHelpChanged(this, new HelpStackChangedEventArgs(last, current));
		}
Esempio n. 7
0
		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);
		}
Esempio n. 8
0
		public void UpdateFromProvider(IHelpProvider oldProvider, IHelpProvider newProvider, HelpInfo info)
		{
			if (oldProvider != null) this.Pop(oldProvider);
			if (info != null) this.Push(newProvider, info);
		}
Esempio n. 9
0
		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);
		}
Esempio n. 10
0
		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);
		}
Esempio n. 11
0
		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;
		}
Esempio n. 12
0
		public HelpStackChangedEventArgs(HelpInfo last, HelpInfo current)
		{
			this.last = last;
			this.current = current;
		}
Esempio n. 13
0
 public void UpdateFromProvider(IHelpProvider oldProvider, IHelpProvider newProvider, HelpInfo info)
 {
     if (oldProvider != null)
     {
         this.Pop(oldProvider);
     }
     if (info != null)
     {
         this.Push(newProvider, info);
     }
 }
Esempio n. 14
0
 public HelpStackChangedEventArgs(HelpInfo last, HelpInfo current)
 {
     this.last    = last;
     this.current = current;
 }