예제 #1
0
        private async Task Client_ChannelCreated(IChannel arg)
        {
            if (arg is IDMChannel && !group)
            {
                await Dispatcher.InvokeAsync(() => channelsList.Items.Clear());

                foreach (IDMChannel channel in App.DiscordWindow.Client.DMChannels)
                {
                    await Dispatcher.InvokeAsync(() =>
                    {
                        DMChannelViewer viewer = new DMChannelViewer(channel);
                        channelsList.Items.Add(viewer);
                    });
                }
            }
            else if (arg is IGroupChannel && group)
            {
                await Dispatcher.InvokeAsync(() => channelsList.Items.Clear());

                foreach (IGroupChannel channel in App.DiscordWindow.Client.GroupChannels)
                {
                    await Dispatcher.InvokeAsync(() =>
                    {
                        DMChannelViewer viewer = new DMChannelViewer(channel);
                        channelsList.Items.Add(viewer);
                    });
                }
            }
        }
예제 #2
0
        public DMGuildViewer(IEnumerable <IDMChannel> channels)
        {
            InitializeComponent();

            guildName.Text        = "Direct Messages";
            guildDescription.Text = channels.Count(c => c.Recipient.Status == UserStatus.Online) + " users online";

            foreach (IDMChannel channel in channels)
            {
                DMChannelViewer viewer = new DMChannelViewer(channel);
                channelsList.Items.Add(viewer);
            }

            App.DiscordWindow.Client.ChannelCreated += Client_ChannelCreated;
        }
예제 #3
0
        public DMGuildViewer(IEnumerable <IGroupChannel> channels)
        {
            InitializeComponent();
            if (channels.Any())
            {
                group                 = true;
                guildName.Text        = "Group Channels";
                guildDescription.Text = channels.Count() + " groups";

                foreach (IGroupChannel channel in channels)
                {
                    DMChannelViewer viewer = new DMChannelViewer(channel);
                    channelsList.Items.Add(viewer);
                }

                App.DiscordWindow.Client.ChannelCreated += Client_ChannelCreated;
            }
            else
            {
                Visibility = Visibility.Collapsed;
            }
        }