C# Class SIL.FieldWorks.FDO.DomainServices.Db4OLocalClientServerServices

The helper class that configures local servers in an FDO system where the backed can be either a Db4o backend that provides client-server services or a single-user XML-based backend.
Inheritance: ILocalClientServerServices
显示文件 Open project: sillsdev/FieldWorks Class Usage Examples

Private Properties

Property Type Description
ConvertAllProjectsToDb4o bool
ConvertAllProjectsToDb4o object
ConvertAllProjectsToXml bool
ConvertAllProjectsToXmlTask object
EnsureNoClientsAreConnected bool
EnsureNoClientsAreConnected bool
IsLocalServiceRunning bool
ReportConversionError void
WarnOfOtherConnectedClients bool

Public Methods

Method Description
ConvertToDb4oBackendIfNeeded ( IThreadedProgress progressDlg, string xmlFilename ) : string

Convert the specified project (assumed to be in the current Projects directory) to the current backend. This is used in Restore and New Project and when turning ShareMyProjects on.

CopyToXmlFile ( FdoCache source, string destDir ) : string

Copies the specified project (assumed to be in the current Projects directory) from the current backend to XML. This is used in Backup and when turning ShareMyProjects off. Returns the name of the temp file IF ANY; returns null if no copy was needed.

Db4OLocalClientServerServices ( IFdoUI ui, IFdoDirectories dirs ) : System
IdForLocalProject ( string projectName ) : string

Return the full ID that should be used to open the specified project, which is in the local projects directory. The input project name must NOT have an extension already.

ListConnectedClients ( string project ) : string[]

Finds all clients that are using specified project.

ListOpenProjects ( ) : string[]

Finds Client server projects that are in use.

ListRemoteConnectedClients ( string project ) : string[]

Finds all clients, except local host, that are using specified project.

RefreshProjectNames ( ) : void

Force the list of project names to be reloaded. (This is needed after deleting a project.)

SetProjectSharing ( bool fShare, IThreadedProgress progress ) : bool

Turns project sharing on or off.

WillProjectBeConverted ( string projectPath, string parentDirectory, string projectsDirectory ) : bool

Return true if the specified project (in the specified parent directory) will be converted as part of the process of converting the projects in projectsDirectory.

Private Methods

Method Description
ConvertAllProjectsToDb4o ( IThreadedProgress progressDlg ) : bool

Converts all projects to db4o.

ConvertAllProjectsToDb4o ( IThreadedProgress progress, object args ) : object
ConvertAllProjectsToXml ( IThreadedProgress progressDlg ) : bool

Converts all projects to XML.

ConvertAllProjectsToXmlTask ( IThreadedProgress progress, object args ) : object
EnsureNoClientsAreConnected ( ) : bool

If any clients are still connected to any shared projects, display connected clients to user and allow the user to either recheck (wait) or cancel. TODO: allow the user to force disconnect clients. TODO: prevent new connections while in this shutdown phase. TODO: as an enhancement connected clients could be messaged and asked to disconnect.

EnsureNoClientsAreConnected ( string projectName ) : bool

If any clients are still connected to the server file, display connected clients to user give the user an option to recheck (wait), or cancel. TODO: allow the user to force disconnect clients. TODO: prevent new connections while in this shutdown phase. TODO: as an enhancement connected clients could be messaged and asked to disconnect.

IsLocalServiceRunning ( ) : bool
ReportConversionError ( string projectPath, Exception e ) : void
WarnOfOtherConnectedClients ( string projectName, string connectedClientsMsg ) : bool

Warns the of other connected clients.

Method Details

ConvertToDb4oBackendIfNeeded() public method

Convert the specified project (assumed to be in the current Projects directory) to the current backend. This is used in Restore and New Project and when turning ShareMyProjects on.
public ConvertToDb4oBackendIfNeeded ( IThreadedProgress progressDlg, string xmlFilename ) : string
progressDlg IThreadedProgress The progress dialog (for getting a message box owner and/or /// ensuring we're invoking on the UI thread).
xmlFilename string The full path of the existing XML file for the project
return string

CopyToXmlFile() public method

Copies the specified project (assumed to be in the current Projects directory) from the current backend to XML. This is used in Backup and when turning ShareMyProjects off. Returns the name of the temp file IF ANY; returns null if no copy was needed.
public CopyToXmlFile ( FdoCache source, string destDir ) : string
source FdoCache The source cache
destDir string The destination directory for the converted copy if a /// conversion needs to be done.
return string

Db4OLocalClientServerServices() public method

public Db4OLocalClientServerServices ( IFdoUI ui, IFdoDirectories dirs ) : System
ui IFdoUI
dirs IFdoDirectories
return System

IdForLocalProject() public method

Return the full ID that should be used to open the specified project, which is in the local projects directory. The input project name must NOT have an extension already.
public IdForLocalProject ( string projectName ) : string
projectName string
return string

ListConnectedClients() public method

Finds all clients that are using specified project.
public ListConnectedClients ( string project ) : string[]
project string
return string[]

ListOpenProjects() public method

Finds Client server projects that are in use.
public ListOpenProjects ( ) : string[]
return string[]

ListRemoteConnectedClients() public method

Finds all clients, except local host, that are using specified project.
public ListRemoteConnectedClients ( string project ) : string[]
project string
return string[]

RefreshProjectNames() public method

Force the list of project names to be reloaded. (This is needed after deleting a project.)
public RefreshProjectNames ( ) : void
return void

SetProjectSharing() public method

Turns project sharing on or off.
public SetProjectSharing ( bool fShare, IThreadedProgress progress ) : bool
fShare bool if set to true, turn sharing on.
progress IThreadedProgress The progress dialog.
return bool

WillProjectBeConverted() public method

Return true if the specified project (in the specified parent directory) will be converted as part of the process of converting the projects in projectsDirectory.
public WillProjectBeConverted ( string projectPath, string parentDirectory, string projectsDirectory ) : bool
projectPath string
parentDirectory string
projectsDirectory string
return bool