MindManager plugin is not working properly

liuxiansheng shared this question 48 days ago
Discussion Open

Hello, I am using C# to write a plugin for MindManager. My requirement is to display a dialog box when a document is opened. Here is an example written by GPT:

int i_Mask = (int)MmDocumentEventFlags.mmEventFlagDocumentOpened;
documentEvent = mmApp.Events.AddDocumentEvent(i_Mask, false, true, null);
documentEvent.Fire += DocumentOpenedHandler;
private void DocumentOpenedHandler(int eventFlag, MmEventTime time, object pSource, ref object pExtra)
 {
     MessageBox.Show("hello world", "notice");
 }
This code works, but it’s not perfect. When I open Document A, note that at this time MindManager is not yet open. The dialog box does not appear when Document A is opened. However, when I then open Document B, the dialog box will appear.

I want to ask if there is an issue with my code, which causes the event not to be triggered when the first document is opened, and only triggers after MindManager is running. Please help me, thank you

Replies (1)

photo
1

It is possible that when MindManager is first launched, the document requested on the command line is opened before the Add-In is connected. The OnConnection() event in your Add-in should iterate over existing documents and process them. This will also support correct processing if the Add-In is disabled then re-enabled in the MindManager options.

photo
1

Thank you very much! The issue has been resolved following the solution you provided

photo
Leave a Comment
 
Attach a file