There are a few ways you can do it, but just like @utaylor on a Report I kept it simple and just did like he did.
private void BAQReportForm_BeforeToolClick(object sender, Ice.Lib.Framework.BeforeToolClickEventArgs args)
{
switch (args.Tool.Key)
{
case "PrintClientTool":
case "PrintServerTool":
case "PrintPreviewTool":
// Build whereClause so we can inspect it
string whereClause = this.buildBatchesWhereClause();
if (whereClause == string.Empty)
{
args.Handled = true;
EpiMessageBox.Show("You Must Select Filters, Unable to Print Wide Open.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
if (args.Tool.Key != "PrintPreviewTool" && this.IsWatermarkEnabled())
{
args.Handled = true;
EpiMessageBox.Show("Something...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
break;
}
}
The other way is to do it on EpiViewNotification and always apply the Enabled/Disabled to the Tool