Example #1
0
        public PackageManagerTopPanel()
        {
            InitializeComponent();

            _labelBrowse.Selected = true;
            _selectedFilter       = _labelBrowse;
        }
Example #2
0
        public void FilterLabel_ControlSelected(object sender, EventArgs e)
        {
            var selectedFilter = (FilterLabel)sender;

            if (selectedFilter == _selectedFilter)
            {
                return;
            }

            if (_selectedFilter != null)
            {
                _selectedFilter.Selected = false;
            }

            var previousFilter = _selectedFilter;

            _selectedFilter = selectedFilter;
            if (FilterChanged != null)
            {
                FilterChanged(this, new FilterChangedEventArgs(previousFilter?.Filter));
            }
        }
Example #3
0
        public void SelectFilter(ItemFilter selectedFilter)
        {
            if (_selectedFilter != null)
            {
                _selectedFilter.Selected = false;
            }

            switch (selectedFilter)
            {
            case ItemFilter.All:
                _selectedFilter = _labelBrowse;
                break;

            case ItemFilter.Installed:
                _selectedFilter = _labelInstalled;
                break;

            case ItemFilter.UpdatesAvailable:
                _selectedFilter = _labelUpgradeAvailable;
                break;

            case ItemFilter.Consolidate:
                if (_isSolution)
                {
                    _selectedFilter = _labelConsolidate;
                }
                break;
            }

            // _selectedFilter could be null if we are running with a solution with user
            // settings saved by a later version of NuGet that has more filters than
            // can be recognized here.
            if (_selectedFilter == null)
            {
                _selectedFilter = _labelInstalled;
            }

            _selectedFilter.Selected = true;
        }