Static (Shared in Visual Basic) method that loads an IProject from a project file.
A reference to an IProject as stored in fileName.
The following example demonstrates how to load an IProject and get a reference to an IForm.
C# sample
using System; using System.IO; using suite4.net.FormDatabase; namespace suite4.net.Sample { public class Project { private IProject _project; public Project() { } public suite4.net.FormDatabase.IForm GetIForm(string formName) { FileInfo fileInfo; if(this._project == null) { this._project = suite4.net.FormDatabase.Project.LoadFromFile("sample.fspj"); } else { fileInfo = new FileInfo("sample.fspj"); if(fileInfo.LastWriteTime > this._project.LastModification) { // Reload the project if the project has been changed. // This can be done during runtime. this._project = suite4.net.FormDatabase.Project.LoadFromFile("sample.fspj"); } } if(this._project != null) { return this._project.GetForm(formName); } return null; } } }
Imports System Imports System.IO Imports suite4.net.FormDatabase Namespace suite4.net.Sample Public Class Project Private _project As IProject Public Sub New() End Sub Public Function GetIForm(ByVal formName As String) As suite4.net.FormDataMyBase.IForm Dim fileInfo As FileInfo If Me._project Is Nothing Then Me._project = suite4.net.FormDataMyBase.Project.LoadFromFile("sample.fspj") Else fileInfo = New FileInfo("sample.fspj") If fileInfo.LastWriteTime > Me._project.LastModification Then ' Reload the project if the project has been changed. ' This can be done during runtime. Me._project = suite4.net.FormDataMyBase.Project.LoadFromFile("sample.fspj") End If End If If Not Me._project Is Nothing Then Return Me._project.GetForm(formName) End If Return Nothing End Function End Class End Namespace
Project Class | suite4.net.FormDatabase Namespace