Ejemplo n.º 1
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        ///
        /// </summary>
        /// ------------------------------------------------------------------------------------
        protected bool OnDisplayFilterDlg(object args)
        {
            string filterName =
                (FilterHelper.CurrentFilter != null ? FilterHelper.CurrentFilter.Name : null);

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

            return(false);
        }
        /// ------------------------------------------------------------------------------------
        /// <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;
            }
        }