/// ------------------------------------------------------------------------------------ /// <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> /// 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> /// 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(); CmFilter userFilter = null; if (sender is SBTabItemProperties) // from sidebar userFilter = (sender != null) ? (CmFilter)((SBTabItemProperties)sender).Tag : null; else if (sender is TMItemProperties) // from menu userFilter = (sender != null) ? (CmFilter)((TMItemProperties)sender).Tag : null; if (userFilter != null && !GetFilterValuesFromUser(userFilter)) return; NotesViewFilter annotationFilter = new NotesViewFilter(Cache, userFilter); FilteredSequenceHandler handler; try { handler = FilteredSequenceHandler.GetFilterInstance(m_fdoCache, ScrBookAnnotations.kClassId, annotationFilter, Handle.ToInt32()); if (handler != null) handler.Reinitialize(false); else { if (userFilter != null) userFilter.UserView = m_UserView; handler = new FilteredSequenceHandler(m_fdoCache, ScrBookAnnotations.kClassId, Handle.ToInt32(), annotationFilter, null, m_UserView); } } 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(m_vc.NotesSequenceHandler != null ? m_vc.NotesSequenceHandler.Filter as CmFilter: null); return; } Debug.Assert(handler != null); m_currentNotesTag = handler.Tag; // Set up the view constructor with the filtered sequence handler corresponding to the // notes filter chosen by the user. m_vc.NotesSequenceHandler = handler; RefreshDisplay(); if (FilterChanged != null) FilterChanged(this, userFilter); }
/// ------------------------------------------------------------------------------------ /// <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(); CmFilter userFilter = null; if (sender is SBTabItemProperties) // from sidebar { userFilter = (sender != null) ? (CmFilter)((SBTabItemProperties)sender).Tag : null; } else if (sender is TMItemProperties) // from menu { userFilter = (sender != null) ? (CmFilter)((TMItemProperties)sender).Tag : null; } if (userFilter != null && !GetFilterValuesFromUser(userFilter)) { return; } NotesViewFilter annotationFilter = new NotesViewFilter(Cache, userFilter); FilteredSequenceHandler handler; try { handler = FilteredSequenceHandler.GetFilterInstance(m_fdoCache, ScrBookAnnotations.kClassId, annotationFilter, Handle.ToInt32()); if (handler != null) { handler.Reinitialize(false); } else { if (userFilter != null) { userFilter.UserView = m_UserView; } handler = new FilteredSequenceHandler(m_fdoCache, ScrBookAnnotations.kClassId, Handle.ToInt32(), annotationFilter, null, m_UserView); } } 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(m_vc.NotesSequenceHandler != null ? m_vc.NotesSequenceHandler.Filter as CmFilter: null); return; } Debug.Assert(handler != null); m_currentNotesTag = handler.Tag; // Set up the view constructor with the filtered sequence handler corresponding to the // notes filter chosen by the user. m_vc.NotesSequenceHandler = handler; RefreshDisplay(); if (FilterChanged != null) { FilterChanged(this, userFilter); } }