How can I tell which project is active?

Hi all -

I have a need to find out something about the active project, which I define as either:

- the project I'm currently creating, if I'm in the "New Project" dialog

- the project that I edit if I press the "Project Settings" button on the top ribbon, if I'm anywhere else

How do I find this out reliably in the API? My first idea was to retrieve the ProjectsController as follows:

ProjectsController c = SdlTradosStudio.Application.GetController<ProjectsController>();

and then grab the CurrentProject; but this is not necessarily the project that I'm lookin at in the project settings window. My next idea was to grab the first element from the SelectedProjects list; but this may be empty if no project is selected in the projects list. And if it IS selected, it's not the project in the New Project dialog, for obvious reasons.

If it's not possible to find the active project as I define it above, is it possible to figure out what view or dialog is active? That is, can I tell whether I'm in the New Project dialog, or in the Projects or Files views?

Thanks in advance -

Sam Bayer

Parents
  • Former Member
    Former Member
    This reply was deleted.
  • Thanks for responding. I meant my definition of "active" quite precisely. Changing my definition of "active", sadly, does not answer my question. I still need to know how to get access to the properties of the "active" project, as defined in my original question.
  • Also, active is not the same as current. E.g., if you're in the Projects view, and you select a project in the list that is not active, and summon the Project Settings dialog, the project whose settings you're editing is the selected project, but not the active one.

    Let's leave aside the "New project" case for a moment (although I do need it). I've continued to poke around the API and I can't find any way to distinguish between the following two cases:

    - Project A is the current project, Project B is the project that's currently highlighted in the Projects list. In the Projects view, press "Project Settings".

    - Project A is the current project, Project B is the project that's currently highlighted in the Projects list. In the Files view, press "Project Settings".

    In the first case, you're editing Project B's settings; in the second case, Project A's. When I'm in the Browse() method of a ITranslationProviderWinFormsUI, how can I distinguish between these two cases?
  • Former Member
    Former Member in reply to Sam Bayer
    This reply was deleted.
Reply Children