Пример #1
0
        private bool EditExistingMsa()
        {
            PopupTree pt = GetPopupTree();

            // Force the PopupTree to Hide() to trigger popupTree_PopupTreeClosed().
            // This will effectively revert the list selection to a previous confirmed state.
            // Whatever happens below, we don't want to actually leave the "Modify ..." node selected!
            // This is at least required if the user selects "Cancel" from the dialog below.
            if (m_sense.MorphoSyntaxAnalysisRA != null)
            {
                pt.SelectObj(m_sense.MorphoSyntaxAnalysisRA.Hvo);
            }
#if __MonoCS__
            // If Popup tree is shown whilest the dialog is shown, the first click on the dialog is consumed by the
            // Popup tree, (and closes it down). On .NET the PopupTree appears to be automatically closed.
            pt.HideForm();
#endif
            SandboxGenericMSA dummyMsa = SandboxGenericMSA.Create(m_sense.MorphoSyntaxAnalysisRA);
            using (MsaCreatorDlg dlg = new MsaCreatorDlg())
            {
                dlg.SetDlgInfo(Cache, m_persistProvider, m_mediator, m_sense.Entry, dummyMsa,
                               m_sense.MorphoSyntaxAnalysisRA.Hvo, true, m_sEditGramFunc);
                if (dlg.ShowDialog(ParentForm) == DialogResult.OK)
                {
                    Cache.DomainDataByFlid.BeginUndoTask(String.Format(LexTextControls.ksUndoSetX, FieldName),
                                                         String.Format(LexTextControls.ksRedoSetX, FieldName));
                    m_sense.SandboxMSA = dlg.SandboxMSA;
                    Cache.DomainDataByFlid.EndUndoTask();
                    LoadPopupTree(m_sense.MorphoSyntaxAnalysisRA.Hvo);
                    return(true);
                }
            }
            return(false);
        }
Пример #2
0
		private bool EditExistingMsa()
		{
			PopupTree pt = GetPopupTree();
			// Force the PopupTree to Hide() to trigger popupTree_PopupTreeClosed().
			// This will effectively revert the list selection to a previous confirmed state.
			// Whatever happens below, we don't want to actually leave the "Modify ..." node selected!
			// This is at least required if the user selects "Cancel" from the dialog below.
			pt.Hide();
			DummyGenericMSA dummyMsa = DummyGenericMSA.Create(m_sense.MorphoSyntaxAnalysisRA);
			using (MsaCreatorDlg dlg = new MsaCreatorDlg())
			{
				dlg.SetDlgInfo(Cache, m_persistProvider, m_mediator, m_sense.Entry, dummyMsa,
					m_sense.MorphoSyntaxAnalysisRAHvo, true, m_sEditGramFunc);
				if (dlg.ShowDialog(ParentForm) == DialogResult.OK)
				{
					Cache.BeginUndoTask(String.Format(LexTextControls.ksUndoSetX, FieldName),
						String.Format(LexTextControls.ksRedoSetX, FieldName));
					(m_sense as LexSense).DummyMSA = dlg.DummyMSA;
					Cache.EndUndoTask();
					LoadPopupTree(m_sense.MorphoSyntaxAnalysisRAHvo);
					return true;
				}
			}
			return false;
		}
Пример #3
0
		/// <summary>
		/// Handle launching of the MSA editor.
		/// </summary>
		protected override void HandleChooser()
		{
			using (MsaCreatorDlg dlg = new MsaCreatorDlg())
			{
				MoMorphSynAnalysis originalMsa = m_obj as MoMorphSynAnalysis;
				ILexEntry entry = LexEntry.CreateFromDBObject(m_cache, originalMsa.OwnerHVO);
				dlg.SetDlgInfo(m_cache,
					m_persistProvider,
					m_mediator,
					entry,
					DummyGenericMSA.Create(originalMsa),
					originalMsa.Hvo,
					true,
					String.Format(LexEdStrings.ksEditX, Slice.Label));
				if (dlg.ShowDialog(FindForm()) == DialogResult.OK)
				{
					DummyGenericMSA dummyMsa = dlg.DummyMSA;
					if (!originalMsa.EqualsMsa(dummyMsa))
					{
						m_cache.BeginUndoTask(LexEdStrings.ksUndoEditFunction,
							LexEdStrings.ksRedoEditFunction);
						// The UpdateOrReplace call may end up disposing this. So any variables we
						// need after it must be copied to the stack.
						FdoCache cache = m_cache;
						Slice parent = Slice;
						IMoMorphSynAnalysis newMsa = originalMsa.UpdateOrReplace(dummyMsa);
						cache.EndUndoTask();
					}
				}
			}
		}
Пример #4
0
		protected override void HandleChooser()
		{
			using (MsaCreatorDlg dlg = new MsaCreatorDlg())
			{
				IMoMorphSynAnalysis originalMsa = m_obj as IMoMorphSynAnalysis;
				ILexEntry entry = originalMsa.Owner as ILexEntry;
				dlg.SetDlgInfo(m_cache,
					m_persistProvider,
					m_mediator,
					entry,
					SandboxGenericMSA.Create(originalMsa),
					originalMsa.Hvo,
					true,
					String.Format(LexEdStrings.ksEditX, Slice.Label));
				if (dlg.ShowDialog(FindForm()) == DialogResult.OK)
				{
					SandboxGenericMSA sandboxMsa = dlg.SandboxMSA;
					if (!originalMsa.EqualsMsa(sandboxMsa))
					{
						UndoableUnitOfWorkHelper.Do(LexEdStrings.ksUndoEditFunction, LexEdStrings.ksRedoEditFunction, entry, () =>
						{
							originalMsa.UpdateOrReplace(sandboxMsa);
						});
					}
				}
			}
		}
Пример #5
0
		private bool EditExistingMsa()
		{
			PopupTree pt = GetPopupTree();
			// Force the PopupTree to Hide() to trigger popupTree_PopupTreeClosed().
			// This will effectively revert the list selection to a previous confirmed state.
			// Whatever happens below, we don't want to actually leave the "Modify ..." node selected!
			// This is at least required if the user selects "Cancel" from the dialog below.
			if (m_sense.MorphoSyntaxAnalysisRA != null)
				pt.SelectObj(m_sense.MorphoSyntaxAnalysisRA.Hvo);
#if __MonoCS__
			// If Popup tree is shown whilest the dialog is shown, the first click on the dialog is consumed by the
			// Popup tree, (and closes it down). On .NET the PopupTree appears to be automatically closed.
			pt.HideForm();
#endif
			SandboxGenericMSA dummyMsa = SandboxGenericMSA.Create(m_sense.MorphoSyntaxAnalysisRA);
			using (MsaCreatorDlg dlg = new MsaCreatorDlg())
			{
				dlg.SetDlgInfo(Cache, m_persistProvider, m_mediator, m_sense.Entry, dummyMsa,
					m_sense.MorphoSyntaxAnalysisRA.Hvo, true, m_sEditGramFunc);
				if (dlg.ShowDialog(ParentForm) == DialogResult.OK)
				{
					Cache.DomainDataByFlid.BeginUndoTask(String.Format(LexTextControls.ksUndoSetX, FieldName),
						String.Format(LexTextControls.ksRedoSetX, FieldName));
					m_sense.SandboxMSA = dlg.SandboxMSA;
					Cache.DomainDataByFlid.EndUndoTask();
					LoadPopupTree(m_sense.MorphoSyntaxAnalysisRA.Hvo);
					return true;
				}
			}
			return false;
		}