Beispiel #1
0
        public Task Filter()
        {
            if (!FilterQuery.IsNullOrEmpty())
            {
                try
                {
                    if (FilterQuery != _lastFilterQuery)
                    {
                        if (_lastFilterQuery.IsNullOrEmpty())
                        {
                            _cachedEvents = Events;
                        }
                        _lastFilterQuery = FilterQuery;
                        char[] toTrim = { ' ', '"', '\'' };
                        var    query  = FilterQuery.Trim(toTrim);
                        Events = _dbs.GetEvents(query).ToObservableCollection();
                    }
                }
                catch (Newtonsoft.Json.JsonException)
                {
                    throw new FormatException("Incorrect oauth token file format. Restore or delete it and try again");
                }
                catch (DataException)
                {
                    throw new DataException("Failed to modify database. Verify the connection and try again");
                }
            }
            else if (_cachedEvents != null)
            {
                Events = _cachedEvents;
            }

            return(Task.CompletedTask);
        }