Example #1
0
        public async void LoadPage(User user, BeerListRequest beerRequest)
        {
            IsLoading = true;
            HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(new Uri(ResourceLoader.GetString("BeerListsEndpoint")));

            request.Headers["Cookie"] = user.Cookie;
            request.Method            = "POST";
            request.ContentType       = "application/json";

            byte[] data = Encoding.UTF8.GetBytes(beerRequest.ToString());

            using (var requestStream = await Task <Stream> .Factory.FromAsync(request.BeginGetRequestStream, request.EndGetRequestStream, null))
            {
                await requestStream.WriteAsync(data, 0, data.Length);
            }

            request.BeginGetResponse(new AsyncCallback(ReadCallback), request);
        }
Example #2
0
        private void ReloadPage()
        {
            _beersOfTheMonthViewModel.ClearList();
            _whatsNewViewModel.ClearList();

            var request = new BeerListRequest
            {
                Format      = 0,
                HideMyBeers = App.HideMyBeers,
                GroupID     = (int)GroupType.BeerOfTheMonth,
                IsFromGroup = true,
                UserID      = App.User.UserID
            };

            _beersOfTheMonthViewModel.LoadPage(App.User, request);

            request.GroupID = (int)GroupType.WhatsNew;

            _whatsNewViewModel.LoadPage(App.User, request);
        }