Thank you, for reply.
I'm find the solution for my problem:
I subscribed to event DocumentActivated and use ExecuteInApplicationContext.
Code:
private void DocumentManager_DocumentActivated(object sender, DocumentCollectionEventArgs e)
{
DocumentCollection docCollection = sender as DocumentCollection;
if (docCollection != null && Path.GetFileName(docCollection.MdiActiveDocument.Name).ToLower() == "somename.dwg")
{
Application.DocumentManager.ExecuteInApplicationContext(ExecuteCommand, sender);
}
}
private void ExecuteCommand(object sender)
{
DocumentCollection docCollection = sender as DocumentCollection;
docCollection.MdiActiveDocument.SendStringToExecute("MyMegaCommand ", true, false, false);
}