Exemplo n.º 1
0
        private void Update(EvaluationContext context)
        {
            var search         = Search.GetValue(context);
            var collectionId   = CollectionId.GetValue(context);
            var triggerRequest = TriggerRequest.GetValue(context);

            if (triggerRequest && (search != _searchQuery || collectionId != _collectionId))
            {
                TriggerRequest.Value = false;
                TriggerRequest.TypedInputValue.Value = false;
                TriggerRequest.DirtyFlag.Invalidate();
                _maxResultCount = MaxResultCount.GetValue(context);
                _apiToken       = ApiToken.GetValue(context);
                _searchQuery    = search;
                _collectionId   = collectionId;
                _request        = SearchImagesTask();
            }

            var photoIndex = GetPhotoIndex.GetValue(context);

            if (photoIndex != _photoIndex)
            {
                _photoIndex = photoIndex;
                if (_photos != null && _photos.Count != 0)
                {
                    var index = Math.Abs(_photoIndex) % _photos.Count;
                    PhotoAuthor.Value = _photos[index].User.Name;
                    PhotoUrl.Value    = _photos[index].Urls.Regular;
                    Log.Debug($"Update photo properties: Author {PhotoAuthor.Value}   Url {PhotoUrl.Value}");
                }
            }
        }
Exemplo n.º 2
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = _lastRunSeconds.GetHashCode();
         hashCode = (hashCode * 397) ^ Sort.GetHashCode();
         hashCode = (hashCode * 397) ^ MinExecs.GetHashCode();
         hashCode = (hashCode * 397) ^ MinExecsPerMin.GetHashCode();
         hashCode = (hashCode * 397) ^ (Search?.GetHashCode() ?? 0);
         hashCode = (hashCode * 397) ^ MaxResultCount.GetHashCode();
         hashCode = (hashCode * 397) ^ Database.GetHashCode();
         return(hashCode);
     }
 }