Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for dialogboxes_messagebox.cs

(view source code of dialogboxes_messagebox.cs as plain text)

  1. namespace RobvanderWoude
  2. {
  3. 	[System.Runtime.InteropServices.Guid( "FDA07CE5-CC3B-416F-8AEE-B95A8623D58A" )]
  4. 	public interface MessageBox_Interface
  5. 	{
  6. 		[System.Runtime.InteropServices.DispId( 1 )]
  7. 		void CheckUpdate( );
  8.  
  9. 		[System.Runtime.InteropServices.DispId( 2 )]
  10. 		string Credits( );
  11.  
  12. 		[System.Runtime.InteropServices.DispId( 3 )]
  13. 		string Help( int html = 0 );
  14.  
  15. 		[System.Runtime.InteropServices.DispId( 4 )]
  16. 		string ListMessageBoxButtons( );
  17.  
  18. 		[System.Runtime.InteropServices.DispId( 5 )]
  19. 		string ListMessageBoxIcons( );
  20.  
  21. 		[System.Runtime.InteropServices.DispId( 6 )]
  22. 		string ListMessageBoxOptions( );
  23.  
  24. 		[System.Runtime.InteropServices.DispId( 7 )]
  25. 		string ListProperties( );
  26.  
  27. 		[System.Runtime.InteropServices.DispId( 8 )]
  28. 		string SampleCode( );
  29.  
  30. 		[System.Runtime.InteropServices.DispId( 9 )]
  31. 		void Show( );
  32. 	}
  33.  
  34.  
  35. 	[System.Runtime.InteropServices.Guid( "705402EE-8469-445A-8B6D-06092B68DE89" ), System.Runtime.InteropServices.InterfaceType( System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIDispatch )]
  36. 	public interface MessageBox_Events
  37. 	{
  38. 	}
  39.  
  40.  
  41. 	[System.Runtime.InteropServices.Guid( "734BD1C4-EBDB-4F64-8118-E0497756A7F4" ), System.Runtime.InteropServices.ClassInterface( System.Runtime.InteropServices.ClassInterfaceType.AutoDual ), System.Runtime.InteropServices.ComSourceInterfaces( typeof( MessageBox_Events ) )]
  42. 	public class MessageBox : MessageBox_Interface
  43. 	{
  44. 		#region Default values
  45.  
  46. 		static readonly System.Windows.Forms.MessageBoxButtons defaultbuttonset = System.Windows.Forms.MessageBoxButtons.OK;
  47. 		const string defaultcaptioncancel = "Cancel";
  48. 		const string defaultcaptionok = "OK";
  49. 		static readonly System.Windows.Forms.MessageBoxIcon defaulticon = System.Windows.Forms.MessageBoxIcon.None;
  50. 		static readonly System.Windows.Forms.MessageBoxOptions defaultoptions = System.Windows.Forms.MessageBoxOptions.DefaultDesktopOnly | System.Windows.Forms.MessageBoxOptions.ServiceNotification;
  51. 		const string defaultmessage = "";
  52. 		static readonly string defaulttitle = string.Format( "{0},  Version {1}", Global.Common.ProgramInfo.FileName, Global.Common.ProgramInfo.FileVersion );
  53.  
  54. 		#endregion Default values
  55.  
  56.  
  57. 		#region Methods
  58.  
  59. 		public void CheckUpdate( )
  60. 		{
  61. 			Global.Common.ProgramInfo.CheckUpdate( );
  62. 		}
  63.  
  64.  
  65. 		public string Credits( )
  66. 		{
  67. 			return Global.Common.Credits( );
  68. 		}
  69.  
  70.  
  71. 		public string Help( int html = 0 )
  72. 		{
  73. 			int col1width = 0;
  74. 			int col2width = 0;
  75. 			int col3width = 0;
  76. 			int col4width = 0;
  77. 			int col5width = 0;
  78. 			string help = string.Empty;
  79. 			string linetemplate = string.Empty;
  80. 			string separatorline = string.Empty;
  81.  
  82. 			if ( html == 1 )
  83. 			{
  84. 				help += "<h1>Help for MessageBox class</h1>\n\n";
  85. 				help += "<p>Present a message dialog, and return the caption of the button clicked</p>\n\n";
  86. 				help += "<h2>COM ProgID: RobvanderWoude.MessageBox</h2>\n\n";
  87. 			}
  88. 			else
  89. 			{
  90. 				help += "Help for MessageBox class\n";
  91. 				help += new string( '\u2500', help.Length ) + "\n\n";
  92. 				help += "Present a message dialog, and return the caption of the button clicked\n\n\n";
  93. 				help += "COM ProgID: RobvanderWoude.MessageBox\n\n\n";
  94. 			}
  95.  
  96.  
  97. 			#region Properties
  98.  
  99. 			if ( html == 1 )
  100. 			{
  101. 				separatorline = string.Empty;
  102. 				linetemplate = "<tr>\n\t<td>{0}</td>\n\t<td>{1}</td>\n\t<td>{2}</td>\n\t<td>{3}</td>\n\t<td>{4}</td>\n</tr>\n";
  103.  
  104. 				help += "<table>\n";
  105. 				help += "<tr>\n";
  106. 				help += "\t<th colspan=\"5\">Properties (Note that all properties are string or integer, no booleans, objects or arrays)</th>\n";
  107. 				help += "</tr>\n";
  108.  
  109. 				help += "<tr>\n";
  110. 				help += "\t<th>Property Name</th>\n";
  111. 				help += "\t<th>Description</th>\n";
  112. 				help += "\t<th>Mandatory</th>\n";
  113. 				help += "\t<th>Read-Only</th>\n";
  114. 				help += "\t<th>Default (Allowed) Values</th>\n";
  115. 				help += "</tr>\n";
  116. 			}
  117. 			else
  118. 			{
  119. 				col1width = 20;
  120. 				col2width = 50;
  121. 				col3width = 9;
  122. 				col4width = 9;
  123. 				col5width = 40;
  124.  
  125. 				separatorline = "\u251C" + new string( '\u2500', 2 + col1width ) + "\u253C" + new string( '\u2500', 2 + col2width ) + "\u253C" + new string( '\u2500', 2 + col3width ) + "\u253C" + new string( '\u2500', 2 + col4width ) + "\u253C" + new string( '\u2500', 2 + col5width ) + "\u2524\n";
  126. 				linetemplate = "\u2502 {0,-" + col1width.ToString( ) + "} \u2502 {1,-" + col2width.ToString( ) + "} \u2502 {2,-" + col3width.ToString( ) + "} \u2502 {3,-" + col4width.ToString( ) + "} \u2502 {4,-" + col5width.ToString( ) + "} \u2502\n";
  127.  
  128. 				help += "\u250C" + new string( '\u2500', 14 + col1width + col2width + col3width + col4width + col5width ) + "\u2510\n";
  129. 				help += "\u2502" + new string( ' ', 14 + col1width + col2width + col3width + col4width + col5width ) + "\u2502\n";
  130. 				help += string.Format( "\u2502 {0,-" + ( 12 + col1width + col2width + col3width + col4width + col5width ).ToString( ) + "} \u2502\n", "Properties        (Note that all properties are string or integer, no booleans, objects or arrays)" );
  131. 				help += "\u2502" + new string( ' ', 14 + col1width + col2width + col3width + col4width + col5width ) + "\u2502\n";
  132. 				help += "\u255E" + new string( '\u2550', 2 + col1width ) + "\u2564" + new string( '\u2550', 2 + col2width ) + "\u2564" + new string( '\u2550', 2 + col3width ) + "\u2564" + new string( '\u2550', 2 + col4width ) + "\u2564" + new string( '\u2550', 2 + col5width ) + "\u2561\n";
  133. 				help += string.Format( linetemplate, "Property Name", "Description", "Mandatory", "Read-Only", "Default (Allowed) Values" );
  134. 				help += "\u255E" + new string( '\u2550', 2 + col1width ) + "\u256A" + new string( '\u2550', 2 + col2width ) + "\u256A" + new string( '\u2550', 2 + col3width ) + "\u256A" + new string( '\u2550', 2 + col4width ) + "\u256A" + new string( '\u2550', 2 + col5width ) + "\u2561\n";
  135. 			}
  136.  
  137. 			help += HelpTableRow( linetemplate, "buttons", "The buttons presented in the dialog", "no", "no", "OK (" + Global.Common.Lists.MessageBoxButtons( ).Replace( ";", ", " ) + ")", html );
  138. 			help += separatorline;
  139.  
  140. 			help += HelpTableRow( linetemplate, "buttonclicked", "The caption of the button that was clicked", "no", "no", "", html );
  141. 			help += separatorline;
  142.  
  143. 			help += HelpTableRow( linetemplate, "defaultbutton", "The button that has focus when the dialog opens", "no", "no", "Button1 (Button1, Button2, Button3)", html );
  144. 			help += separatorline;
  145.  
  146. 			help += HelpTableRow( linetemplate, "debuginfo", Global.Common.Help.debuginfo, "N/A", "YES", "", html );
  147. 			help += separatorline;
  148.  
  149. 			help += HelpTableRow( linetemplate, "errors", Global.Common.Help.errors, "N/A", "YES", "", html );
  150. 			help += separatorline;
  151.  
  152. 			help += HelpTableRow( linetemplate, "icons", "The icon in the dialog", "no", "no", defaulticon.ToString( ) + " (" + Global.Common.Lists.MessageBoxIcons( ).Replace( ";", ", " ) + ")", html );
  153. 			help += separatorline;
  154.  
  155. 			help += HelpTableRow( linetemplate, "message", "The message to be displayed in the dialog", "no", "no", defaultmessage, html );
  156. 			help += separatorline;
  157.  
  158. 			help += HelpTableRow( linetemplate, "options", "The options for the dialog", "no", "no", defaultoptions.ToString( ) + " (" + Global.Common.Lists.MessageBoxOptions( ).Replace( ";", ", " ) + ")", html );
  159. 			help += separatorline;
  160.  
  161. 			help += HelpTableRow( linetemplate, "title", Global.Common.Help.title, "no", "no", defaulttitle, html );
  162. 			help += separatorline;
  163.  
  164. 			help += HelpTableRow( linetemplate, "Version", Global.Common.Help.version, "N/A", "YES", "", html );
  165.  
  166. 			if ( html == 1 )
  167. 			{
  168. 				help += "</table>\n\n\n";
  169. 			}
  170. 			else
  171. 			{
  172. 				help += "\u2514" + new string( '\u2500', 2 + col1width ) + "\u2534" + new string( '\u2500', 2 + col2width ) + "\u2534" + new string( '\u2500', 2 + col3width ) + "\u2534" + new string( '\u2500', 2 + col4width ) + "\u2534" + new string( '\u2500', 2 + col5width ) + "\u2518\n\n\n";
  173. 			}
  174.  
  175. 			#endregion Properties
  176.  
  177.  
  178. 			#region Methods
  179.  
  180. 			if ( html == 1 )
  181. 			{
  182. 				separatorline = string.Empty;
  183. 				linetemplate = "<tr>\n\t<td>{0}</td>\n\t<td>{1}</td>\n\t<td>{2}</td>\n</tr>\n";
  184.  
  185. 				help += "<table>\n";
  186. 				help += "<tr>\n";
  187. 				help += "\t<th colspan=\"3\">Methods</th>\n";
  188. 				help += "</tr>\n";
  189.  
  190. 				help += "<tr>\n";
  191. 				help += "\t<th>Method Name</th>\n";
  192. 				help += "\t<th>Description</th>\n";
  193. 				help += "\t<th>Requirements</th>\n";
  194. 				help += "</tr>\n";
  195. 			}
  196. 			else
  197. 			{
  198. 				col1width = 21;
  199. 				col2width = 74;
  200. 				col3width = 39;
  201.  
  202. 				separatorline = "\u251C" + new string( '\u2500', 2 + col1width ) + "\u253C" + new string( '\u2500', 2 + col2width ) + "\u253C" + new string( '\u2500', 2 + col3width ) + "\u2524\n";
  203. 				linetemplate = "\u2502 {0,-" + col1width.ToString( ) + "} \u2502 {1,-" + col2width.ToString( ) + "} \u2502 {2,-" + col3width.ToString( ) + "} \u2502\n";
  204.  
  205. 				help += "\u250C" + new string( '\u2500', 8 + col1width + col2width + col3width ) + "\u2510\n";
  206. 				help += "\u2502" + new string( ' ', 8 + col1width + col2width + col3width ) + "\u2502\n";
  207. 				help += string.Format( "\u2502 {0,-" + ( 6 + col1width + col2width + col3width ).ToString( ) + "} \u2502\n", "Methods" );
  208. 				help += "\u2502" + new string( ' ', 8 + col1width + col2width + col3width ) + "\u2502\n";
  209. 				help += "\u255E" + new string( '\u2550', 2 + col1width ) + "\u2564" + new string( '\u2550', 2 + col2width ) + "\u2564" + new string( '\u2550', 2 + col3width ) + "\u2561\n";
  210. 				help += string.Format( linetemplate, "Method Name", "Description", "Requirements" );
  211. 				help += "\u255E" + new string( '\u2550', 2 + col1width ) + "\u256A" + new string( '\u2550', 2 + col2width ) + "\u256A" + new string( '\u2550', 2 + col3width ) + "\u2561\n";
  212. 			}
  213.  
  214. 			help += HelpTableRow( linetemplate, "CheckUpdate", Global.Common.Help._checkupdate, "", html );
  215. 			help += separatorline;
  216.  
  217. 			help += HelpTableRow( linetemplate, "Credits", Global.Common.Help._credits, "", html );
  218. 			help += separatorline;
  219.  
  220. 			help += HelpTableRow( linetemplate, "Help", Global.Common.Help._help, "", html );
  221. 			help += separatorline;
  222.  
  223. 			help += HelpTableRow( linetemplate, "ListMessageBoxButtons", "Return a semicolon-separated list of available buttons", "", html );
  224. 			help += separatorline;
  225.  
  226. 			help += HelpTableRow( linetemplate, "ListMessageBoxIcons", "Return a semicolon-separated list of available icons", "", html );
  227. 			help += separatorline;
  228.  
  229. 			help += HelpTableRow( linetemplate, "ListMessageBoxOptions", "Return a semicolon-separated list of available options", "", html );
  230. 			help += separatorline;
  231.  
  232. 			help += HelpTableRow( linetemplate, "ListProperties", Global.Common.Help._listproperties, "", html );
  233. 			help += separatorline;
  234.  
  235. 			help += HelpTableRow( linetemplate, "SampleCode", Global.Common.Help._samplecode, "", html );
  236. 			help += separatorline;
  237.  
  238. 			help += HelpTableRow( linetemplate, "Show", "Presents a message dialog based on the current property values, and saves the caption of the button that is clicked in the \"buttonclicked\" property.", "", html );
  239.  
  240. 			if ( html == 1 )
  241. 			{
  242. 				help += "</table>\n\n\n";
  243. 			}
  244. 			else
  245. 			{
  246. 				help += "\u2514" + new string( '\u2500', 2 + col1width ) + "\u2534" + new string( '\u2500', 2 + col2width ) + "\u2534" + new string( '\u2500', 2 + col3width ) + "\u2518\n\n\n";
  247. 			}
  248.  
  249. 			#endregion Methods
  250.  
  251.  
  252. 			#region Example
  253.  
  254. 			if ( html == 1 )
  255. 			{
  256. 				help += "<h2>VBScript usage example:</h2>\n\n<pre>";
  257. 			}
  258. 			else
  259. 			{
  260. 				help += "VBScript usage example:\n";
  261. 				help += new string( '\u2500', 23 ) + "\n\n";
  262. 			}
  263.  
  264. 			help += SampleCode( );
  265.  
  266. 			if ( html == 1 )
  267. 			{
  268. 				help += "</pre>";
  269. 			}
  270.  
  271. 			help += "\n\n";
  272.  
  273. 			#endregion Example
  274.  
  275.  
  276. 			help = help.Replace( "\n", System.Environment.NewLine );
  277. 			return help;
  278. 		}
  279.  
  280.  
  281. 		private string HelpTableRow( string template, string col1text, string col2text, string col3text, int html )
  282. 		{
  283. 			if ( html == 1 )
  284. 			{
  285. 				return Global.Common.Help.HelpTableRowHTML( col1text, col2text, col3text );
  286. 			}
  287. 			else
  288. 			{
  289. 				return Global.Common.Help.HelpTableRowText( template, col1text, col2text, col3text, "", "" );
  290. 			}
  291. 		}
  292.  
  293.  
  294. 		private string HelpTableRow( string template, string col1text, string col2text, string col3text, string col4text, string col5text, int html )
  295. 		{
  296. 			if ( html == 1 )
  297. 			{
  298. 				return Global.Common.Help.HelpTableRowHTML( col1text, col2text, col3text, col4text, col5text );
  299. 			}
  300. 			else
  301. 			{
  302. 				return Global.Common.Help.HelpTableRowText( template, col1text, col2text, col3text, col4text, col5text );
  303. 			}
  304. 		}
  305.  
  306.  
  307. 		public string ListMessageBoxButtons( )
  308. 		{
  309. 			return Global.Common.Lists.MessageBoxButtons( );
  310. 		}
  311.  
  312.  
  313. 		public string ListMessageBoxIcons( )
  314. 		{
  315. 			return Global.Common.Lists.MessageBoxIcons( );
  316. 		}
  317.  
  318.  
  319. 		public string ListMessageBoxOptions( )
  320. 		{
  321. 			return Global.Common.Lists.MessageBoxOptions( );
  322. 		}
  323.  
  324.  
  325. 		public string ListProperties( )
  326. 		{
  327. 			return Global.Common.Lists.Properties( this );
  328. 		}
  329.  
  330.  
  331. 		public string SampleCode( )
  332. 		{
  333. 			string code = "Set objMessageBox = CreateObject( \"RobvanderWoude.MessageBox\" )\n\n";
  334. 			code += "With objMessageBox\n";
  335. 			code += "\t.message = \"This MessageBox is more or less obsolete in VBScript,\" & vbCrLf _\n";
  336. 			code += "\t         & \"as it is almost identical to VBScript's own MsgBox,\" & vbCrLf _\n";
  337. 			code += "\t         & \"but it may be useful in other COM-aware scripting languages.\"\n";
  338. 			code += "\t.title = \"MessageBox Demo\"\n";
  339. 			code += "\t.buttons = \"OK\"\n";
  340. 			code += "\t.icon = \"Information\"\n";
  341. 			code += "\t.Show\n";
  342. 			code += "\tWScript.Echo \"You clicked: \" & .buttonclicked\n";
  343. 			code += "\tWScript.Echo\n";
  344. 			code += "\tWScript.Echo .ListProperties( )\n";
  345. 			code += "End With\n\n";
  346. 			code += "Set objMessageBox = Nothing";
  347. 			return code;
  348. 		}
  349.  
  350.  
  351. 		[System.STAThread]
  352. 		public void Show( )
  353. 		{
  354. 			try
  355. 			{
  356. 				_buttonclicked = System.Windows.Forms.MessageBox.Show( message, title, _buttons, _icon, _defaultbutton, _options );
  357. 			}
  358. 			catch ( System.Exception e )
  359. 			{
  360. 				_errors.Add( timestamp + "Error while trying to show dialog: " + e.Message );
  361. 			}
  362. 		}
  363.  
  364. 		#endregion Methods
  365.  
  366.  
  367. 		#region Properties
  368.  
  369. 		private System.Windows.Forms.MessageBoxButtons _buttons = defaultbuttonset;
  370. 		[System.Runtime.InteropServices.ComVisible( true )]
  371. 		public string buttons
  372. 		{
  373. 			get
  374. 			{
  375. 				return _buttons.ToString( );
  376. 			}
  377. 			set
  378. 			{
  379. 				if ( !System.Enum.TryParse<System.Windows.Forms.MessageBoxButtons>( value, true, out _buttons ) )
  380. 				{
  381. 					_debuginfo.Add( string.Format( "{0}Unable to make sense of specified button \"{1}\", using default \"{2}\" instead", timestamp, value, defaultbuttonset.ToString( ) ) );
  382. 					_buttons = defaultbuttonset;
  383. 				}
  384. 			}
  385. 		}
  386.  
  387.  
  388. 		private System.Windows.Forms.DialogResult _buttonclicked;
  389. 		[System.Runtime.InteropServices.ComVisible( true )]
  390. 		public string buttonclicked
  391. 		{
  392. 			get
  393. 			{
  394. 				return _buttonclicked.ToString( );
  395. 			}
  396. 		}
  397.  
  398.  
  399. 		private System.Windows.Forms.MessageBoxDefaultButton _defaultbutton = System.Windows.Forms.MessageBoxDefaultButton.Button1;
  400. 		[System.Runtime.InteropServices.ComVisible( true )]
  401. 		public int defaultbutton
  402. 		{
  403. 			get
  404. 			{
  405. 				if ( int.TryParse( _defaultbutton.ToString( ).Substring( 6 ), out int test ) )
  406. 				{
  407. 					return test;
  408. 				}
  409. 				else
  410. 				{
  411. 					_errors.Add( timestamp + "Unable to determine default button" );
  412. 					return 0;
  413. 				}
  414. 			}
  415. 			set
  416. 			{
  417. 				if ( !System.Enum.TryParse<System.Windows.Forms.MessageBoxDefaultButton>( "Button" + value.ToString( ), true, out _defaultbutton ) )
  418. 				{
  419. 					_debuginfo.Add( string.Format( "{0}Unable to make sense of default button \"Button{1}\", using \"Button1\" instead", timestamp, value.ToString( ) ) );
  420. 					_defaultbutton = System.Windows.Forms.MessageBoxDefaultButton.Button1;
  421. 				}
  422. 			}
  423. 		}
  424.  
  425.  
  426. 		private System.Collections.Generic.List<string> _debuginfo = new System.Collections.Generic.List<string>( );
  427. 		[System.Runtime.InteropServices.ComVisible( true )]
  428. 		public string debuginfo
  429. 		{
  430. 			get
  431. 			{
  432. 				return string.Join( "\n", _debuginfo.ToArray( ) );
  433. 			}
  434. 		}
  435.  
  436.  
  437. 		private System.Collections.Generic.List<string> _errors = new System.Collections.Generic.List<string>( );
  438. 		[System.Runtime.InteropServices.ComVisible( true )]
  439. 		public string errors
  440. 		{
  441. 			get
  442. 			{
  443. 				return string.Join( "\n", _errors.ToArray( ) );
  444. 			}
  445. 		}
  446.  
  447.  
  448. 		private System.Windows.Forms.MessageBoxIcon _icon = defaulticon;
  449. 		[System.Runtime.InteropServices.ComVisible( true )]
  450. 		public string icon
  451. 		{
  452. 			get
  453. 			{
  454. 				return _icon.ToString( );
  455. 			}
  456. 			set
  457. 			{
  458. 				if ( !System.Enum.TryParse<System.Windows.Forms.MessageBoxIcon>( value, true, out _icon ) )
  459. 				{
  460. 					_debuginfo.Add( string.Format( "{0}Unable to make sense of specified icon \"{1}\", using default \"{2}\" instead", timestamp, value, defaulticon.ToString( ) ) );
  461. 					_icon = defaulticon;
  462. 				}
  463. 			}
  464. 		}
  465.  
  466.  
  467. 		private string _message = defaultmessage;
  468. 		[System.Runtime.InteropServices.ComVisible( true )]
  469. 		public string message
  470. 		{
  471. 			get
  472. 			{
  473. 				return _message;
  474. 			}
  475. 			set
  476. 			{
  477. 				_message = value.Trim( );
  478. 			}
  479. 		}
  480.  
  481.  
  482. 		private System.Windows.Forms.MessageBoxOptions _options = defaultoptions;
  483. 		[System.Runtime.InteropServices.ComVisible( true )]
  484. 		public string options
  485. 		{
  486. 			get
  487. 			{
  488. 				return _options.ToString( );
  489. 			}
  490. 			set
  491. 			{
  492. 				if ( System.Enum.TryParse<System.Windows.Forms.MessageBoxOptions>( value, true, out System.Windows.Forms.MessageBoxOptions test ) )
  493. 				{
  494. 					_options = test | defaultoptions;
  495. 				}
  496. 				else
  497. 				{
  498. 					_debuginfo.Add( string.Format( "{0}Unable to make sense of MessageBoxOption \"{1}\", using default \"{2}\" instead", timestamp, value, defaultoptions ) );
  499. 					_options = defaultoptions;
  500. 				}
  501. 			}
  502. 		}
  503.  
  504.  
  505. 		private static string timestamp => Global.Common.TimeStamp( );
  506.  
  507.  
  508. 		private string _title = defaulttitle;
  509. 		[System.Runtime.InteropServices.ComVisible( true )]
  510. 		public string title
  511. 		{
  512. 			get
  513. 			{
  514. 				return _title;
  515. 			}
  516. 			set
  517. 			{
  518. 				if ( string.IsNullOrWhiteSpace( value ) || value.Length > 40 )
  519. 				{
  520. 					_debuginfo.Add( timestamp + "Specified title is ignored because it is empty or too long, using default title instead" );
  521. 					_title = defaulttitle;
  522. 				}
  523. 				else
  524. 				{
  525. 					_title = value.Trim( );
  526. 				}
  527. 			}
  528. 		}
  529.  
  530.  
  531. 		[System.Runtime.InteropServices.ComVisible( true )]
  532. 		public string Version
  533. 		{
  534. 			get
  535. 			{
  536. 				return Global.Common.ProgramInfo.FileVersion;
  537. 			}
  538. 		}
  539.  
  540. 		#endregion Properties
  541. 	}
  542. }
  543.  

page last modified: 2024-04-16; loaded in 0.0140 seconds