Example #1
0
        public void SetUpSteps()
        {
            AddStep("Add Public Channels", () =>
            {
                for (int i = 0; i < 10; i++)
                {
                    channelList.AddChannel(createRandomPublicChannel());
                }
            });

            AddStep("Add Private Channels", () =>
            {
                for (int i = 0; i < 10; i++)
                {
                    channelList.AddChannel(createRandomPrivateChannel());
                }
            });

            AddStep("Add Announce Channels", () =>
            {
                for (int i = 0; i < 2; i++)
                {
                    channelList.AddChannel(createRandomAnnounceChannel());
                }
            });
        }
Example #2
0
        private void joinedChannelsChanged(object sender, NotifyCollectionChangedEventArgs args)
        {
            switch (args.Action)
            {
            case NotifyCollectionChangedAction.Add:
                IEnumerable <Channel> newChannels = args.NewItems.OfType <Channel>().Where(isChatChannel);

                foreach (var channel in newChannels)
                {
                    channelList.AddChannel(channel);
                }

                break;

            case NotifyCollectionChangedAction.Remove:
                IEnumerable <Channel> leftChannels = args.OldItems.OfType <Channel>().Where(isChatChannel);

                foreach (var channel in leftChannels)
                {
                    channelList.RemoveChannel(channel);

                    if (loadedChannels.ContainsKey(channel))
                    {
                        ChatOverlayDrawableChannel loaded = loadedChannels[channel];
                        loadedChannels.Remove(channel);
                        // DrawableChannel removed from cache must be manually disposed
                        loaded.Dispose();
                    }
                }

                break;
            }
        }
Example #3
0
        private void joinedChannelsChanged(object sender, NotifyCollectionChangedEventArgs args)
        {
            switch (args.Action)
            {
            case NotifyCollectionChangedAction.Add:
                IEnumerable <Channel> joinedChannels = filterChannels(args.NewItems);
                foreach (var channel in joinedChannels)
                {
                    channelList.AddChannel(channel);
                }
                break;

            case NotifyCollectionChangedAction.Remove:
                IEnumerable <Channel> leftChannels = filterChannels(args.OldItems);
                foreach (var channel in leftChannels)
                {
                    channelList.RemoveChannel(channel);
                }
                break;
            }
        }