locked
Best place to attach solution events RRS feed

  • General discussion

  • Where is the best place to add solution or project events, such as ProjectAdded?

    If I do this when the add-in connects then there's no solution loaded, so how can I tell when a solution has been loaded?

    Thursday, August 12, 2010 6:57 PM

All replies

  • Hi There,

    You can choose OnStartupComplete event to write the event handlers. Below is the code sample to check if solution has been loaded.

    private SolutionEvents _solutionEvents;

    public void OnStartupComplete(ref Array custom)
    {
                _solutionEvents = _applicationObject.Events.SolutionEvents;
                _solutionEvents.Opened += new _dispSolutionEvents_OpenedEventHandler(OnSolutionOpened);
    }

    void OnSolutionOpened()
            { 

            }

    Hope this helps.

    Best Regards,

    Shikhar Jain

    Thursday, October 4, 2012 9:31 AM