C# Класс SIL.FieldWorks.FieldWorks

Показать файл Открыть проект

Private Properties

Свойство Тип Описание
ArchiveProjectWithRamp List
BackupProject string
BackupProjectForRestore bool
CheckForMovingExternalLinkDirectory void
ChooseLangProject SIL.FieldWorks.ProjectId
CloseAllMainWindows void
CloseAllMainWindowsForApp void
CloseSplashScreen void
CommitAndDisposeCache object
ComplainToUserAboutNewWs bool
CopyDirectory void
CreateAndInitNewMainWindow bool
CreateApp bool
CreateCache SIL.FieldWorks.FDO.FdoCache
CreateFdoSettings SIL.FieldWorks.FDO.FdoSettings
CreateNewProject SIL.FieldWorks.ProjectId
CreateRemoteRequestListener void
CreateRequestor SIL.FieldWorks.RemoteRequest
DeleteProject void
DetermineProject SIL.FieldWorks.ProjectId
DisplayError bool
DisplayError bool
DoRestore void
EnsureValidLinkedFilesFolder void
EnsureValidLinkedFilesFolderCore void
ExecuteWithAllFwProcessesShutDown void
ExecuteWithAppsShutDown void
ExitCleanly void
ExitIfNoAppsRunning void
FieldWorks_OnSave void
FileProjectSharingLocation void
FollowLink void
FwMainWindowActivated void
FwMainWindowClosing void
GetAppFromAppNameOrAbbrev SIL.FieldWorks.Common.Framework.FwApp
GetAutoOpenRegistrySetting bool
GetAvailableLangsFromSatelliteDlls List
GetBestGuessProjectId SIL.FieldWorks.ProjectId
GetCommandLineAbbrevForAppName string
GetDefaultApp string
GetDriveMountList List
GetHelpTopicProvider IHelpTopicProvider
GetOrCreateApplication SIL.FieldWorks.Common.Framework.FwApp
GetOrCreateFlexApp SIL.FieldWorks.Common.Framework.FwApp
GetPreviousStartupStatus StartupStatus
GetProjectMatchStatus ProjectMatch
GetSampleProjectId SIL.FieldWorks.ProjectId
GracefullyShutDown void
GracefullyShutDownApp void
HandleLinkRequest void
HandleRestoreRequest void
HandleRestoreRequest void
HandleTopLevelError void
HandleUnhandledException void
InitializeApp bool
InitializeFirstApp bool
IsFieldWorksProjectFolder bool
IsFieldWorksSettingsFolder bool
IsInSingleFWProccessMode bool
IsSharedXmlBackendNeeded bool
KickOffAppFromOtherProcess void
LaunchApplicationFromCommandLine bool
LaunchProject bool
LaunchRestoreFromCommandLine void
Main int
MigrateProjectsTo70 bool
MoveExternalLinkDirectoryAndFiles void
MoveProjectFolders SIL.FieldWorks.ProjectId
MustCopyFoldersAndFiles bool
OpenExistingProject bool
OpenProjectWithNewProcess System.Diagnostics.Process
OpenProjectWithNewProcess System.Diagnostics.Process
ProjectNameChanged void
RecordLastAppForProject void
RenameProject bool
ReopenProject SIL.FieldWorks.Common.Framework.FwApp
ResetStateForForcedShutdown void
RestoreCurrentProject void
RestoreProject void
RestoreProject void
RunOnRemoteClients bool
SafelyReportException bool
SetGlobalExceptionHandler void
SetKeyboardForWs void
SetUICulture bool
SetupErrorPropertiesNeedingCache void
SetupErrorReportInformation void
ShowCommandLineHelp void
ShowSplashScreen void
ShowWelcomeDialog SIL.FieldWorks.ProjectId
ShutdownApp void
StaticDispose void
TryCommandLineOption bool
TryFindExistingProcess bool
TryFindLinkHandler bool
TryFindRestoreHandler bool
UglyHackForXkbIndicator void
UpdateProjectsLocation void
UpdateProjectsSharing bool
WarnUserAboutFailedLiftImportIfNecessary void
WriteExecutablePathSettingForDevs void
WriteSplashScreen void
longestFirst int

Открытые методы

Метод Описание
DoNothing ( ) : void

Dummy method to be used for InvokeOnEventsThread which is used as a way to initialize the Broadcast window and prevent errors on shutdown.

OpenNewProject ( SIL.FieldWorks.ProjectId projectId, string appName ) : bool

Opens the specified (newly-created) project. This may start a new FieldWorks.exe process to handle the project if no FieldWorks processes are running for the specified project.

ProjectsInUseLocally ( ) : List

Get a list of all projects (by ProjectName) currently open by processes on the local machine.

StartFwApp ( string appName ) : Process

Starts the specified FieldWorks application.

Приватные методы

Метод Описание
ArchiveProjectWithRamp ( Form dialogOwner, FwApp fwApp ) : List

Archive selected project files using RAMP

BackupProject ( Form dialogOwner, FwApp fwApp ) : string

Backup the project.

BackupProjectForRestore ( SIL.FieldWorks.FwRestoreProjectSettings restoreSettings, SIL.FieldWorks.FDO.FdoCache existingCache, Form dialogOwner ) : bool

Backs up the project that is about to be restored.

CheckForMovingExternalLinkDirectory ( FwApp app ) : void
ChooseLangProject ( Form dialogOwner, IHelpTopicProvider helpTopicProvider ) : SIL.FieldWorks.ProjectId
CloseAllMainWindows ( ) : void

Close any main windows. This is needed to implement changing the projects folder location when multiple projects are running. (See FWR-2287.)

CloseAllMainWindowsForApp ( FwApp app ) : void

Closes all main windows for the specified application ignoring any errors that occur.

CloseSplashScreen ( ) : void

Closes the splash screen

CommitAndDisposeCache ( IThreadedProgress progressDlg, object parameters ) : object

Commits the and disposes the FdoCache. This is usually called on a separate thread.

ComplainToUserAboutNewWs ( string wsLabel, string projectName ) : bool
CopyDirectory ( string oldDir, string newDir ) : void

Copies all files and folders in the specified old directory to the specified new directory

CreateAndInitNewMainWindow ( FwApp app, bool fNewCache, Form wndCopyFrom, bool fOpeningNewProject ) : bool

Creates a new main window and initializes it. The specified App is responsible for creating the proper main window type.

CreateApp ( SIL.FieldWorks.Common.FwUtils.FwAppArgs appArgs ) : bool
CreateCache ( SIL.FieldWorks.ProjectId projectId ) : SIL.FieldWorks.FDO.FdoCache
CreateFdoSettings ( ) : FdoSettings
CreateNewProject ( Form dialogOwner, FwApp app, IHelpTopicProvider helpTopicProvider ) : SIL.FieldWorks.ProjectId

Lets the user create a new project

CreateRemoteRequestListener ( ) : void

Creates a remoting server to listen for events from other instances.

CreateRequestor ( int port, string requestType ) : SIL.FieldWorks.RemoteRequest

Remote request calls can hang if the service is no longer active but the port is still in the listening state. This method calls the IsAlive method on the requestor to verify that it is valid.

DeleteProject ( Form dialogOwner, IHelpTopicProvider helpTopicProvider ) : void

Lets the user delete any FW databases that are not currently open

DetermineProject ( SIL.FieldWorks.Common.FwUtils.FwAppArgs args ) : SIL.FieldWorks.ProjectId
DisplayError ( Exception exception, IFwMainWnd parent ) : bool

Displays the error.

DisplayError ( Exception exception, bool fTerminating ) : bool

Shows the error message of the exception to the user.

DoRestore ( SIL.FieldWorks.FDO.DomainServices.BackupRestore.ProjectRestoreService restoreService ) : void

Does the restore.

EnsureValidLinkedFilesFolder ( SIL.FieldWorks.FDO.FdoCache cache ) : void

Ensure a valid folder for LangProject.LinkedFilesRootDir. When moving projects between systems, the stored value may become hopelessly invalid. See FWNX-1005 for an example of the havoc than can ensue.

This method gets called when we open the FDO cache.

EnsureValidLinkedFilesFolderCore ( string linkedFilesFolder, string defaultLinkedFilesFolder ) : void

Create the specified Linked Files directory only if it's the default Linked Files directory. See FWNX-1092, LT-14491.

ExecuteWithAllFwProcessesShutDown ( string abbrevOfDefaultAppToStart, Func action ) : void

Executes the requested action with ALL FW applications temporarily shut down and then (re)starts the applications in a sensible order. At the end, we're guaranteed to have at least one app started or FieldWorks will be shut down.

ExecuteWithAppsShutDown ( string abbrevOfDefaultAppToStart, Func action ) : void

Executes the requested action with all FW applications temporarily shut down and then (re)starts the applications in a sensible order. At the end, we're guaranteed to have at least one app started or FieldWorks will be shut down.

ExitCleanly ( ) : void

Cleanly exits the FieldWorks process

ExitIfNoAppsRunning ( ) : void

If no applications are running anymore, just shut down the whole process

FieldWorks_OnSave ( object sender, SaveEventArgs e ) : void
FileProjectSharingLocation ( Form dialogOwner, FwApp fwApp ) : void

Displays the Project Location Sharing dialog box

FollowLink ( SIL.FieldWorks.Common.FwUtils.FwAppArgs link ) : void

Follows the specified link request for this project.

FwMainWindowActivated ( object sender, EventArgs e ) : void

Handles the Activated event of FieldWorks Main Windows.

FwMainWindowClosing ( object sender, CancelEventArgs e ) : void

Handles the Closing event of FieldWorks Main Windows.

GetAppFromAppNameOrAbbrev ( string appNameOrAbbrev ) : FwApp

Gets the application for the specified application name or abbreviation.

GetAutoOpenRegistrySetting ( FwApp app ) : bool
GetAvailableLangsFromSatelliteDlls ( ) : List

Get the available localizations.

GetBestGuessProjectId ( string latestProject, string latestServer ) : SIL.FieldWorks.ProjectId
GetCommandLineAbbrevForAppName ( string appName ) : string

Gets the command-line abbreviation for the specified application name.

GetDefaultApp ( SIL.FieldWorks.Common.FwUtils.FwAppArgs args ) : string

Gets the default application to start for the project specified in the the command-line arguments.

GetDriveMountList ( ) : List
GetHelpTopicProvider ( string appAbbrev ) : IHelpTopicProvider

Gets a HelpTopicProvider for the specified application if possible. Falls back to getting the HelpTopicProvider for another application if the requested one is not installed. Will not return null (but it could throw an exception if no FW app is installed).

GetOrCreateApplication ( SIL.FieldWorks.Common.FwUtils.FwAppArgs args ) : FwApp

Gets an existing app or creates a new one for the application type specified on the command line.

GetOrCreateFlexApp ( ) : FwApp

Get or create a FLEx application. This method does not ensure that the returned application is fully initialized.

GetPreviousStartupStatus ( FwApp app ) : StartupStatus

Gets the status of the previous attempt to startup the specified application.

GetProjectMatchStatus ( SIL.FieldWorks.ProjectId projectId ) : ProjectMatch

Determines the match status for the project used by this FieldWorks process and the specified project. This method is thread-safe.

GetSampleProjectId ( FwApp app ) : SIL.FieldWorks.ProjectId
GracefullyShutDown ( ) : void

Attempts to shut down as nicely as possible. Typically this method doesn't do anything when the application is shut down normally (e.g. the user has closed all of the open main windows) because the applications will have already been disposed of. Thus, any exceptions that are thrown are ignored by this method as there is no guarantee that the application is in a valid state.

Any exeptions that are thrown are logged to the log file.

GracefullyShutDownApp ( FwApp app ) : void

Attempts to shut down the specified application as nicely as possible ignoring any errors that occur.

HandleLinkRequest ( SIL.FieldWorks.Common.FwUtils.FwAppArgs link ) : void

Handles a link request. This handles determining the correct application to start up and for the correct project. This method is thread safe.

HandleRestoreRequest ( Form dialogOwner, SIL.FieldWorks.FwRestoreProjectSettings restoreSettings ) : void

Handles a request to restore a project. This method is thread safe.

HandleRestoreRequest ( SIL.FieldWorks.FwRestoreProjectSettings restoreSettings ) : void

Handles a request to restore a project. This method is thread safe.

HandleTopLevelError ( object sender, ThreadExceptionEventArgs eventArgs ) : void

Catches and displays a otherwise unhandled exception.

previously AfApp::HandleTopLevelError

HandleUnhandledException ( object sender, UnhandledExceptionEventArgs e ) : void

Catches and displays otherwise unhandled exception, especially those that happen during startup of the application before we show our main window.

InitializeApp ( FwApp app, IThreadedProgress progressDlg ) : bool

Initializes the specified application and creates a new main window for it. Also does application-specific cache initialization.

InitializeFirstApp ( FwApp app, SIL.FieldWorks.ProjectId projectId ) : bool
IsFieldWorksProjectFolder ( string projectFolder ) : bool

Return true if a folder belongs to FieldWorks, that is, it is one that we recognize has having a proper place in the Projects folder.

IsFieldWorksSettingsFolder ( string projectFolder ) : bool
IsInSingleFWProccessMode ( ) : bool

Determines whether any FW process is in "single user mode".

IsSharedXmlBackendNeeded ( SIL.FieldWorks.ProjectId projectId ) : bool
KickOffAppFromOtherProcess ( SIL.FieldWorks.Common.FwUtils.FwAppArgs args ) : void

Starts or activates an application requested from another process. This method is thread safe. See the class comment on FwLinkArgs for details on how all the parts of hyperlinking work.

LaunchApplicationFromCommandLine ( SIL.FieldWorks.Common.FwUtils.FwAppArgs appArgs ) : bool

Launches the application when requested from the command-line.

LaunchProject ( SIL.FieldWorks.Common.FwUtils.FwAppArgs args, SIL.FieldWorks.ProjectId &projectId ) : bool
LaunchRestoreFromCommandLine ( SIL.FieldWorks.Common.FwUtils.FwAppArgs appArgs ) : void

Launches a restore project when requested from the command-line.

Main ( string rgArgs ) : int
MigrateProjectsTo70 ( ) : bool

Migrates the user's databases to FieldWorks 7.0+ if they haven't yet migrated successfully (and the user actually wants to migrate).

MoveExternalLinkDirectoryAndFiles ( FwApp app ) : void

Moves the external link directory and files to the new FW 7.0 or later location.

MoveProjectFolders ( string oldFolderForProjects, string newFolderForProjects, string projectPath, SIL.FieldWorks.ProjectId oldProjectId ) : SIL.FieldWorks.ProjectId

Moves all of the projects in the specified old project folder (including any subfolders) to the specified new project folder.

MustCopyFoldersAndFiles ( string oldFolderForProjects, string newFolderForProjects ) : bool

Check whether we must copy the project folders and files because the new Projects folder is on a different device than the old Projects folder.

OpenExistingProject ( SIL.FieldWorks.ProjectId projectId, FwApp app, Form wndCopyFrom ) : bool

Opens the specified project. This may start a new FieldWorks.exe process to handle the project if no FieldWorks processes are running for the specified project.

OpenProjectWithNewProcess ( SIL.FieldWorks.ProjectId project, string appAbbrev ) : Process

Opens the specified project by starting a new FieldWorks.exe process.

OpenProjectWithNewProcess ( string projectType, string projectName, string server, string appAbbrev ) : Process

Opens the specified project by starting a new FieldWorks.exe process.

ProjectNameChanged ( SIL.FieldWorks.FDO.FdoCache sender ) : void

Handles a project name change.

RecordLastAppForProject ( ) : void

Records the last running application for the current project.

RenameProject ( string dbNewName, FwApp app ) : bool

Rename the database.

ReopenProject ( string project, SIL.FieldWorks.Common.FwUtils.FwAppArgs appArgs ) : FwApp

Returns some active, non-disposed application if possible, otherwise, null. Currently Flex is preferred if both are re-opened.

ResetStateForForcedShutdown ( ) : void

Resets the state of FieldWorks to allow a forced shutdown. Should only be called when a lethal unhandled exception is thrown.

RestoreCurrentProject ( SIL.FieldWorks.FwRestoreProjectSettings restoreSettings, Form dialogOwner ) : void

Restores from the backup specified in restoreSettings, replacing the current version of this project (requires restarting apps and the cache).

RestoreProject ( Form dialogOwner, FwApp fwApp ) : void

Restore a project.

RestoreProject ( Form dialogOwner, string backupFile ) : void

Restore a project.

RunOnRemoteClients ( string requestType, bool>.Func whatToRun ) : bool

Runs the specified delegate on any other FieldWorks processes that are found. If no other FieldWorks processes are found, then the delegate is not called.

SafelyReportException ( Exception error, IFwMainWnd parent, bool isLethal ) : bool
SetGlobalExceptionHandler ( ) : void

Sets the exception handler.

SetKeyboardForWs ( int ws ) : void
SetUICulture ( SIL.FieldWorks.Common.FwUtils.FwAppArgs args ) : bool

Sets the UI culture.

SetupErrorPropertiesNeedingCache ( SIL.FieldWorks.FDO.FdoCache cache ) : void

Sets information about the current database to the ErrorReporter so that it can be reported with a crash.

SetupErrorReportInformation ( ) : void
ShowCommandLineHelp ( ) : void

Shows help for command line options.

ShowSplashScreen ( FwApp app ) : void

Displays the splash screen

ShowWelcomeDialog ( SIL.FieldWorks.Common.FwUtils.FwAppArgs args, FwApp startingApp, SIL.FieldWorks.ProjectId lastProjectId, SIL.CoreImpl.StartupException exception ) : SIL.FieldWorks.ProjectId
ShutdownApp ( FwApp app, bool fSaveSettings ) : void

Shutdowns the specified application. The application will be disposed of immediately. If no other applications are running, then FieldWorks will also be shutdown.

StaticDispose ( ) : void

Releases unmanaged and managed resources

TryCommandLineOption ( ProjectId projId, StartupException &exception ) : bool

Returns true if valid command-line args created this projectId. Returns false with no exception if no -db arg was given. Returns false with exception if invalid args were given.

TryFindExistingProcess ( ProjectId project, FwAppArgs args ) : bool

Tries to find an existing FieldWorks process that is running the specified project. See the class comment on FwLinkArgs for details on how all the parts of hyperlinking work.

TryFindLinkHandler ( FwAppArgs link ) : bool

Attempts to find another FieldWorks process that can handle the specified link.

TryFindRestoreHandler ( FwRestoreProjectSettings settings ) : bool

Attempts to find another FieldWorks process that can handle a restore for the specified restore project settings.

UglyHackForXkbIndicator ( ) : void

For some reason, setting an Xkb keyboard for the first time doesn't work well inside FieldWorks. The keyboard is actually set (although it may take effect only after the first one or two keystrokes), but the indicator on the system icon bar does not change. Setting several Xkb keyboards at this point seems to fix the problem for when the first one is set different than the default keyboard. This hack is not guaranteed to work, but it does seem to help in most scenarios. See FWNX-1299.

If you can think of a better solution, by all means replace this ugly hack! It took me a day of work to come up with even this much. I tried setting the multiple keyboards in succession inside Palaso.UI.WindowsForms.Keyboarding.Linux.XkbKeyboardAdaptor.ReinitLocales() but it didn't work doing it there for some reason.

UpdateProjectsLocation ( string newFolderForProjects, FwApp fwApp, string projectPath ) : void

Updates the projects default directory.

UpdateProjectsSharing ( bool fShareProjects, Form dialogOwner, FwApp fwApp, string projectPath, string parentDirectory, string projectsDirectory ) : bool

Attempts to turn project sharing on or off if not already in the requested mode.

WarnUserAboutFailedLiftImportIfNecessary ( FwApp fwApp ) : void
WriteExecutablePathSettingForDevs ( ) : void

Writes the current executable path to the registry. This is used for external applications to read on developer machines since the RootCodeDir on developer's machines point to distfiles.

WriteSplashScreen ( string msg ) : void

Write to the splash screen

longestFirst ( string a, string b ) : int

Compare the strings first by length (longest first), then normally if the lengths are equal.

Описание методов

DoNothing() публичный статический метод

Dummy method to be used for InvokeOnEventsThread which is used as a way to initialize the Broadcast window and prevent errors on shutdown.
public static DoNothing ( ) : void
Результат void

OpenNewProject() публичный статический метод

Opens the specified (newly-created) project. This may start a new FieldWorks.exe process to handle the project if no FieldWorks processes are running for the specified project.
public static OpenNewProject ( SIL.FieldWorks.ProjectId projectId, string appName ) : bool
projectId SIL.FieldWorks.ProjectId The project id.
appName string The application name (either Translation Editor or /// Language Explorer).
Результат bool

ProjectsInUseLocally() публичный статический метод

Get a list of all projects (by ProjectName) currently open by processes on the local machine.
public static ProjectsInUseLocally ( ) : List
Результат List

StartFwApp() публичный статический метод

Starts the specified FieldWorks application.
public static StartFwApp ( string appName ) : Process
appName string Name of the application.
Результат Process