コード例 #1
0
 private async Task ChangeSortingVariant(SortingVariants sortingVariant)
 {
     if (Controller.GetCurrentLanguage() == null)
     {
         MessageBox.Show("Choose Language first");
         return;
     }
     Controller.SetSortingVariant(sortingVariant);
     pageCounter = 0;
     await ChangePageNumber();
     await PopulateWordPriorities();
 }
コード例 #2
0
 public static void SetSortingVariant(SortingVariants sortingVariant)
 {
     SortingVariant = sortingVariant;
 }
コード例 #3
0
        public static async Task <List <WordPriority> > GetWordsPriorities(this Account account, int amount, int offset, string language, SortingVariants sortingVariant = SortingVariants.Id)
        {
            try{
                HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Post, url + "GetWordsPriorities");
                request.Headers.Add("Authorization", "Bearer " + account.Token);
                var content = JsonConvert.SerializeObject(new WordsPrioritiesPostModel()
                {
                    Amount = amount, language = language, Offset = offset, SortingVariant = sortingVariant
                });
                request.Content = new StringContent(content, Encoding.UTF8, "application/json");
                HttpResponseMessage hrm = await httpClient.SendAsync(request);

                hrm.EnsureSuccessStatusCode();
                string response = await hrm.Content.ReadAsStringAsync();

                List <WordPriority> phrases = JsonConvert.DeserializeObject <List <WordPriority> >(response);
                return(phrases);
            } catch (Exception e) {
                return(new List <WordPriority>());
            }
        }