private void DoValidation(bool refresh)
            {
                Form frm = FindForm();
                // frm may be null, if the record has been switched
                WaitCursor wc = null;

                try
                {
                    if (frm != null)
                    {
                        wc = new WaitCursor(frm);
                    }
                    ConstraintFailure failure;
                    m_env.CheckConstraints(PhEnvironmentTags.kflidStringRepresentation, true, out failure, /* adjust the squiggly line */ true);
                    // This will make the record list update to the new value.
                    if (refresh)
                    {
                        Mediator.BroadcastMessage("Refresh", null);
                    }
                }
                finally
                {
                    if (wc != null)
                    {
                        wc.Dispose();
                    }
                }
            }
 private void CloseDialogAndRefreshProject()
 {
     _view.Close();
     if (ConfigurationViewImported != null)
     {
         ConfigurationViewImported();
     }
     _mediator.BroadcastMessage("MasterRefresh", null);
 }
Ejemplo n.º 3
0
        /// <summary>
        /// The method/delegate that gets invoked when File->Send/Receive Project is clicked
        /// via the OnLiftBridge message
        /// </summary>
        /// <param name="argument">Includes the XML command element of the OnFLExBridge message</param>
        /// <returns>true if the message was handled, false if there was an error or the call was deemed inappropriate, or somebody shoudl also try to handle the message.</returns>
        public bool OnLiftBridge(object argument)
        {
            _mediator.PropertyTable.SetProperty("LastBridgeUsed", "LiftBridge", PropertyTable.SettingsGroup.LocalSettings);

            // Step 0. Try to move an extant lift repo from old location to new.
            if (!MoveOldLiftRepoIfNeeded())
            {
                return(true);
            }

            // Step 1. If notifier exists, re-try import (brutal or merciful, depending on contents of it).
            if (RepeatPriorFailedImportIfNeeded())
            {
                return(true);
            }

            // Step 2. Export lift file. If fails, then call into bridge with undo_export_lift and quit.
            if (!ExportLiftLexicon())
            {
                return(true);
            }


            // Step 3. Have Flex Bridge do the S/R.
            bool dataChanged;

            if (!DoSendReceiveForLift(out dataChanged))
            {
                return(true);                // Bail out, since the S/R failed for some reason.
            }
            // Step 4. Import lift file. If fails, then add the notifier file.
            if (!DoMercilessLiftImport(dataChanged))
            {
                return(true);
            }

            if (dataChanged)
            {
                _mediator.BroadcastMessage("MasterRefresh", null);
            }

            return(true);            // We dealt with it.
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Receives the broadcast message "JumpToRecord" before RecordClerk
 /// (because this is the active Control?), so we can see if we
 /// need to display a failure message.
 /// </summary>
 public bool OnJumpToRecord(object argument)
 {
     CheckDisposed();
     Mediator.BroadcastMessage("CheckJump", argument);
     return(false);            // I don't want to be seen as handling this!
 }
Ejemplo n.º 5
0
        private void m_MSAPopupTreeManager_AfterSelect(object sender, TreeViewEventArgs e)
        {
            // unless we get a mouse click or simulated mouse click (e.g. by ENTER or TAB),
            // do not treat as an actual selection.
            if (m_handlingMessage || e.Action != TreeViewAction.ByMouse)
            {
                return;
            }
            HvoTreeNode htn = e.Node as HvoTreeNode;

            if (htn == null)
            {
                return;
            }

            // Don't try changing values on a deleted object!  See LT-8656 and LT-9119.
            if (!m_cache.VerifyValidObject(m_obj))
            {
                return;
            }

            int hvoSel = htn.Hvo;

            // if hvoSel is negative, then MSAPopupTreeManager's AfterSelect has handled it,
            // except possibly for refresh.
            if (hvoSel < 0)
            {
                ContainingDataTree.RefreshList(false);
                return;
            }
            LexSense sense = m_obj as LexSense;
            // Setting sense.DummyMSA can cause the DataTree to want to refresh.  Don't
            // let this happen until after we're through!  See LT-9713 and LT-9714.
            bool fOldDoNotRefresh = ContainingDataTree.DoNotRefresh;

            try
            {
                m_handlingMessage = true;
                int clidSel = 0;
                if (hvoSel > 0)
                {
                    clidSel = m_cache.GetClassOfObject(hvoSel);
                }
                bool didChange = false;
                if (clidSel == PartOfSpeech.kclsidPartOfSpeech)
                {
                    ContainingDataTree.DoNotRefresh = true;
                    m_cache.BeginUndoTask(
                        String.Format(DetailControlsStrings.ksUndoSet, m_fieldName),
                        String.Format(DetailControlsStrings.ksRedoSet, m_fieldName));
                    DummyGenericMSA dummyMSA = new DummyGenericMSA();
                    dummyMSA.MsaType = sense.GetDesiredMsaType();
                    dummyMSA.MainPOS = hvoSel;
                    MoStemMsa stemMsa = sense.MorphoSyntaxAnalysisRA as MoStemMsa;
                    if (stemMsa != null)
                    {
                        dummyMSA.FromPartsOfSpeech = stemMsa.FromPartsOfSpeechRC;
                    }
                    sense.DummyMSA = dummyMSA;
                    didChange      = true;
                }
                else if (sense.MorphoSyntaxAnalysisRAHvo != hvoSel)
                {
                    ContainingDataTree.DoNotRefresh = true;
                    m_cache.BeginUndoTask(
                        String.Format(DetailControlsStrings.ksUndoSet, m_fieldName),
                        String.Format(DetailControlsStrings.ksRedoSet, m_fieldName));
                    sense.MorphoSyntaxAnalysisRAHvo = hvoSel;
                    didChange = true;
                }
                if (didChange)
                {
                    m_cache.EndUndoTask();
                }
                if (!ContainingDataTree.RefreshListNeeded)
                {
                    m_MSAPopupTreeManager.LoadPopupTree(sense.MorphoSyntaxAnalysisRAHvo);
                    // Don't refresh the datatree unless the popup has actually been loaded.
                    // It could be setting the selection in the process of loading!  See LT-9191.
                    if (m_MSAPopupTreeManager.IsTreeLoaded)
                    {
                        ContainingDataTree.RefreshList(false);
                    }
                }
            }
            finally
            {
                m_handlingMessage = false;
                // We still can't refresh the data at this point without causing a crash due to
                // a pending Windows message.  See LT-9713 and LT-9714.
                if (ContainingDataTree.DoNotRefresh != fOldDoNotRefresh)
                {
                    Mediator.BroadcastMessage("DelayedRefreshList", fOldDoNotRefresh);
                }
            }
        }