Hi,
I'm trying to capture the print button events of the PopPrintPurchasingDocumentsForm form but is not working. It only works if I don't have any restriction selected. When debug with visual studio and click the print button, the breakpoint is not stopping in those events.
This is the code that I'm using.
internal static Microsoft.Dexterity.Applications.MultiEntityManagementDictionary.PopPrintPurchasingDocumentsForm PopPrintPurchasingDocumentsForm;
public void Initialize()
{
PopPrintPurchasingDocumentsForm = Dynamics.Forms.PopPrintPurchasingDocuments;
PopPrintPurchasingDocumentsForm.PopPrintPurchasingDocuments.PrintButton.ClickBeforeOriginal += PrintButton_ClickBeforeOriginal;
PopPrintPurchasingDocumentsForm.PopPrintPurchasingDocuments.PrintButton.ClickAfterOriginal += PrintButton_ClickAfterOriginal;
PopPrintPurchasingDocumentsForm.PopPrintPurchasingDocuments.PrintBeforeOriginal += PopPrintPurchasingDocuments_PrintBeforeOriginal;
}
private void PrintButton_ClickAfterOriginal(object sender, EventArgs e)
{
throw new NotImplementedException();
}
private void PopPrintPurchasingDocuments_PrintBeforeOriginal(object sender, System.ComponentModel.CancelEventArgs e)
{
var g = PopPrintPurchasingDocumentsForm.PopPrintPurchasingDocuments.LocalRestrictions.Value;
e.Cancel = true;
}
private void PrintButton_ClickBeforeOriginal(object sender, System.ComponentModel.CancelEventArgs e)
{
var g = PopPrintPurchasingDocumentsForm.PopPrintPurchasingDocuments.LocalRestrictions.Value;
e.Cancel = true;
}