public SearchResultTabItem(string name, double headerWidth, double headerHeight, Brush headerTextBrush, SearchResultsPanelControl searchResultsPanel)
            : base()
        {
            // keep references to useful fields
            _name = name;
            _searchResultsPanel = searchResultsPanel;

            // setup tab header's grid
            Grid headerGrid = new Grid
            {
                Width  = headerWidth,
                Height = headerHeight,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Center
            };

            headerGrid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(4, GridUnitType.Star)
            });
            headerGrid.ColumnDefinitions.Add(new ColumnDefinition {
                Width = new GridLength(1, GridUnitType.Star)
            });

            // close category name button
            _closeButton = new Button
            {
                Content = new TextBlock {
                    Text = "X", Foreground = headerTextBrush
                },
                Width  = 15,
                Height = 15,
                HorizontalAlignment = HorizontalAlignment.Right,
                VerticalAlignment   = VerticalAlignment.Center,
                Cursor  = Cursors.Hand,
                ToolTip = "Close Search"
            };
            _closeButton.Click += new RoutedEventHandler(OnClose);
            Grid.SetColumn(_closeButton, 1);

            // category name textblock
            TextBlock label = new TextBlock
            {
                Text                = name,
                Foreground          = headerTextBrush,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Center
            };

            Grid.SetColumn(label, 0);

            // setup tab
            headerGrid.Children.Add(label);
            headerGrid.Children.Add(_closeButton);
            Header  = headerGrid;
            Content = searchResultsPanel;
        }
        public SearchResultTabItem(string name, double headerWidth, double headerHeight, Brush headerTextBrush, SearchResultsPanelControl searchResultsPanel)
            : base()
        {
            // keep references to useful fields
            _name = name;
            _searchResultsPanel = searchResultsPanel;

            // setup tab header's grid
            Grid headerGrid = new Grid
            {
                Width = headerWidth,
                Height = headerHeight,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment = VerticalAlignment.Center
            };
            headerGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(4, GridUnitType.Star) });
            headerGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) });

            // close category name button
            _closeButton = new Button
            {
                Content = new TextBlock { Text = "X", Foreground = headerTextBrush },
                Width = 15,
                Height = 15,
                HorizontalAlignment = HorizontalAlignment.Right,
                VerticalAlignment = VerticalAlignment.Center,
                Cursor = Cursors.Hand,
                ToolTip = "Close Search"
            };
            _closeButton.Click += new RoutedEventHandler(OnClose);
            Grid.SetColumn(_closeButton, 1);

            // category name textblock
            TextBlock label = new TextBlock
            {
                Text = name,
                Foreground = headerTextBrush,
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment = VerticalAlignment.Center
            };
            Grid.SetColumn(label, 0);

            // setup tab
            headerGrid.Children.Add(label);
            headerGrid.Children.Add(_closeButton);
            Header = headerGrid;
            Content = searchResultsPanel;
        }
Ejemplo n.º 3
0
 private TabItem CreateSearchTab(string keyword, SearchResultsPanelControl searchResultsPanel)
 {
     SearchResultTabItem tab = new SearchResultTabItem(keyword, 90, 30, Brushes.White, searchResultsPanel);
     tab.Style = FindResource("GenericTabItem") as Style;
     tab.CloseButtonStyle = FindResource("GenericButton") as Style;
     tab.Close += new RoutedEventHandler(searchTabClose_Click);
     return tab;
 }
Ejemplo n.º 4
0
        private TabItem CreateSearch(string keyword)
        {
            // create saved search
            SearchManager theSearch = _twitter.SavedSearchesManager.CreateSearch(
                keyword,
                SearchManager_OperationCompleted,
                SearchManager_OperationError
            );
            theSearch.SearchAsync();

            // create search results panel
            SearchResultsPanelControl searchResultsPanel = new SearchResultsPanelControl(keyword);
            searchResultsPanel.ItemsSource = theSearch.All;
            searchResultsPanel.TextLoaded += new RoutedEventHandler(TextBlock_Loaded);
            searchResultsPanel.MoreResultsClicked += new SearchResultsPanelControl.MoreSearchResultsClickedEventHandler(MoreResults_Click);
            searchResultsPanel.AvatarClicked += new MouseButtonEventHandler(imgAvatar_MouseDown);
            return CreateSearchTab(keyword, searchResultsPanel);
        }
 public void Dispose()
 {
     _searchResultsPanel.Dispose();
     _searchResultsPanel = null;
 }
 public void Dispose()
 {
     _searchResultsPanel.Dispose();
     _searchResultsPanel = null;
 }