Example #1
0
        private async void Pivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (pivot.SelectedIndex == 1 && !LoadingInvites)
            {
                InviteView.Items.Clear();
                NoInvites.Opacity     = 0;
                LoadingInvite.Opacity = 1;
                LoadingInvites        = true;
                IEnumerable <Invite> invites = null;
                await Task.Run(async() =>
                {
                    invites = await RESTCalls.GetChannelInvites(channelId);
                });

                if (invites != null)
                {
                    foreach (var invite in invites)
                    {
                        InviteView.Items.Add(invite);
                    }
                    LoadingInvite.Fade(0, 200).Start();
                }
                if (InviteView.Items.Count == 0)
                {
                    NoInvites.Fade(0.2f, 200).Start();
                    LoadingInvite.Fade(0, 200).Start();
                }
            }
        }
Example #2
0
        private async void Pivot_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if ((pivot.SelectedItem as PivotItem) == Invites && !LoadingInvites)
            {
                InviteView.Items.Clear();
                NoInvites.Opacity     = 0;
                LoadingInvite.Opacity = 1;
                LoadingInvites        = true;
                IEnumerable <Invite> invites = null;
                await Task.Run(async() =>
                {
                    invites = await RESTCalls.GetChannelInvites(guildId);
                });

                if (invites != null)
                {
                    foreach (var invite in invites)
                    {
                        InviteView.Items.Add(invite);
                    }
                    LoadingInvite.Fade(0, 200).Start();
                }
                if (InviteView.Items.Count == 0)
                {
                    NoInvites.Fade(0.2f, 200).Start();
                    LoadingInvite.Fade(0, 200).Start();
                }
            }
            else if ((pivot.SelectedItem as PivotItem) == Bans && !loadingBans)
            {
                BanView.Items.Clear();
                NoBans.Opacity      = 0;
                LoadingBans.Opacity = 1;
                loadingBans         = true;
                IEnumerable <Ban> bans = null;
                await Task.Run(async() =>
                {
                    bans = await RESTCalls.GetGuildBans(guildId);
                });

                if (bans != null)
                {
                    foreach (var ban in bans)
                    {
                        ban.GuildId = guildId;
                        BanView.Items.Add(ban);
                    }
                    LoadingBans.Fade(0, 200).Start();
                }
                if (BanView.Items.Count == 0)
                {
                    NoBans.Fade(0.2f, 200).Start();
                    LoadingBans.Fade(0, 200).Start();
                }
            }
        }