private void GiveSimpleWarning(ExclusionReasonCode xrc) { // Tell the user why we aren't jumping to his record var msg = xWorksStrings.ksSelectedEntryNotInDict; string caption; string reason; string shlpTopic; switch (xrc) { case ExclusionReasonCode.NotInPublication: caption = xWorksStrings.ksEntryNotPublished; reason = xWorksStrings.ksEntryNotPublishedReason; shlpTopic = "User_Interface/Menus/Edit/Find_a_lexical_entry.htm"; //khtpEntryNotPublished break; case ExclusionReasonCode.ExcludedHeadword: caption = xWorksStrings.ksMainNotShown; reason = xWorksStrings.ksMainNotShownReason; shlpTopic = "khtpMainEntryNotShown"; break; case ExclusionReasonCode.ExcludedMinorEntry: caption = xWorksStrings.ksMinorNotShown; reason = xWorksStrings.ksMinorNotShownReason; shlpTopic = "khtpMinorEntryNotShown"; break; default: throw new ArgumentException("Unknown ExclusionReasonCode"); } msg = String.Format(msg, reason); // TODO-Linux: Help is not implemented on Mono MessageBox.Show(FindForm(), msg, caption, MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1, 0, m_mediator.HelpTopicProvider.HelpFile, HelpNavigator.Topic, shlpTopic); }
private bool IsObjectVisible(int hvoTarget, out ExclusionReasonCode xrc) { xrc = ExclusionReasonCode.NotExcluded; var objRepo = Cache.ServiceLocator.GetInstance<ICmObjectRepository>(); Debug.Assert(objRepo.IsValidObjectId(hvoTarget), "Invalid hvoTarget!"); if (!objRepo.IsValidObjectId(hvoTarget)) throw new ArgumentException("Unknown object."); var entry = objRepo.GetObject(hvoTarget) as ILexEntry; Debug.Assert(entry != null, "HvoTarget is not a LexEntry!"); if (entry == null) throw new ArgumentException("Target is not a LexEntry."); // Now we have our LexEntry // First deal with whether the active Publication excludes it. if (m_currentPublication != kallEntriesSelectedPublicationValue) { var currentPubPoss = Publication; if (!entry.PublishIn.Contains(currentPubPoss)) { xrc = ExclusionReasonCode.NotInPublication; return false; } // Second deal with whether the entry shouldn't be shown as a headword if (!entry.ShowMainEntryIn.Contains(currentPubPoss)) { xrc = ExclusionReasonCode.ExcludedHeadword; return false; } } // Third deal with whether the entry shouldn't be shown as a minor entry. // commented out until conditions are clarified (LT-11447) if (entry.EntryRefsOS.Count > 0 && !entry.PublishAsMinorEntry && IsRootBasedView) { xrc = ExclusionReasonCode.ExcludedMinorEntry; return false; } // If we get here, we should be able to display it. return true; }