The following plugin suppresses the Do you want to save your work message box. Because the AboutToShowMsgBox event handler sets Handled=vbYes, Amos Graphics does not display the message box, but instead continues as though the user had clicked the Yes button.
Imports Amos
Imports System.Windows.Forms
<System.ComponentModel.Composition.Export(GetType(IPlugin))>
Public Class CustomCode
Implements IPlugin
Public Function Mainsub() As Integer Implements IPlugin.Mainsub
AddHandler pd.AboutToShowMsgBox, AddressOf AboutToShowMsgBox
MessageBox.Show("AboutToShowMsgBox Event Example is now installed.")
End Function
Private Sub AboutToShowMsgBox(ByVal MessageID As Integer, ByVal Prompt As String, ByRef Handled As DialogResult)
If MessageID = 1 Then
'Do you want to save your work?
Handled = DialogResult.Yes
End If
End Sub
Public Function Name() As String Implements IPlugin.Name
End Function
Public Function Description() As String Implements IPlugin.Description
End Function
End Class