Click here to Skip to main content
15,893,161 members
Articles / Programming Languages / Forth.NET

DocMounter 2: A tool to build VS.NET documentation (now with Sandcastle)

,
Rate me:
Please Sign up or sign in to vote.
4.94/5 (29 votes)
15 Nov 2010GPL314 min read 139.4K   1.4K   99  
Tool for creating MS Visual Studio documentation files - XML Summaries, HxS/MSHC help solutions and manuals.
using System;
using System.IO;
using System.Windows.Forms;

namespace TenTec.Utils
{
	/// <summary>
	///	Provides the unified way of displaying messages and questions
	///	(such as system message boxes) in the app
	/// </summary>
	internal class MessagesManager
	{
		#region Methods
		private static string GetExeName()
		{
			return Path.GetFileNameWithoutExtension(Application.ExecutablePath);
		}

		public static DialogResult ShowError(Control control, string message)
		{
			return (DialogResult)control.Invoke(new ShowMessageDelegate(ShowErrorInternal), new object[] { control, message});
		}

		public static DialogResult ShowQuestion(Control control, string message, MessageBoxButtons buttons)
		{
			return (DialogResult)control.Invoke(new ShowQuestionDelegate(ShowQuestionInternal), new object[] { control, message, buttons, MessageBoxDefaultButton.Button1 });
		}

		public static DialogResult ShowQuestion(Control control, string message, MessageBoxButtons buttons, MessageBoxDefaultButton defaultButton)
		{
			return (DialogResult)control.Invoke(new ShowQuestionDelegate(ShowQuestionInternal), new object[] { control, message, buttons, defaultButton });
		}

		public static DialogResult ShowInfo(Control control, string message)
		{
			return (DialogResult)control.Invoke(new ShowMessageDelegate(ShowInfoInternal), new object[] { control, message });
		}

		private static DialogResult ShowErrorInternal(Control control, string message)
		{
			return MessageBox.Show(control, message, GetExeName(), MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1);
		}

		private static DialogResult ShowQuestionInternal(Control control, string message, MessageBoxButtons buttons, MessageBoxDefaultButton defaultButton)
		{
			return MessageBox.Show(control, message, GetExeName(), buttons, MessageBoxIcon.Question, defaultButton);
		}

		private static DialogResult ShowInfoInternal(Control control, string message)
		{
			return MessageBox.Show(control, message, GetExeName(), MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1);
		}

		private delegate DialogResult ShowMessageDelegate(Control control, string message);
		private delegate DialogResult ShowQuestionDelegate(Control control, string message, MessageBoxButtons buttons, MessageBoxDefaultButton defaultButton);
		#endregion
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU General Public License (GPLv3)


Written By
Software Developer (Senior)
Canada Canada
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Written By
Ukraine Ukraine
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.
This is a Organisation

2 members

Comments and Discussions