/// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private void btnApplyNow_Click(object sender, EventArgs e)
        {
            if (CurrentFilter != null)
            {
                if (IsDirty)
                {
                    if (!Verify() || !SaveChanges())
                    {
                        return;
                    }
                }

                FilterHelper.ApplyFilter(CurrentFilter);
            }
        }
Exemple #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;
                }
            }
        }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// ------------------------------------------------------------------------------------
        void HandleFilterButtonItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            ToolStripMenuItem item = e.ClickedItem as ToolStripMenuItem;

            if (item == null)
            {
                return;
            }

            if (item.Tag != null && item.Tag.GetType() == typeof(PaFilter))
            {
                FilterHelper.ApplyFilter(item.Tag as PaFilter);
            }
            else if (item.Text == Properties.Resources.kstidNoFilterText)
            {
                FilterHelper.ApplyFilter(null);
            }
            else if (item.Text == Properties.Resources.kstidFiltersMenuText)
            {
                string filterName = null;
                foreach (ToolStripItem mnu in m_filterButton.DropDown.Items)
                {
                    PaFilter filter = mnu.Tag as PaFilter;
                    if (filter != null && ((ToolStripMenuItem)mnu).Checked)
                    {
                        filterName = filter.Name;
                        break;
                    }
                }

                using (DefineFiltersDlg dlg = new DefineFiltersDlg(filterName))
                    dlg.ShowDialog();

                return;
            }
        }