Beispiel #1
0
        private async void SaveSearch_Click(object sender, RoutedEventArgs e)
        {
            if (String.IsNullOrWhiteSpace(NewSearch.Species))
            {
                return;
            }

            try
            {
                NewSearch.Order = ListSearches.Where(sc => sc.Group == NewSearch.Group).Max(sc => sc.Order) + 100;
            }
            catch (InvalidOperationException) // no entries for .Max - ignore
            { }

            IsLoading = true;
            try
            {
                StatusText = $"Loading {NewSearch.Species}...";
                await arkReaderWild.EnsureSpeciesIsLoaded(NewSearch.Species);

                StatusText = $"Ready";
            }
            finally
            {
                IsLoading = false;
            }

            ListSearches.Add(NewSearch);
            NewSearch             = null;
            NewSearchActive       = false;
            CreateSearchAvailable = true;

            MarkSearchesChanged();
        }
Beispiel #2
0
        private async Task LoadSearchSpecies()
        {
            IsLoading = true;
            try
            {
                var species = arkReaderWild.AllSpecies.Distinct();
                foreach (var speciesName in species)
                {
                    StatusText = $"Loading {speciesName}...";
                    await arkReaderWild.EnsureSpeciesIsLoaded(speciesName);
                }

                species = arkReaderTamed.AllSpecies.Distinct();
                foreach (var speciesName in species)
                {
                    StatusText = $"Loading {speciesName}...";
                    await arkReaderTamed.EnsureSpeciesIsLoaded(speciesName);
                }

                StatusText = "Ready";
            }
            finally
            {
                IsLoading = false;
            }
        }