Esempio n. 1
0
 public void OnClick(View view)
 {
     if (view is TextView textView)
     {
         ActivityUtil.StartActivity(this, textView.Text);
     }
 }
        private async Task <List <ActivityEntityBase> > GetActivityFiltersValues()
        {
            //Check history table timestamp of last processed
            var    queryResult = await(GetQuery <MetricHistoryEntry>()).GetAsync(TableNames.CountHistory, 1);
            string queryPartitionKey;

            if (queryResult.Results.Count < 1)
            {
                queryPartitionKey = ActivityUtil.GetPartitionKey(DateTime.UtcNow.Subtract(new TimeSpan(30 * 3, 0, 0, 0)).Ticks);
            }
            else
            {
                queryPartitionKey = queryResult.Results[0].TargetPartitionKey;
            }

            QueryResult <ActivityEntityBase> newActivities = await(GetQuery <ActivityEntityBase>())
                                                             .GetAsync(TableNames.Reactions, null,
                                                                       new QueryFilterCondition[] { new QueryFilterCondition(new QueryFilter(nameof(TableEntity.PartitionKey), queryPartitionKey), QueryComparisons.LessThan) });

            //Write the max timestamp for this session back to the history table
            var minPartitionKey = newActivities.Results.Min(p => p.PartitionKey);

            if (!string.IsNullOrEmpty(minPartitionKey))
            {
                await((new ActivityTrackerFactory <MetricHistoryEntry>()).Create(TableNames.CountHistory, (string)null)).InsertAsync(new MetricHistoryEntry(minPartitionKey, newActivities.Results.Count));
            }

            return(GetDistinct(newActivities.Results));
        }