Example #1
0
        /// <summary>
        /// The method/delegate that gets invoked when View->Conflict Report is clicked
        /// via the OnShowConflictReport message
        /// </summary>
        /// <param name="commandObject">Includes the XML command element of the OnShowConflictReport message</param>
        /// <returns>true if the message was handled, false if there was an error or the call was deemed inappropriate.</returns>
        public bool OnShowConflictReport(object commandObject)
        {
            if (IsDb4oProject)
            {
                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 + FwFileExtensions.ksFwDataXmlFileExtension),
                                                                  Environment.UserName,
                                                                  FLExBridgeHelper.ConflictViewer, null, out dummy1, out dummy2);

            if (!success)
            {
                FLExBridgeHelper.FLExJumpUrlChanged -= JumpToFlexObject;
                ReportDuplicateBridge();
            }
            return(true);
        }
Example #2
0
        public bool OnFLExBridge(object commandObject)
        {
            _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);
            }

            if (ChangeProjectNameIfNeeded())
            {
                return(true);
            }

            string url;
            var    projectFolder = Cache.ProjectId.ProjectFolder;
            var    savedState    = PrepareToDetectConflicts(projectFolder);
            string dummy;
            var    fullProjectFileName = Path.Combine(projectFolder, Cache.ProjectId.Name + FwFileExtensions.ksFwDataXmlFileExtension);
            bool   dataChanged;
            var    success = FLExBridgeHelper.LaunchFieldworksBridge(fullProjectFileName, Environment.UserName,
                                                                     FLExBridgeHelper.SendReceive, null, out dataChanged, out dummy);

            if (!success)
            {
                ReportDuplicateBridge();
                ProjectLockingService.LockCurrentProject(Cache);
                return(true);
            }

            if (dataChanged)
            {
                var fixer = new FwDataFixer(Cache.ProjectId.Path, new StatusBarProgressHandler(null, null), logger);
                fixer.FixErrorsAndSave();
                bool conflictOccurred = DetectConflicts(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 conflict report, we have been disposed by now
                    newAppWindow.Mediator.SendMessage("ShowConflictReport", null);
                }
            }
            else             //Re-lock project if we aren't trying to close the app
            {
                ProjectLockingService.LockCurrentProject(Cache);
            }
            return(true);
        }