Thanks a lot for your reply, it was very helpful to me!!
I ended up putting this kind of code in my app to fire only when the event refers to an active document that is different from the one stored in-memory from last time.
// DocumentBecameCurrent event fires multiple times for a document switch, it fires first with the new document with isActive = true,
// then fires with the old document with isActive false and then once again with the new document with isActive = true.
// Hence we put this double check below of processing only if active and different from the document stored in memory.(currentDocument)
// The world outside this function will only see one event DocumentChanged (custom event) bubbled correctly.
var isActive = e.Document.IsActive;
if (isActive)
{
var documentThatJustBecameCurrent = e.Document == null ? null : e.Document.Name;
if (!String.Equals(documentThatJustBecameCurrent, currentDocument))
{
currentDocument = documentThatJustBecameCurrent;
DocumentChanged(sender, e);
}
}