public async Task ExecuteLoadItemsCommand() { IsBusy = true; try { Guilds.Clear(); var guildsApiServises = new GuildApiServises(); var guilds = await guildsApiServises.SelectGuildsAsync(); var sortedGuilds = from g in guilds orderby g.Topposition select g; foreach (var guild in sortedGuilds) { Guilds.Add(guild); } } catch (Exception ex) { Debug.WriteLine(ex); } finally { IsBusy = false; } }
private async Task RefreshGuilds() { GuildsName.Clear(); Guilds.Clear(); var guildApiServises = new GuildApiServises(); var guilds = await guildApiServises.SelectGuildsAsync(); var sortedGuilds = from g in guilds orderby g.Name select g; foreach (var guild in sortedGuilds) { GuildsName.Add(guild.Name); Guilds.Add(guild); } }
async void CreateGuildClick(Object sender, EventArgs e) { if (NameForm.Text == null || ExForm.Text == null || MembersForm.Text == null || PositionForm.Text == null) { var toastmessage = "Need to fill everything"; DependencyService.Get <ToastMessage>().ShortTime(toastmessage); } else { var guildApiServises = new GuildApiServises(); var content = await guildApiServises.AddGuildAsync(NameForm.Text, ExForm.Text, MembersForm.Text, PositionForm.Text); if (content != null) { await Shell.Current.GoToAsync(".."); } else { var toastmessage = "Not Created"; DependencyService.Get <ToastMessage>().ShortTime(toastmessage); } } }