/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:MultipleFilterDlg"/> class. /// </summary> /// ------------------------------------------------------------------------------------ public MultipleFilterDlg(FdoCache cache, ICmFilter filter) : this() { m_cache = cache; m_scr = (Scripture)cache.LangProject.TranslatedScriptureOA; m_filter = filter; // Initialize the enabled status of the group boxes. chkStatus_CheckedChanged(null, null); chkType_CheckedChanged(null, null); chkScrRange_CheckedChanged(null, null); // Initialize the beginning and ending default Scripture references. int firstBook = 1; int lastBook = ScrReference.LastBook; if (m_scr.ScriptureBooksOS.Count > 0) { firstBook = m_scr.ScriptureBooksOS[0].CanonicalNum; lastBook = m_scr.ScriptureBooksOS[m_scr.ScriptureBooksOS.Count - 1].CanonicalNum; } scrBookFrom.Initialize(new ScrReference(firstBook, 1, 1, m_scr.Versification), m_scr, false); scrBookTo.Initialize(new ScrReference(lastBook, 1, 0, m_scr.Versification).LastReferenceForBook, m_scr, false); // Update the controls from the filter in the database. InitializeFromFilter(); chkCategory.Checked = tvCatagories.Load(m_cache, m_filter, null); chkCategory_CheckedChanged(null, null); }
public void BuildCmFilter2() { // Setup test values Cache.LangProject.PeopleOA = Cache.ServiceLocator.GetInstance <ICmPossibilityListFactory>().Create(); ICmPossibility person1 = Cache.ServiceLocator.GetInstance <ICmPersonFactory>().Create(); Cache.LangProject.PeopleOA.PossibilitiesOS.Add(person1); person1.ForeColor = 5; person1.BackColor = 10; // Setup filter ILcmOwningCollection <ICmFilter> filtersCol = Cache.LangProject.FiltersOC; ICmFilter filter = Cache.ServiceLocator.GetInstance <ICmFilterFactory>().Create(); filtersCol.Add(filter); filter.ColumnInfo = CmPossibilityTags.kClassId + "," + CmPossibilityTags.kflidForeColor + "|" + CmPossibilityTags.kClassId + "," + CmPossibilityTags.kflidBackColor; ICmRow row = Cache.ServiceLocator.GetInstance <ICmRowFactory>().Create(); filter.RowsOS.Add(row); ICmCell cell1 = Cache.ServiceLocator.GetInstance <ICmCellFactory>().Create(); row.CellsOS.Add(cell1); cell1.Contents = MakeString("= 5"); ICmCell cell2 = Cache.ServiceLocator.GetInstance <ICmCellFactory>().Create(); row.CellsOS.Add(cell2); cell2.Contents = MakeString("= 10"); // Check the result filter.InitCriteria(); Assert.IsTrue(filter.MatchesCriteria(person1.Hvo)); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Implement CreateTestData, called by InMemoryLcmTestBase set up. /// </summary> /// ------------------------------------------------------------------------------------ protected override void CreateTestData() { var servloc = Cache.ServiceLocator; ICmPossibilityFactory possibilityFactory = servloc.GetInstance <ICmPossibilityFactory>(); // Add an annotation category (for Discourse) m_categoryDiscourse = possibilityFactory.Create(); var affixCatList = servloc.GetInstance <ICmPossibilityListFactory>().Create(); Cache.LangProject.AffixCategoriesOA = affixCatList; affixCatList.PossibilitiesOS.Add(m_categoryDiscourse); // Add an annotation category (for Grammar) m_categoryGrammar = possibilityFactory.Create(); affixCatList.PossibilitiesOS.Add(m_categoryGrammar); // add a sub-annotation category (for "Pronominal reference") m_categoryGrammar_PronominalRef = possibilityFactory.Create(); m_categoryGrammar.SubPossibilitiesOS.Add(m_categoryGrammar_PronominalRef); // Set up a filter, with a CmCell we can test on. ICmFilter filter = servloc.GetInstance <ICmFilterFactory>().Create(); Cache.LangProject.FiltersOC.Add(filter); ICmRow row = servloc.GetInstance <ICmRowFactory>().Create(); filter.RowsOS.Add(row); m_cell = servloc.GetInstance <ICmCellFactory>().Create(); row.CellsOS.Add(m_cell); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="T:MultipleFilterDlg"/> class. /// </summary> /// ------------------------------------------------------------------------------------ public MultipleFilterDlg(FdoCache cache, IHelpTopicProvider helpTopicProviderp, ICmFilter filter) : this() { m_helpTopicProvider = helpTopicProviderp; m_cache = cache; m_cellFactory = m_cache.ServiceLocator.GetInstance <ICmCellFactory>(); m_scr = m_cache.LangProject.TranslatedScriptureOA; m_filter = filter; // Initialize the enabled status of the group boxes. chkStatus_CheckedChanged(null, null); chkType_CheckedChanged(null, null); chkScrRange_CheckedChanged(null, null); // Initialize the beginning and ending default Scripture references. int firstBook = 1; int lastBook = BCVRef.LastBook; if (m_scr.ScriptureBooksOS.Count > 0) { firstBook = m_scr.ScriptureBooksOS[0].CanonicalNum; lastBook = m_scr.ScriptureBooksOS[m_scr.ScriptureBooksOS.Count - 1].CanonicalNum; } scrBookFrom.Initialize(new ScrReference(firstBook, 1, 1, m_scr.Versification)); scrBookTo.Initialize(new ScrReference(lastBook, 1, 0, m_scr.Versification).LastReferenceForBook); // Update the controls from the filter in the database. InitializeFromFilter(); chkCategory.Checked = tvCatagories.Load(m_cache, m_filter, null); chkCategory_CheckedChanged(null, null); }
public void MergeGuids() { CheckDisposed(); // Use LangProject.Filters. FdoOwningCollection<ICmFilter> filtersCol = Cache.LangProject.FiltersOC; ICmFilter keeper = filtersCol.Add(new CmFilter()); ICmFilter src = filtersCol.Add(new CmFilter()); // Ensure empty (new) guid does not get changed. Assert.IsTrue(keeper.App == Guid.Empty); src.App = Guid.NewGuid(); Guid oldSrcGuid = src.App; keeper.MergeObject(src); Assert.IsTrue(keeper.App == oldSrcGuid); // Should not change extant guid in either of the next two checks. Guid newGuid = Guid.NewGuid(); keeper.App = newGuid; src = filtersCol.Add(new CmFilter()); src.App = Guid.NewGuid(); keeper.MergeObject(src); Assert.IsTrue(keeper.App == newGuid); src = filtersCol.Add(new CmFilter()); src.App = Guid.Empty; keeper.MergeObject(src); Assert.IsTrue(keeper.App == newGuid); }
public void GreaterThanOrEqual() { // Setup test values Cache.LangProject.PeopleOA = new CmPossibilityList(); ICmPossibility person1 = Cache.LangProject.PeopleOA.PossibilitiesOS.Append(new CmPerson()); person1.ForeColor = 4; ICmPossibility person2 = Cache.LangProject.PeopleOA.PossibilitiesOS.Append(new CmPerson()); person2.ForeColor = 5; ICmPossibility person3 = Cache.LangProject.PeopleOA.PossibilitiesOS.Append(new CmPerson()); person3.ForeColor = 10; // Setup filter FdoOwningCollection <ICmFilter> filtersCol = Cache.LangProject.FiltersOC; ICmFilter filter = filtersCol.Add(new CmFilter()); filter.ColumnInfo = CmPossibility.kClassId + "," + (int)CmPossibility.CmPossibilityTags.kflidForeColor; ICmRow row = filter.RowsOS.Append(new CmRow()); ICmCell cell1 = row.CellsOS.Append(new DummyCmCell()); cell1.Contents.Text = ">= 5"; // Check the result ((CmFilter)filter).InitCriteria(); Assert.IsFalse(((CmFilter)filter).MatchesCriteria(person1.Hvo)); Assert.IsTrue(((CmFilter)filter).MatchesCriteria(person2.Hvo)); Assert.IsTrue(((CmFilter)filter).MatchesCriteria(person3.Hvo)); }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ public CategoryFilterDlg(FdoCache cache, IHelpTopicProvider helpTopicProvider, ICmFilter filter) : this() { m_cache = cache; m_helpTopicProvider = helpTopicProvider; m_filter = filter; tvCategories.Load(cache, filter, null); }
/// ------------------------------------------------------------------------------------ /// <summary> /// /// </summary> /// ------------------------------------------------------------------------------------ public CategoryFilterDlg(FdoCache cache, ICmFilter filter) : this() { m_cache = cache; m_filter = filter; string listName = cache.LangProject.TranslatedScriptureOA.NoteCategoriesOA.Name.UserDefaultWritingSystem; tvCategories.Load(cache, filter, null); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Loads the tree with the annotation categories from the specified cache's /// translated scripture object. Then the categories selected in the filter are /// checked in the tree. The value returned is a flag indicating whether or not /// the filter contained any categories (including whether or not the filter /// specifies no categories). /// </summary> /// ------------------------------------------------------------------------------------ public bool Load(FdoCache cache, ICmFilter filter, Label lblSelectedCategories) { List<int> initiallySelectedList; bool fFilterContainsCategories = InitializeFromFilter(cache, filter, out initiallySelectedList); base.Load(cache.LangProject.TranslatedScriptureOA.NoteCategoriesOA, initiallySelectedList, lblSelectedCategories); UpdateSelectedLabel(); return fFilterContainsCategories; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Loads the tree with the annotation categories from the specified cache's /// translated scripture object. Then the categories selected in the filter are /// checked in the tree. The value returned is a flag indicating whether or not /// the filter contained any categories (including whether or not the filter /// specifies no categories). /// </summary> /// ------------------------------------------------------------------------------------ public bool Load(FdoCache cache, ICmFilter filter, Label lblSelectedCategories) { List <int> initiallySelectedList; bool fFilterContainsCategories = InitializeFromFilter(cache, filter, out initiallySelectedList); base.Load(cache.LangProject.TranslatedScriptureOA.NoteCategoriesOA, initiallySelectedList, lblSelectedCategories); UpdateSelectedLabel(); return(fFilterContainsCategories); }
public void MergeUnicode() { CheckDisposed(); // 15 CmFilter.Name string goodFilter = "Fram"; string junkFilter = "Brand X"; FdoOwningCollection<ICmFilter> filtersCol = Cache.LangProject.FiltersOC; ICmFilter keeper = filtersCol.Add(new CmFilter()); ICmFilter src = filtersCol.Add(new CmFilter()); // Merge content into null original. src.Name = goodFilter; keeper.MergeObject(src); Assert.AreEqual(keeper.Name, goodFilter); // Try to merge empty string into null. keeper.Name = null; src = filtersCol.Add(new CmFilter()); src.Name = ""; keeper.MergeObject(src); Assert.IsNull(keeper.Name); // Try to merge empty string into content. keeper.Name = goodFilter; src = filtersCol.Add(new CmFilter()); src.Name = ""; keeper.MergeObject(src); Assert.AreEqual(keeper.Name, goodFilter); // Try to merge content into content. keeper.Name = goodFilter; src = filtersCol.Add(new CmFilter()); src.Name = junkFilter; keeper.MergeObject(src); Assert.AreEqual(keeper.Name, goodFilter); // Test merge append src = filtersCol.Add(new CmFilter()); src.Name = junkFilter; keeper.MergeObject(src, true); Assert.AreEqual(keeper.Name, goodFilter + ' ' + junkFilter); // But don't append if equal. keeper.Name = goodFilter; src = filtersCol.Add(new CmFilter()); src.Name = goodFilter; keeper.MergeObject(src, true); Assert.AreEqual(keeper.Name, goodFilter); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Apply the filter the user clicked in the side bar or in the menu. /// </summary> /// <param name="sender">The side-bar button the user clicked</param> /// ------------------------------------------------------------------------------------ public virtual void OnChangeFilter(object sender) { CheckDisposed(); ICmFilter userFilter = null; if (sender is SBTabItemProperties) // from sidebar { userFilter = (ICmFilter)((SBTabItemProperties)sender).Tag; } else if (sender is TMItemProperties) // from menu { userFilter = (ICmFilter)((TMItemProperties)sender).Tag; } if (userFilter != null && !GetFilterValuesFromUser(userFilter)) { return; } NotesViewFilter annotationFilter = new NotesViewFilter(Cache, userFilter); IFilter prevFilter = ((FilteredDomainDataByFlidDecorator)m_rootb.DataAccess).Filter; try { annotationFilter.InitCriteria(); ((FilteredDomainDataByFlidDecorator)m_rootb.DataAccess).Filter = annotationFilter; } catch { // User must have cancelled the filter, or something horrible happened. // Just revert back to the previous state. NotesMainWnd notesMainWnd = TheMainWnd as NotesMainWnd; Debug.Assert(notesMainWnd != null); notesMainWnd.SelectFilterButton(prevFilter); return; } // Set up the view constructor with the filtered sequence handler corresponding to the // notes filter chosen by the user. RefreshDisplay(); if (FilterChanged != null) { FilterChanged(this, userFilter); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes the list of categories based on categories in the specified filter. /// </summary> /// ------------------------------------------------------------------------------------ private bool InitializeFromFilter(FdoCache cache, ICmFilter filter, out List <int> initiallySelectedList) { initiallySelectedList = new List <int>(); if (filter == null || filter.RowsOS.Count == 0 || filter.RowsOS[0].CellsOS.Count == 0) { return(false); } bool fFilterContainsCategories = false; // Get the pairs of class ids and flids. string[] pairs = filter.ColumnInfo.Split('|'); Debug.Assert(filter.RowsOS[0].CellsOS.Count == pairs.Length); for (int i = 0; i < pairs.Length; i++) { ICmCell cell = filter.RowsOS[0].CellsOS[i]; Guid guid; // Get the flid for this cell. string[] pair = pairs[i].Split(','); int flid = 0; int.TryParse(pair[1], out flid); if (flid == ScrScriptureNoteTags.kflidCategories) { fFilterContainsCategories = true; cell.ParseObjectMatchCriteria(); if (cell.Contents.RunCount > 1) { guid = TsStringUtils.GetGuidFromRun(cell.Contents, 1); int hvo = cache.ServiceLocator.GetInstance <ICmObjectRepository>().GetObject(guid).Hvo; initiallySelectedList.Add(hvo); } } } return(fFilterContainsCategories); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Determines if a dialog box asking for user settings is necessary and, if so, /// shows the dialog box. /// </summary> /// ------------------------------------------------------------------------------------ private bool GetFilterValuesFromUser(ICmFilter userFilter) { if (userFilter == null) { return(true); } using (NonUndoableUnitOfWorkHelper undoHelper = new NonUndoableUnitOfWorkHelper( Cache.ServiceLocator.GetInstance <IActionHandler>())) { userFilter.ShowPrompt = 0; undoHelper.RollBack = false; } switch (userFilter.FilterName) { case "kstidNoteMultiFilter": using (MultipleFilterDlg dlg = new MultipleFilterDlg(Cache, m_helpTopicProvider, userFilter)) { if (dlg.ShowDialog() != DialogResult.OK) { return(false); } } break; case "kstidCategoryNoteFilter": using (CategoryFilterDlg dlg = new CategoryFilterDlg(Cache, m_helpTopicProvider, userFilter)) { if (dlg.ShowDialog() != DialogResult.OK) { return(false); } } break; } return(true); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Updates the specified filter with the selected category hvos. /// </summary> /// ------------------------------------------------------------------------------------ public void UpdateFilter(ICmFilter filter) { CmCell cell; string catColInfo = ScrScriptureNote.kClassId + "," + (int)ScrScriptureNote.ScrScriptureNoteTags.kflidCategories + "|"; StringBuilder bldr = new StringBuilder(); if (SelectedHvos.Count == 0) { bldr.Append(catColInfo); cell = new CmCell(); filter.RowsOS[0].CellsOS.Append(cell); cell.BuildObjectMatchCriteria(); } else { foreach (int matchVal in SelectedHvos) { bldr.Append(catColInfo); cell = new CmCell(); filter.RowsOS[0].CellsOS.Append(cell); cell.BuildObjectMatchCriteria(matchVal, true, false); } } if (bldr.Length > 0) { catColInfo = "|" + bldr.ToString().TrimEnd('|'); if (filter.ColumnInfo == null) { filter.ColumnInfo = catColInfo; } else { filter.ColumnInfo += catColInfo; } filter.ColumnInfo = filter.ColumnInfo.TrimStart('|'); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Updates the specified filter with the selected category hvos. /// </summary> /// ------------------------------------------------------------------------------------ public void UpdateFilter(ICmFilter filter) { ICmCell cell; string catColInfo = ScrScriptureNoteTags.kClassId + "," + ScrScriptureNoteTags.kflidCategories + "|"; StringBuilder bldr = new StringBuilder(); bool fPossibilitiesAdded = false; foreach (ICmPossibility matchVal in SelectedPossibilities) { bldr.Append(catColInfo); cell = filter.Cache.ServiceLocator.GetInstance <ICmCellFactory>().Create(); filter.RowsOS[0].CellsOS.Add(cell); cell.SetObjectMatchCriteria(matchVal, true, false); fPossibilitiesAdded = true; } if (!fPossibilitiesAdded) { bldr.Append(catColInfo); cell = filter.Cache.ServiceLocator.GetInstance <ICmCellFactory>().Create(); filter.RowsOS[0].CellsOS.Add(cell); cell.SetEmptyObjectMatchCriteria(); } if (bldr.Length > 0) { catColInfo = "|" + bldr.ToString().TrimEnd('|'); if (filter.ColumnInfo == null) { filter.ColumnInfo = catColInfo; } else { filter.ColumnInfo += catColInfo; } filter.ColumnInfo = filter.ColumnInfo.TrimStart('|'); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes the list of categories based on categories in the specified filter. /// </summary> /// ------------------------------------------------------------------------------------ private bool InitializeFromFilter(FdoCache cache, ICmFilter filter, out List<int> initiallySelectedList) { initiallySelectedList = new List<int>(); if (filter == null || filter.RowsOS.Count == 0 || filter.RowsOS[0].CellsOS.Count == 0) return false; bool fFilterContainsCategories = false; // Get the pairs of class ids and flids. string[] pairs = filter.ColumnInfo.Split('|'); Debug.Assert(filter.RowsOS[0].CellsOS.Count == pairs.Length); for (int i = 0; i < pairs.Length; i++) { ICmCell cell = filter.RowsOS[0].CellsOS[i]; Guid guid; // Get the flid for this cell. string[] pair = pairs[i].Split(','); int flid = 0; int.TryParse(pair[1], out flid); if (flid == ScrScriptureNoteTags.kflidCategories) { fFilterContainsCategories = true; cell.ParseObjectMatchCriteria(); if (cell.Contents.RunCount > 1) { guid = TsStringUtils.GetGuidFromRun(cell.Contents, 1); int hvo = cache.ServiceLocator.GetInstance<ICmObjectRepository>().GetObject(guid).Hvo; initiallySelectedList.Add(hvo); } } } return fFilterContainsCategories; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Initializes a new instance of the <see cref="NotesViewFilter"/> class. /// </summary> /// <param name="cache">The cache.</param> /// <param name="userFilter">The user filter.</param> /// ------------------------------------------------------------------------------------ internal NotesViewFilter(FdoCache cache, ICmFilter userFilter) : base(new ExcludeCheckingErrorsFilter(cache), userFilter) { }
/// ------------------------------------------------------------------------------------ /// <summary> /// Adds the specified row to the filter and issues a PropChanged. /// </summary> /// <param name="filter">The filter.</param> /// <param name="dummyRow">The dummy row.</param> /// ------------------------------------------------------------------------------------ private void AddRow(ICmFilter filter, DummyRow dummyRow) { filter.RowsOS.Append(dummyRow); Cache.PropChanged(null, PropChangeType.kpctNotifyAll, dummyRow.OwnerHVO, dummyRow.OwningFlid, filter.RowsOS.Count - 1, 1, 0); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Select the button on the filter sidebar corresponding to the given CmFilter (will /// not generate the events) /// </summary> /// <param name="filter">The filter whose corresponding button should be selected</param> /// ------------------------------------------------------------------------------------ public void SelectFilterButton(ICmFilter filter) { CheckDisposed(); if (filter == null) { SIBAdapter.SetCurrentTabItem(kstidFilterSBTabInternalName, kstidNoFilter, false); return; } foreach (SBTabItemProperties filterBtn in SIBAdapter.Tabs[1].Items) { if (filter.Name == filterBtn.Name) SIBAdapter.SetCurrentTabItem(kstidFilterSBTabInternalName, filterBtn.Text, false); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Called to make the test data for the tests /// </summary> /// ------------------------------------------------------------------------------------ protected override void CreateTestData() { m_filter = new CmFilter(); Cache.LangProject.FiltersOC.Add(m_filter); AddRow(m_filter, new DummyRow()); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Loads the tree with the annotation categories from the specified cache's /// translated scripture object. Then the categories selected in the filter are /// checked in the tree. The value returned is a flag indicating whether or not /// the filter contained any categories (including whether or not the filter /// specifies no categories). /// </summary> /// ------------------------------------------------------------------------------------ public bool Load(FdoCache cache, ICmFilter filter) { return Load(cache, filter, null); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Updates the specified filter with the selected category hvos. /// </summary> /// ------------------------------------------------------------------------------------ public void UpdateFilter(ICmFilter filter) { ICmCell cell; string catColInfo = ScrScriptureNoteTags.kClassId + "," + ScrScriptureNoteTags.kflidCategories + "|"; StringBuilder bldr = new StringBuilder(); bool fPossibilitiesAdded = false; foreach (ICmPossibility matchVal in SelectedPossibilities) { bldr.Append(catColInfo); cell = filter.Cache.ServiceLocator.GetInstance<ICmCellFactory>().Create(); filter.RowsOS[0].CellsOS.Add(cell); cell.SetObjectMatchCriteria(matchVal, true, false); fPossibilitiesAdded = true; } if (!fPossibilitiesAdded) { bldr.Append(catColInfo); cell = filter.Cache.ServiceLocator.GetInstance<ICmCellFactory>().Create(); filter.RowsOS[0].CellsOS.Add(cell); cell.SetEmptyObjectMatchCriteria(); } if (bldr.Length > 0) { catColInfo = "|" + bldr.ToString().TrimEnd('|'); if (filter.ColumnInfo == null) filter.ColumnInfo = catColInfo; else filter.ColumnInfo += catColInfo; filter.ColumnInfo = filter.ColumnInfo.TrimStart('|'); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Updates the specified filter with the selected category hvos. /// </summary> /// ------------------------------------------------------------------------------------ public void UpdateFilter(ICmFilter filter) { CmCell cell; string catColInfo = ScrScriptureNote.kClassId + "," + (int)ScrScriptureNote.ScrScriptureNoteTags.kflidCategories + "|"; StringBuilder bldr = new StringBuilder(); if (SelectedHvos.Count == 0) { bldr.Append(catColInfo); cell = new CmCell(); filter.RowsOS[0].CellsOS.Append(cell); cell.BuildObjectMatchCriteria(); } else { foreach (int matchVal in SelectedHvos) { bldr.Append(catColInfo); cell = new CmCell(); filter.RowsOS[0].CellsOS.Append(cell); cell.BuildObjectMatchCriteria(matchVal, true, false); } } if (bldr.Length > 0) { catColInfo = "|" + bldr.ToString().TrimEnd('|'); if (filter.ColumnInfo == null) filter.ColumnInfo = catColInfo; else filter.ColumnInfo += catColInfo; filter.ColumnInfo = filter.ColumnInfo.TrimStart('|'); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Update the filter panel in the status bar. /// </summary> /// ------------------------------------------------------------------------------------ private void NoteFilterChanged(object sender, ICmFilter filter) { bool fFiltered = (filter != null); ShowFilterStatusBarMessage(fFiltered); // Filter can be turned off programmitically when note not matching current filter is // inserted. if (!fFiltered && (SIBAdapter.CurrentTabItemProperties != null) && SIBAdapter.CurrentTabItemProperties.Name != kstidNoFilter) SIBAdapter.SetCurrentTabItem(kstidFilterSBTabInternalName, kstidNoFilter, true); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Determines if a dialog box asking for user settings is necessary and, if so, /// shows the dialog box. /// </summary> /// ------------------------------------------------------------------------------------ private bool GetFilterValuesFromUser(ICmFilter userFilter) { if (userFilter == null) return true; using (NonUndoableUnitOfWorkHelper undoHelper = new NonUndoableUnitOfWorkHelper( Cache.ServiceLocator.GetInstance<IActionHandler>())) { userFilter.ShowPrompt = 0; undoHelper.RollBack = false; } switch (userFilter.FilterName) { case "kstidNoteMultiFilter": using (MultipleFilterDlg dlg = new MultipleFilterDlg(Cache, m_helpTopicProvider, userFilter)) { if (dlg.ShowDialog() != DialogResult.OK) return false; } break; case "kstidCategoryNoteFilter": using (CategoryFilterDlg dlg = new CategoryFilterDlg(Cache, m_helpTopicProvider, userFilter)) { if (dlg.ShowDialog() != DialogResult.OK) return false; } break; } return true; }
/// ------------------------------------------------------------------------------------ /// <summary> /// Loads the tree with the annotation categories from the specified cache's /// translated scripture object. Then the categories selected in the filter are /// checked in the tree. The value returned is a flag indicating whether or not /// the filter contained any categories (including whether or not the filter /// specifies no categories). /// </summary> /// ------------------------------------------------------------------------------------ public bool Load(FdoCache cache, ICmFilter filter) { return(Load(cache, filter, null)); }