Exemplo n.º 1
0
        private void FilterContextMenuStrip_Opening(object sender, CancelEventArgs e)
        {
            LibraryFilters filters = LibraryFilter.Filters;

            filterNoneButton.Checked         = filters == LibraryFilters.None;
            filterAllButton.Checked          = filters == LibraryFilters.All;
            filterQuerySearchButton.Checked  = filters.HasFlag(LibraryFilters.Folder);
            filterTaggedSearchButton.Checked = filters.HasFlag(LibraryFilters.Archive);

            filterNoneButton.Enabled = filters != LibraryFilters.None;
            filterAllButton.Enabled  = filters != LibraryFilters.All;
        }
Exemplo n.º 2
0
        public static LibraryFilters ToggleFlag(this LibraryFilters flags, LibraryFilters flag)
        {
            if (flags.HasFlag(flag))
            {
                flags &= ~flag;
            }
            else
            {
                flags |= flag;
            }

            return(flags);
        }
Exemplo n.º 3
0
        public bool ShouldFilterType(string value)
        {
            bool none = filters == LibraryFilters.None;
            bool all  = filters == LibraryFilters.All;

            if (none)
            {
                return(false);
            }
            else if (all)
            {
                return(true);
            }
            else
            {
                bool folder  = filters.HasFlag(LibraryFilters.Folder);
                bool archive = filters.HasFlag(LibraryFilters.Archive);

                return((folder && Directory.Exists(value)) ||
                       (archive && File.Exists(value)));
            }
        }