private void Sky_Calculated() { if (sun == null) { sun = sky.Search("Sun"); } if (moon == null) { moon = sky.Search("Moon"); } }
public double LunarPhaseAtMax(SkyContext ctx, Meteor m) { if (Moon == null) { Moon = sky.Search("Moon"); } return(Moon != null ? (double)sky.GetEphemerides(Moon, ctx, new[] { "Phase" }).First().Value : 0); }
/// <summary> /// Searches for celestial objects asynchronously. /// </summary> private async void DoSearch() { var results = await Task.Run(() => sky.Search(SearchString, Filter)); SearchResults.Clear(); foreach (var item in results) { SearchResults.Add(new SearchResultItem(item, string.Join(", ", item.Names))); } SelectedItem = SearchResults.Any() ? SearchResults[0] : null; }
/// <summary> /// Searches for celestial objects asynchronously. /// </summary> private async void DoSearch() { ICollection <CelestialObject> results = !string.IsNullOrWhiteSpace(SearchString) ? await Task.Run(() => sky.Search(SearchString, Filter)) : new CelestialObject[0]; SearchResults.Clear(); foreach (var item in results) { SearchResults.Add(new SearchResultItem(item, string.Join(", ", item.Names))); } SelectedItem = SearchResults.Any() ? SearchResults[0] : null; }