I have multiple instances of the pdf editor control in different forms, and a custom PdfEditorCommandHandler for the cmd.save command. But it seems as though only the last PdfEditorCommandHandler instance gets called when hitting save in any open pdf editor control.
So if I have two instances of the pdf editor control open, A and B. If first A is opened, and the cmd.save cmd.Handler is set to an instance of PdfEditorCommandHandler, and then B is opened, and it's instance of PdfEditorCommandHandler is set to it's cmd.save cmd.Handler, then when hitting save in A, then B's PdfEditorCommandHandler is called, and B's document is saved. Not A.
Code: Select all
//this is set for each instance of the pdf editor control
PdfEditorCommandHandler cmdHandler = new PdfEditorCommandHandler();
PDFXEdit.IUIX_Cmd cmd;
cmd = GetIUIX_Cmd("cmd.save");
cmd.Handler = cmdHandler;
//when firing the event OnSaveEvent in cmdHandler, the last instance of pdf editor control that was set to the
//last instance of PdfEditorCommandHandler instantiated is being called, and then subsequently the wrong document is saved.
cmdHandler.OnSaveEvent += SaveEvent;
public PDFXEdit.IUIX_Cmd GetIUIX_Cmd(string cmd)
{
return uiInst.CmdManager.Cmds.Find(cmd);
}