msiContextCustomMenuItem_Click
(
object sender,
EventArgs e
)
{
Debug.Assert(sender is ToolStripMenuItem);
AssertValid();
// Run the custom action that was stored as a String in the menu item's
// Tag.
ToolStripMenuItem oItem = (ToolStripMenuItem)sender;
Debug.Assert(oItem.Tag is String);
String sCustomMenuItemAction = (String)oItem.Tag;
Debug.Assert( !String.IsNullOrEmpty(sCustomMenuItemAction) );
this.UseWaitCursor = true;
try
{
Process.Start(sCustomMenuItemAction);
this.UseWaitCursor = false;
}
catch (Exception oException)
{
this.UseWaitCursor = false;
FormUtil.ShowWarning(String.Format(
"A problem occurred while attempting to run this custom menu"
+ " item action:"
+ "\r\n\r\n"
+ "{0}"
+ "\r\n\r\n"
+ "Here are the details:"
+ "\r\n\r\n"
+ "\"{1}\""
+ "\r\n\r\n"
+ "Running a custom menu item action is similar to typing the"
+ " action into the Run dialog box of the Windows Start menu."
+ " You might want to test your custom action using the Run"
+ " dialog before typing the action into the Custom Menu Item"
+ " Action column of the Vertices worksheet."
,
sCustomMenuItemAction,
oException.Message
) );
}
}