XCore.XMessageBoxExManager.DefineMessageBox C# (CSharp) Method

DefineMessageBox() public method

public DefineMessageBox ( string triggerName, string caption, string text, bool displayDontShowAgainButton, string iconName ) : void
triggerName string
caption string
text string
displayDontShowAgainButton bool
iconName string
return void
		public void DefineMessageBox(string triggerName, string caption, string text,
			bool displayDontShowAgainButton, string iconName)
		{
			// Don't dispose msgBox here. MessageBoxExManager holds a reference to it and will dispose it eventually.
			MessageBoxEx msgBox;
			try
			{
				msgBox = MessageBoxExManager.CreateMessageBox(triggerName);
			}
			catch (ArgumentException)
			{
					return;
					//this message box library throws an exception if you have already defined this triggerName.
						//for us, this might just mean that you opened another window the same kind or something like that.
			}

				msgBox.Caption = caption;
				msgBox.Text = text;
				msgBox.SaveResponseText = xCoreInterfaces.DonTShowThisAgain;
				msgBox.AllowSaveResponse = displayDontShowAgainButton;
				msgBox.UseSavedResponse = displayDontShowAgainButton;
			switch(iconName)
			{
				default:
						msgBox.CustomIcon = GetIcon(iconName);
						//should be a bmp in the resources
					break;
				case "info":
					msgBox.Icon = MessageBoxExIcon.Information;
					break;
				case "exclamation":
					msgBox.Icon = MessageBoxExIcon.Exclamation;
					break;
			}
		}

Usage Example

Beispiel #1
0
		/// <summary>
		/// Initialize the required inventories.
		/// </summary>
		private void InitializeMessageDialogs()
		{
			WriteSplashScreen(LexTextStrings.ksInitializingMessageDialogs_);
			m_messageBoxExManager = XMessageBoxExManager.CreateXMessageBoxExManager();
			m_messageBoxExManager.DefineMessageBox("TextChartNewFeature",
				LexTextStrings.ksNewFeature,
				LexTextStrings.ksChartTemplateWarning, true, "exclamation");
			m_messageBoxExManager.DefineMessageBox("CategorizedEntry-Intro",
				LexTextStrings.ksInformation,
				LexTextStrings.ksUsedForSemanticBasedEntry, true, "info");
			m_messageBoxExManager.DefineMessageBox("CreateNewFromGrammaticalCategoryCatalog",
				LexTextStrings.ksInformation,
				LexTextStrings.ksCreatingCustomGramCategory, true, "info");
			m_messageBoxExManager.DefineMessageBox("CreateNewLexicalReferenceType",
				LexTextStrings.ksInformation,
				LexTextStrings.ksCreatingCustomLexRefType, true, "info");
			m_messageBoxExManager.DefineMessageBox("ClassifiedDictionary-Intro",
				LexTextStrings.ksInformation,
				LexTextStrings.ksShowingSemanticClassification, true, "info");

			m_messageBoxExManager.ReadSettingsFile();
			WriteSplashScreen("");
		}