Example #1
0
        void RefreshHelpers()
        {
            if (HelpersTileview == null)
            {
                return;
            }

            HelpersTileview.Clear();

            List <Helper> helpers = DockServices.Helpers.Helpers;

            foreach (HelperTile tileobject in helpertiles.Where(to => !helpers.Contains(to.Helper)))
            {
                helpertiles.Remove(tileobject);
                tileobject.Dispose();
            }
            helpertiles = helpers.Where(helper => !helpertiles.Exists(to => helper == to.Helper))
                          .Select(h => new HelperTile(h))
                          .Union(helpertiles).ToList();

            string query = HelperSearch.InnerEntry.Text.ToLower();
            IEnumerable <HelperTile> showinghelpertiles = helpertiles
                                                          .Where(hto => hto.Name.ToLower().Contains(query) || hto.Description.ToLower().Contains(query))
                                                          .OrderBy(hto => hto.Name);

            if (helper_show_cmb.Active == (uint)HelperShowStates.Usable)
            {
                showinghelpertiles = showinghelpertiles.Where(hto => hto.Helper.IsAppAvailable);
            }
            else if (helper_show_cmb.Active == (uint)HelperShowStates.Enabled)
            {
                showinghelpertiles = showinghelpertiles.Where(hto => hto.Enabled);
            }
            else if (helper_show_cmb.Active == (uint)HelperShowStates.Disabled)
            {
                showinghelpertiles = showinghelpertiles.Where(hto => !hto.Enabled);
            }

            foreach (HelperTile tileobject in showinghelpertiles)
            {
                HelpersTileview.AppendTile(tileobject);
            }

            SetupHelperAlignment();
        }