/// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// ------------------------------------------------------------------------------------
        protected override bool SaveChanges()
        {
            PaFiltersList filterList = new PaFiltersList();

            foreach (ListViewItem item in lvFilters.Items)
            {
                PaFilter filter = item.Tag as PaFilter;
                if (filter != null)
                {
                    filterList.Add(filter);
                }
            }

            // TODO: Validate expressions with search queries.

            filterList.Save();
            FilterHelper.UpdateDisplayedFilterLists(filterList, true);
            m_dirty        = false;
            m_grid.IsDirty = false;
            return(true);
        }
Beispiel #2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// ------------------------------------------------------------------------------------
        protected void AfterDataSourcesLoaded(object args)
        {
            PaProject project = args as PaProject;

            if (project != null)
            {
                FilterHelper.UpdateDisplayedFilterLists(PaFiltersList.Load(project), false);

                // The first time we read the data sources, check if there was a filter
                // applied when the user closed down PA the last time. If so, then apply
                // it now. (m_startupFilterName will only be non null the first time the
                // data sources are read after startup.
                if (!string.IsNullOrEmpty(m_startupFilterName))
                {
                    PaFilter filter = FilterHelper.FilterList[m_startupFilterName];
                    if (filter != null)
                    {
                        FilterHelper.ApplyFilter(filter);
                    }
                    m_startupFilterName = null;
                }
            }
        }