void TabHost_TabItemSelected(object sender, TabItemEventArgs e)
        {
            stopwatch.Stop();

            if (e.TabItem.Content == null && e.TabItem.Tag is IViewPlugin)
            {
                // Lazy-initialize the contents of the tabitem
                var view = (IViewPlugin) e.TabItem.Tag;

                e.TabItem.Content = view.CreateView();
            }

            string tabName;

            if (e.TabItem.Content is IControllableTab)
            {
                var tab = (IControllableTab) e.TabItem.Content;

                TabHost.HeaderContent = tab.CustomHeaderContent ?? dock;

                tabName = tab.Title;
            }
            else
            {
                TabHost.HeaderContent = dock;

                tabName = dock.GetType().ToString().Split('.').Last();
            }

            // Switch focus to first responder (if any)
            if (e.TabItem.Content as FrameworkElement != null)
                e.TabItem.FocusFirstResponder();

            stopwatch.Start();

            ClientStats.LogEventWithTime("Trace Closed", (int)stopwatch.Elapsed.TotalMinutes);
            ClientStats.CreateNewTrace();
            ClientStats.LogEventWithSegment("Switch to tab", e.TabItem.WellKnownView.ToString());

            EventBroker.Publish(AppEvents.TabChanged, tabName);
        }
Пример #2
0
 void TabControl_TabItemSelected(object sender, TabItemEventArgs e)
 {
     if (!visited.Contains(e.TabItem))
         visited.Add(e.TabItem);
 }
Пример #3
0
        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");
        }