Пример #1
0
        public async Task <ContributionList> GetContributionsAsync(int offset = 0, int limit = 0)
        {
            // Let's fake some delay, to see all the fancy loaders!
            await Task.Delay(3000);

            // Take the local copy, which we sort of cached in this service.
            if (allContributionList != null)
            {
                return new ContributionList()
                       {
                           Contributions      = allContributionList.Contributions.Skip(offset).Take(limit == 0 ? allContributionList.Contributions.Count : limit).ToList(),
                           TotalContributions = allContributionList.Contributions.Count,
                           PagingIndex        = offset + limit > allContributionList.Contributions.Count ? allContributionList.Contributions.Count : offset + limit
                       }
            }
            ;

            // Get them from "remote" aka reset the whole thing.
            var list = JsonConvert.DeserializeObject <List <Contribution> >(LocalResourceService.GetFile("getcontributions"));

            allContributionList = new ContributionList()
            {
                Contributions      = list.OrderByDescending(x => x.StartDate).ToList(),
                TotalContributions = list.Count,
                PagingIndex        = 0
            };

            return(new ContributionList()
            {
                Contributions = list.Skip(offset).Take(limit == 0 ? allContributionList.Contributions.Count : limit).ToList(),
                TotalContributions = list.Count,
                PagingIndex = 0
            });;
        }
Пример #2
0
        public async Task <Profile> GetProfileAsync(bool forceRefresh = false)
        {
            // Let's fake some delay, to see all the fancy loaders!
            await Task.Delay(1000);

            return(JsonConvert.DeserializeObject <Profile>(LocalResourceService.GetFile("getprofile")));
        }
Пример #3
0
        public async Task <IReadOnlyList <Visibility> > GetVisibilitiesAsync(bool forceRefresh = false)
        {
            // Let's fake some delay, to see all the fancy loaders!
            await Task.Delay(1000);

            return(JsonConvert.DeserializeObject <List <Visibility> >(LocalResourceService.GetFile("getvisibilities")));
        }
Пример #4
0
        public async Task <IReadOnlyList <ContributionCategory> > GetContributionAreasAsync(bool forceRefresh = false)
        {
            // Let's fake some delay, to see all the fancy loaders!
            await Task.Delay(1000);

            return(JsonConvert.DeserializeObject <List <ContributionCategory> >(LocalResourceService.GetFile("getcontributionareas")));
        }
Пример #5
0
        public override Task Initialize()
        {
            base.Initialize();

            var items = JsonConvert.DeserializeObject <List <OpenSourceSoftware> >(LocalResourceService.GetFile("oss"));

            Licenses = items.OrderBy(x => x.Id).ToList();

            return(Task.FromResult <object>(null));
        }
Пример #6
0
        public async Task <string> GetProfileImageAsync(bool forceRefresh = false, bool rawImage = false)
        {
            // Let's fake some delay, to see all the fancy loaders!
            await Task.Delay(1000);

            var image = LocalResourceService.GetFile("getprofileimage");

            image = image.TrimStart('"').TrimEnd('"');

            return(rawImage ? image : $"data:image/png;base64,{image}");
        }