/// <summary> /// Handle launching of the MSA editor. /// </summary> 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, m_propertyTable, 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); }); } } } }
/// <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(); } } } }