Ejemplo n.º 1
0
 public void ClearResults()
 {
     Clubs.Clear();
     Persons.Clear();
     Competitions.Clear();
     Unions.Clear();
 }
Ejemplo n.º 2
0
        async Task ExecuteLoadSearchResultsCommand(string term)
        {
            IsBusy = true;

            try
            {
                var results = await SportnetStore.GetSearchResults(term);

                Clubs.Clear();
                Persons.Clear();
                Competitions.Clear();
                Unions.Clear();

                foreach (var item in results)
                {
                    switch (item.Type)
                    {
                    case "person":
                        Persons.Add(item);
                        break;

                    case "club":
                        Clubs.Add(item);
                        break;

                    case "competition":
                        Competitions.Add(item);
                        break;

                    case "union":
                        Unions.Add(item);
                        break;

                    default:
                        break;
                    }
                }

                IsLoaded = true;
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
                var log = new ErrorLog()
                {
                    ExceptionType = ex.GetType().ToString(),
                    Status        = ErrorLog.LogStatus.Unread,
                    Message       = ex.Message,
                    ObjectId      = term,
                    Action        = "Searching",
                    Datetime      = DateTime.Now,
                };
                await LogError(log);
            }
            finally
            {
                IsBusy = false;
            }
        }