Hi!
I need to test the OnCloseView event in my Inventor add-in, where if a condition is true, that the OnCloseView event is canceled, that is, that the document remains open.
For example:
private void AppEvents_OnCloseView(Inventor.View ViewObject, EventTimingEnum BeforeOrAfter, NameValueMap Context, out HandlingCodeEnum HandlingCode)
{
HandlingCode = HandlingCodeEnum.kEventHandled;
if (true)
{
//keep document open
}
}
Could anybody help me?
Thanks
Solved! Go to Solution.
Solved by marcelo.zatteraBGGNH. Go to Solution.
By documentation this is not possible
Hi!
I'm trying another way, but I'm still having the same problem, I can't cancel closing the document.
private void AppEvents_OnCloseDocument(_Document DocumentObject, string FullDocumentName, EventTimingEnum BeforeOrAfter, NameValueMap Context, out HandlingCodeEnum HandlingCode)
{
HandlingCode = HandlingCodeEnum.kEventCanceled;
if (BeforeOrAfter == EventTimingEnum.kBefore)
{
bool shouldCancelClose = CheckSomeCondition(DocumentObject);
if (shouldCancelClose)
{
HandlingCode = HandlingCodeEnum.kEventCanceled;
}
}
}
Can't find what you're looking for? Ask the community or share your knowledge.