Example #1
0
        private void SearchDetails_ApplySearch(bool immediately)
        {
            if (suppressSearch)
            {
                return;
            }

            currentSearch = new ModSearch(
                SearchDetails.FilterByNameTextBox.Text,
                SearchDetails.FilterByAuthorTextBox.Text,
                SearchDetails.FilterByDescriptionTextBox.Text,
                SearchDetails.FilterByLanguageTextBox.Text,
                SearchDetails.FilterByDependsTextBox.Text,
                SearchDetails.FilterByRecommendsTextBox.Text,
                SearchDetails.FilterBySuggestsTextBox.Text,
                SearchDetails.FilterByConflictsTextBox.Text
                );
            suppressSearch             = true;
            FilterCombinedTextBox.Text = currentSearch?.Combined ?? "";
            suppressSearch             = false;
            if (immediately)
            {
                TriggerSearch();
            }
            else
            {
                TriggerSearchOrTimer();
            }
        }
Example #2
0
        private void FilterCombinedTextBox_TextChanged(object sender, EventArgs e)
        {
            if (suppressSearch)
            {
                return;
            }

            try
            {
                currentSearch  = ModSearch.Parse(FilterCombinedTextBox.Text);
                suppressSearch = true;
                SearchDetails.FilterByNameTextBox.Text        = currentSearch?.Name ?? "";
                SearchDetails.FilterByAuthorTextBox.Text      = currentSearch?.Author ?? "";
                SearchDetails.FilterByDescriptionTextBox.Text = currentSearch?.Description ?? "";
                SearchDetails.FilterByLanguageTextBox.Text    = currentSearch?.Localization ?? "";
                SearchDetails.FilterByDependsTextBox.Text     = currentSearch?.DependsOn ?? "";
                SearchDetails.FilterByRecommendsTextBox.Text  = currentSearch?.Recommends ?? "";
                SearchDetails.FilterByConflictsTextBox.Text   = currentSearch?.ConflictsWith ?? "";
                SearchDetails.FilterBySuggestsTextBox.Text    = currentSearch?.Suggests ?? "";
                suppressSearch = false;
                TriggerSearchOrTimer();
            }
            catch (Kraken k)
            {
                Main.Instance.AddStatusMessage(k.Message);
            }
        }
Example #3
0
 private void EditModSearch_ApplySearch(EditModSearch source, ModSearch what)
 {
     if (what == null && editors.Count > 1)
     {
         RemoveSearch(source);
     }
     Apply();
 }
Example #4
0
        private void FilterTextBox_TextChanged(object sender, EventArgs e)
        {
            if (suppressSearch)
            {
                return;
            }

            currentSearch = new ModSearch(
                FilterByNameTextBox.Text,
                FilterByAuthorTextBox.Text,
                FilterByDescriptionTextBox.Text,
                FilterByLanguageTextBox.Text,
                FilterByDependsTextBox.Text,
                FilterByRecommendsTextBox.Text,
                FilterBySuggestsTextBox.Text,
                FilterByConflictsTextBox.Text
                );
            suppressSearch             = true;
            FilterCombinedTextBox.Text = currentSearch?.Combined ?? "";
            suppressSearch             = false;
            TriggerSearchOrTimer();
        }
Example #5
0
        private void SetupDefaultSearch()
        {
            var def = configuration.DefaultSearches;

            if (def == null || def.Count < 1)
            {
                // Fall back to old setting
                ManageMods.Filter(ModList.FilterToSavedSearch(
                                      (GUIModFilter)configuration.ActiveFilter,
                                      ManageMods.mainModList.ModuleTags.Tags.GetOrDefault(configuration.TagFilter),
                                      ManageMods.mainModList.ModuleLabels.LabelsFor(CurrentInstance.Name)
                                      .FirstOrDefault(l => l.Name == configuration.CustomLabelFilter)
                                      ));
                // Clear the old filter so it doesn't get pulled forward again
                configuration.ActiveFilter = (int)GUIModFilter.All;
            }
            else
            {
                var labels   = ManageMods.mainModList.ModuleLabels.LabelsFor(CurrentInstance.Name).ToList();
                var searches = def.Select(s => ModSearch.Parse(s, labels)).ToList();
                ManageMods.SetSearches(searches);
            }
        }
Example #6
0
 public void SetSearch(ModSearch newSearch)
 {
     activeSearch = newSearch;
     ModFiltersUpdated(this);
 }