void StreamsTab_TabItemSelected(object sender, TabItemEventArgs e)
        {
            var ti     = (OverviewColumnTabItem)e.TabItem;
            var stream = ti.Content as RealtimeStream;

            if (stream == null)
            {
                if (ti.Channel == null && String.IsNullOrEmpty(ti.Keyword))
                {
                    ClientStats.LogEventWithSegment("Change tab in realtime streams overview column", "All streams");

                    // All docked accounts tab
                    stream = new RealtimeStream(ti.Channel, ti.Keyword)
                    {
                        IsColumnView = true
                    };
                }
                else
                {
                    ClientStats.LogEventWithSegment("Change tab in realtime streams overview column", ti.Channel.Configuration.DisplayName);

                    stream = ControlCache.Get(ti.Channel, ti.Keyword, true);
                    stream.UpdateDockState();

                    // Disconnect from any parent that might hold the visual tree for our element
                    if (stream.Parent != null)
                    {
                        ((ContentControl)stream.Parent).Content = null;
                    }

                    stream.AfterUndock = delegate
                    {
                        stream.StatusUpdated -= Stream_StatusUpdated;
                        stream.AfterUndock    = null;
                    };
                }

                stream.StatusUpdated += Stream_StatusUpdated;

                ti.Content = stream;
            }

            // Updates visual appearance of tab control depending of wether we have a sub-tab or not
            StreamsTab.Tag = stream.SupportsMentions ? "StreamColumnWithMentions" : "StreamColumn";

            OnPropertyChanged("Channel");
        }
Example #2
0
        internal static RealtimeStream Get(ChannelInstance channel, string keyword, bool isColumnView)
        {
            RealtimeStream stream;

            if (!String.IsNullOrEmpty(keyword))
            {
                // Search stream
                if (!searchDict.ContainsKey(keyword))
                {
                    stream = new RealtimeStream(channel, keyword);

                    searchDict.Add(keyword, stream);
                }

                // Return cached copy
                var view = searchDict[keyword];
                view.IsColumnView = isColumnView;

                return view;
            }
            else
            {
                if (!channelsDict.ContainsKey(channel))
                {
                    stream = new RealtimeStream(channel, keyword);

                    channelsDict.Add(channel, stream);
                }

                var view = channelsDict[channel];
                view.IsColumnView = isColumnView;

                // Return cached copy
                return view;
            }
        }
        internal static RealtimeStream Get(ChannelInstance channel, string keyword, bool isColumnView)
        {
            RealtimeStream stream;

            if (!String.IsNullOrEmpty(keyword))
            {
                // Search stream
                if (!searchDict.ContainsKey(keyword))
                {
                    stream = new RealtimeStream(channel, keyword);

                    searchDict.Add(keyword, stream);
                }

                // Return cached copy
                var view = searchDict[keyword];
                view.IsColumnView = isColumnView;

                return(view);
            }
            else
            {
                if (!channelsDict.ContainsKey(channel))
                {
                    stream = new RealtimeStream(channel, keyword);

                    channelsDict.Add(channel, stream);
                }

                var view = channelsDict[channel];
                view.IsColumnView = isColumnView;

                // Return cached copy
                return(view);
            }
        }
        void StreamsTab_TabItemSelected(object sender, TabItemEventArgs e)
        {
            var ti = (OverviewColumnTabItem)e.TabItem;
            var stream = ti.Content as RealtimeStream;

            if (stream == null)
            {
                if (ti.Channel == null && String.IsNullOrEmpty(ti.Keyword))
                {
                    ClientStats.LogEventWithSegment("Change tab in realtime streams overview column", "All streams");

                    // All docked accounts tab
                    stream = new RealtimeStream(ti.Channel, ti.Keyword) { IsColumnView = true };
                }
                else
                {
                    ClientStats.LogEventWithSegment("Change tab in realtime streams overview column", ti.Channel.Configuration.DisplayName);

                    stream = ControlCache.Get(ti.Channel, ti.Keyword, true);
                    stream.UpdateDockState();

                    // Disconnect from any parent that might hold the visual tree for our element
                    if (stream.Parent != null)
                        ((ContentControl)stream.Parent).Content = null;

                    stream.AfterUndock = delegate
                    {
                        stream.StatusUpdated -= Stream_StatusUpdated;
                        stream.AfterUndock = null;
                    };
                }

                stream.StatusUpdated += Stream_StatusUpdated;

                ti.Content = stream;
            }

            // Updates visual appearance of tab control depending of wether we have a sub-tab or not
            StreamsTab.Tag = stream.SupportsMentions ? "StreamColumnWithMentions" : "StreamColumn";

            OnPropertyChanged("Channel");
        }