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(); }
public static void SetSortingVariant(SortingVariants sortingVariant) { SortingVariant = sortingVariant; }
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>()); } }