Exemplo n.º 1
0
        private void BindFilterFile()
        {
            CriteriaOperator currentCriteria = _viewContext.GetFilter(_gridFilter);
            var viewItems = GetListFilterItems();
            var items     = viewItems.OrderBy(i => i.Order).ToList();
            GalleryItemGroup itemGroup = new GalleryItemGroup();

            foreach (var item in items)
            {
                GalleryItem galleryItem = new FilterGalleryItem(item);
                galleryItem.Caption    = item.DisplayName;
                galleryItem.Image      = WinFormsResourceService.GetBitmap("tag");
                galleryItem.HoverImage = galleryItem.Image;
                string filterString   = item.FilterString;
                bool   isCrietiaEqual = IsCriteriaOperatorEquals(currentCriteria, CriteriaOperator.TryParse(filterString));
                galleryItem.Checked = isCrietiaEqual;
                itemGroup.Items.Add(galleryItem);
            }
            if (!itemGroup.Items.Cast <GalleryItem>().Any(i => i.Checked) && itemGroup.Items.Count > 0)
            {
                itemGroup.Items.Cast <GalleryItem>().Last().Checked = true;
            }
            this.Gallery.Groups.Clear();
            this.Gallery.Groups.Add(itemGroup);
        }
Exemplo n.º 2
0
        private void SetFilter(GalleryItem galleryItem)
        {
            if (galleryItem.Checked)
            {
                return;
            }
            galleryItem.GalleryGroup.Items.Cast <GalleryItem>().ToList().ForEach(i => i.Checked = false);
            galleryItem.Checked = true;
            FilterGalleryItem filterGalleryItem = (FilterGalleryItem)galleryItem;

            _filterName = filterGalleryItem.FilterItem.FileName;
            SendFilterMessage(null, new EventArgs <string>(filterGalleryItem.FilterItem.FilterString));
        }
Exemplo n.º 3
0
        public string GetSelectedFilterName()
        {
            List <GalleryItem> selectedItems = this.Gallery.GetCheckedItems();

            if (selectedItems.Count > 0)
            {
                FilterGalleryItem item = selectedItems[0] as FilterGalleryItem;
                return(item.FilterItem.FileName);
            }
            else
            {
                return(string.Empty);
            }
        }
Exemplo n.º 4
0
        void Ribbon_ShowCustomizationMenu(object sender, RibbonCustomizationMenuEventArgs e)
        {
            RibbonControl ribbon = sender as RibbonControl;

            if (e.HitInfo == null)
            {
                return;
            }


            if (e.HitInfo.InGalleryItem || e.HitInfo.HitTest == RibbonHitTest.GalleryImage)
            {
                var item = e.HitInfo.GalleryItem;
                if (Gallery.Groups.Contains(item.GalleryGroup))
                {
                    _currentItem            = item as FilterGalleryItem;
                    e.ShowCustomizationMenu = false;
                    _popupMenu.ShowPopup(ribbon.PointToScreen(e.HitInfo.HitPoint));
                }
            }
        }