/// <summary> /// The method/delegate that gets invoked when Send/Receive->View Messages is clicked /// </summary> /// <param name="commandObject">Includes the XML command element of the OnViewMessages message</param> /// <returns>true if the message was handled, false if there was an error or the call was deemed inappropriate.</returns> /// <remarks>If you change the name of this method, you need to check for calls to SendMessage("ViewMessages").</remarks> public bool OnViewMessages(object commandObject) { if (IsDb4oProject) { using (var dlg = new Db4oSendReceiveDialog()) { if (dlg.ShowDialog() == DialogResult.Abort) { // User clicked on link _mediator.SendMessage("FileProjectSharingLocation", null); } return true; } } bool dummy1; string dummy2; FLExBridgeHelper.FLExJumpUrlChanged += JumpToFlexObject; var success = FLExBridgeHelper.LaunchFieldworksBridge(Path.Combine(Cache.ProjectId.ProjectFolder, Cache.ProjectId.Name + FdoFileHelper.ksFwDataXmlFileExtension), SendReceiveUser, FLExBridgeHelper.ConflictViewer, null, FDOBackendProvider.ModelVersion, "0.13", null, BroadcastMasterRefresh, out dummy1, out dummy2); if (!success) { FLExBridgeHelper.FLExJumpUrlChanged -= JumpToFlexObject; ReportDuplicateBridge(); } return true; }
public bool OnFLExBridge(object commandObject) { if (!LinkedFilesLocationIsDefault()) { using (var dlg = new FwCoreDlgs.WarningNotUsingDefaultLinkedFilesLocation(_mediator.HelpTopicProvider)) { var result = dlg.ShowDialog(); if (result == DialogResult.Yes) { var app = (LexTextApp)_mediator.PropertyTable.GetValue("App"); var sLinkedFilesRootDir = app.Cache.LangProject.LinkedFilesRootDir; NonUndoableUnitOfWorkHelper.Do(app.Cache.ActionHandlerAccessor, () => { app.Cache.LangProject.LinkedFilesRootDir = FdoFileHelper.GetDefaultLinkedFilesDir( app.Cache.ProjectId.ProjectFolder); }); app.UpdateExternalLinks(sLinkedFilesRootDir); } } } // Make sure that there aren't multiple applications accessing the project // It is possible for a user to start up an application that accesses the // project after this check, but the application should not interfere with // the S/R operation. while (SharedBackendServices.AreMultipleApplicationsConnected(Cache)) { if (ThreadHelper.ShowMessageBox(null, LexEdStrings.ksSendReceiveNotPermittedMultipleAppsText, LexEdStrings.ksSendReceiveNotPermittedMultipleAppsCaption, MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning) == DialogResult.Cancel) { return true; } } StopParser(); SaveAllDataToDisk(); _mediator.PropertyTable.SetProperty("LastBridgeUsed", "FLExBridge", PropertyTable.SettingsGroup.LocalSettings); if (IsDb4oProject) { var dlg = new Db4oSendReceiveDialog(); if (dlg.ShowDialog() == DialogResult.Abort) { // User clicked on link _mediator.SendMessage("FileProjectSharingLocation", null); } return true; } string url; var projectFolder = Cache.ProjectId.ProjectFolder; var savedState = PrepareToDetectMainConflicts(projectFolder); string dummy; var fullProjectFileName = Path.Combine(projectFolder, Cache.ProjectId.Name + FdoFileHelper.ksFwDataXmlFileExtension); bool dataChanged; var success = FLExBridgeHelper.LaunchFieldworksBridge(fullProjectFileName, SendReceiveUser, FLExBridgeHelper.SendReceive, null, FDOBackendProvider.ModelVersion, "0.13", Cache.LangProject.DefaultVernacularWritingSystem.Id, null, out dataChanged, out dummy); if (!success) { ReportDuplicateBridge(); ProjectLockingService.LockCurrentProject(Cache); return true; } if (dataChanged) { bool conflictOccurred = DetectMainConflicts(projectFolder, savedState); var app = (LexTextApp)_mediator.PropertyTable.GetValue("App"); var newAppWindow = RefreshCacheWindowAndAll(app, fullProjectFileName); if (conflictOccurred) { // Send a message for the reopened instance to display the message viewer (used to be conflict report), // we have been disposed by now newAppWindow.Mediator.SendMessage("ViewMessages", null); } } else //Re-lock project if we aren't trying to close the app { ProjectLockingService.LockCurrentProject(Cache); } return true; }