protected override void HandleChooser() { // grammar/phonemes/phonological features/[...] (click chooser button) using (PhonologicalFeatureChooserDlg dlg = new PhonologicalFeatureChooserDlg()) { IFsFeatStruc originalFs = null; Slice parentSlice = Slice; int parentSliceClass = parentSlice.Object.ClassID; int owningFlid = (parentSlice as PhonologicalFeatureListDlgLauncherSlice).Flid; switch (parentSliceClass) { case PhPhonemeTags.kClassId: IPhPhoneme phoneme = parentSlice.Object as IPhPhoneme; if (phoneme.FeaturesOA != null) { originalFs = phoneme.FeaturesOA; } break; case PhNCFeaturesTags.kClassId: IPhNCFeatures features = parentSlice.Object as IPhNCFeatures; if (features.FeaturesOA != null) { originalFs = features.FeaturesOA; } break; } if (originalFs == null) { dlg.SetDlgInfo(m_cache, m_mediator, parentSlice.Object, owningFlid); } else { dlg.SetDlgInfo(m_cache, m_mediator, originalFs); } DialogResult result = dlg.ShowDialog(parentSlice.FindForm()); if (result == DialogResult.OK) { if (dlg.FS != null) { m_obj = dlg.FS; m_PhonologicalFeatureListDlgLauncherView.UpdateFS(dlg.FS); } } else if (result != DialogResult.Cancel) { dlg.HandleJump(); } } }
/// <summary> /// Handle launching of the phonological feature editor. /// </summary> protected override void HandleChooser() { VectorReferenceLauncher vrl = null; using (PhonologicalFeatureChooserDlg dlg = new PhonologicalFeatureChooserDlg()) { IFsFeatStruc originalFs = null; Slice parentSlice = Slice; int parentSliceClass = parentSlice.Object.ClassID; int owningFlid = (parentSlice as PhonologicalFeatureListDlgLauncherSlice).Flid; switch (parentSliceClass) { case PhPhoneme.kclsidPhPhoneme: IPhPhoneme phoneme = parentSlice.Object as IPhPhoneme; if (phoneme.FeaturesOAHvo != 0) { originalFs = phoneme.FeaturesOA; } break; case PhNCFeatures.kclsidPhNCFeatures: IPhNCFeatures features = parentSlice.Object as IPhNCFeatures; if (features.FeaturesOAHvo != 0) { originalFs = features.FeaturesOA; } break; } int longNameOldLen = 0; if (originalFs != null && originalFs.LongName != null) { longNameOldLen = originalFs.LongName.Length; } if (originalFs == null) { dlg.SetDlgInfo(m_cache, m_mediator, parentSlice.Object, owningFlid); } else { dlg.SetDlgInfo(m_cache, m_mediator, originalFs); } DialogResult result = dlg.ShowDialog(parentSlice.FindForm()); if (result == DialogResult.OK) { if (dlg.FS != null) { int tagLongName = m_cache.VwCacheDaAccessor.GetVirtualHandlerName("FsFeatStruc", "LongNameTSS").Tag; m_obj = dlg.FS; m_cache.PropChanged(null, PropChangeType.kpctNotifyAll, parentSlice.Object.Hvo, owningFlid, 0, 1, 0); m_PhonologicalFeatureListDlgLauncherView.UpdateFS(dlg.FS); dlg.FS.UpdateFeatureLongName(tagLongName, longNameOldLen); } } else if (result != DialogResult.Cancel) { if (vrl == null) { dlg.HandleJump(); } else { vrl.HandleExternalChooser(); } } } }