Repository.Project.GetCurrentProject: Difference between revisions

From ReliaWiki
Jump to navigation Jump to search
Line 7: Line 7:


== Usage Example ==
== Usage Example ==
In this usage example, a project is opened from a Synthesis repository, and the ID of the project is retrieved.
In this usage example, a project is opened in a Synthesis repository, and the ID of the project is retrieved.
  {{APIComment|'Declare a new repository connection object. See [[Repository Class|Repository]].}}
  {{APIComment|'Declare a new repository connection object. See [[Repository Class|Repository]].}}
   Dim MyRepository As New Repository
   Dim MyRepository As New Repository
Line 17: Line 17:
  {{APIComment|'Get a list of the names/IDs of projects in the connected repository.}}
  {{APIComment|'Get a list of the names/IDs of projects in the connected repository.}}
   Dim ListOfProjects() As NameIdPair
   Dim ListOfProjects() As NameIdPair
   ListOfProjects = MyRepository.GetAllProjects()
   ListOfProjects = MyRepository.Project.GetAllProjects()
    
    
  {{APIComment|'Open the first project in the list.}}
  {{APIComment|'Open the first project in the list.}}
   MyRepository.SetCurrentProject(ListOfProjects(0).ID)
   MyRepository.Project.SetCurrentProject(ListOfProjects(0).ID)
    
    
  {{APIComment|'Get the ID of the opened project.}}
  {{APIComment|'Get the ID of the opened project.}}
   Dim ID As Integer
   Dim ID As Integer
   ID = MyRepository.GetCurrentProject()
   ID = MyRepository.Project.GetCurrentProject()
    
    
  {{APIComment|'Disconnect from the repository.}}
  {{APIComment|'Disconnect from the repository.}}
   MyRepository.DisconnectFromRepository()
   MyRepository.DisconnectFromRepository()

Revision as of 17:38, 20 May 2015


Returns the name and ID of the current project.

Syntax

Usage Example

In this usage example, a project is opened in a Synthesis repository, and the ID of the project is retrieved.

 'Declare a new repository connection object. See Repository. 
 Dim MyRepository As New Repository
 
 'Connect to a Synthesis repository. 
 Dim Success As Boolean = False
 Success = MyRepository.ConnectToRepository("C:\Users\Name\Documents\ReliaSoft\Files\repository.rsr9")
 
 'Get a list of the names/IDs of projects in the connected repository. 
 Dim ListOfProjects() As NameIdPair
 ListOfProjects = MyRepository.Project.GetAllProjects()
 
 'Open the first project in the list. 
 MyRepository.Project.SetCurrentProject(ListOfProjects(0).ID)
 
 'Get the ID of the opened project. 
 Dim ID As Integer
 ID = MyRepository.Project.GetCurrentProject()
 
 'Disconnect from the repository. 
 MyRepository.DisconnectFromRepository()