private void ResetFilter(Block selectedBlock)
        {
            PopulateRelevantBlocks();

            if (IsRelevant(m_navigator.CurrentBlock))
            {
                m_currentBlockIndex        = 0;
                m_temporarilyIncludedBlock = null;
            }
            else
            {
                if (RelevantBlockCount > 0)
                {
                    m_currentBlockIndex = -1;
                    if (m_temporarilyIncludedBlock != null)
                    {
                        // Block that was temporarily included in previous filter might now match the new filter
                        var i = m_relevantBlocks.IndexOf(m_temporarilyIncludedBlock);
                        if (i >= 0)
                        {
                            m_currentBlockIndex        = i;
                            m_temporarilyIncludedBlock = null;
                            SetBlock(m_relevantBlocks[m_currentBlockIndex]);
                            return;
                        }
                    }
                    LoadNextRelevantBlock();
                }
                else if (selectedBlock != null)
                {
                    m_temporarilyIncludedBlock = m_navigator.GetIndicesOfSpecificBlock(selectedBlock);
                    m_navigator.SetIndices(m_temporarilyIncludedBlock);
                }
                else
                {
                    m_temporarilyIncludedBlock = m_navigator.GetIndices();
                }
            }
        }
예제 #2
0
 public void GetIndices_FirstBlock()
 {
     Assert.AreEqual(new BookBlockIndices(0, 0), m_navigator.GetIndices());
 }