コード例 #1
0
        private void SaveMessagesCheckbox_Unchecked(object sender, RoutedEventArgs e)
        {
            GuildObj guild = Guilds.FirstOrDefault(x => x.TextChannels.FirstOrDefault(y => y.Channel.Name == selectedChannel) != null);

            if (guild == null)
            {
                return;
            }
            ChannelObj channel = guild.TextChannels.FirstOrDefault(x => x.Channel.Name == selectedChannel);

            channel.SaveMessages    = (bool)SaveMessagesCheckbox.IsChecked;
            Client.MessageReceived -= channel.Client_MessageReceived;
        }
コード例 #2
0
        private void ChannelNames_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            MessagesTab.Items.Clear();
            ListBox box     = (ListBox)sender;
            string  content = (string)box.SelectedItem;

            Console.WriteLine("Content: " + content);
            selectedChannel = content;
            GuildObj guild = Guilds.FirstOrDefault(x => x.TextChannels.FirstOrDefault(y => y.Channel.Name == content) != null);

            if (guild == null)
            {
                return;
            }
            SaveMessagesCheckbox.Visibility = Visibility.Visible;
            ChannelObj channel = guild.TextChannels.FirstOrDefault(x => x.Channel.Name == content);

            UpdateMessageList(channel, true);
            SaveMessagesCheckbox.IsChecked = channel.SaveMessages;
        }
コード例 #3
0
        private void Servers_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            // set channels to second list view
            MessagesTab.Items.Clear();
            SaveMessagesCheckbox.Visibility = Visibility.Hidden;
            Console.WriteLine(sender.GetType());
            ListBox  box      = (ListBox)sender;
            Image    img      = (Image)box.SelectedItem;
            GuildObj guild    = Guilds.FirstOrDefault(x => x.Image == img.Source);
            ListBox  channels = ChannelNames;

            channels.Items.Clear();
            foreach (ChannelObj obj in guild.TextChannels)
            {
                //Application.Current.Dispatcher.BeginInvoke(
                //  DispatcherPriority.Background,
                //  new Action(() => channels.Items.Add(obj.Channel.Name)));
                channels.Items.Add(obj.Channel.Name);
            }
        }