示例#1
0
 public DocItem(CSharpBar bar, ISymbol syntaxTree)
 {
     _Bar        = bar;
     _SyntaxTree = syntaxTree;
     Header      = new ThemedMenuText(syntaxTree.GetOriginalName());
     Icon        = ThemeHelper.GetImage(KnownImageIds.CSFileNode);
     Opacity     = 0.8;
 }
示例#2
0
            void AddNaviBar(object sender, RoutedEventArgs e)
            {
                _View.VisualElement.Loaded -= AddNaviBar;

                var view    = sender as FrameworkElement;
                var naviBar = view
                              ?.GetParent <Border>(b => b.Name == "PART_ContentPanel")
                              ?.GetFirstVisualChild <Border>(b => b.Name == "DropDownBarMargin");

                if (naviBar == null)
                {
                    var naviBarHolder = view.GetParent <Panel>(b => b.GetType().Name == "WpfMultiViewHost");
                    if (naviBarHolder != null)
                    {
                        var b = new MarkdownBar(_View, _TextSearch);
                        DockPanel.SetDock(b, Dock.Top);
                        if (naviBarHolder.Children.Count == 1)
                        {
                            naviBarHolder.Children.Insert(0, b);
                        }
                        else
                        {
                            var c = naviBarHolder.Children[0] as ContentControl;
                            if (c != null && c.Content == null)
                            {
                                c.Content = b;
                            }
                        }
                    }
                    return;
                }
                var dropDown1 = naviBar.GetFirstVisualChild <ComboBox>(c => c.Name == "DropDown1");
                var dropDown2 = naviBar.GetFirstVisualChild <ComboBox>(c => c.Name == "DropDown2");

                if (dropDown1 == null || dropDown2 == null)
                {
                    return;
                }
                var container = dropDown1.GetParent <Grid>();

                if (container == null)
                {
                    return;
                }
                var bar = new CSharpBar(_View)
                {
                    MinWidth = 200
                };

                bar.SetCurrentValue(Grid.ColumnProperty, 2);
                bar.SetCurrentValue(Grid.ColumnSpanProperty, 3);
                container.Children.Add(bar);
                dropDown1.Visibility = Visibility.Hidden;
                dropDown2.Visibility = Visibility.Hidden;
                naviBar.Unloaded    += ResurrectNaviBar_OnUnloaded;
            }
示例#3
0
 public NodeItem(CSharpBar bar, SyntaxNode node)
 {
     _Bar     = bar;
     _ImageId = node.GetImageId();
     Header   = new ThemedMenuText(node.GetDeclarationSignature() ?? String.Empty);
     Node     = node;
     Icon     = ThemeHelper.GetImage(_ImageId);
     this.ReferenceCrispImageBackground(EnvironmentColors.MainWindowActiveCaptionColorKey);
     SetResourceReference(ForegroundProperty, VsBrushes.CommandBarTextActiveKey);
     Click += HandleClick;
 }
示例#4
0
 public RootItem(CSharpBar bar)
 {
     _Bar = bar;
     Icon = ThemeHelper.GetImage(KnownImageIds.Namespace);
     this.ReferenceCrispImageBackground(EnvironmentColors.MainWindowActiveCaptionColorKey);
     SetResourceReference(ForegroundProperty, VsBrushes.CommandBarTextActiveKey);
     Header = new ThemedToolBarText();
     _Menu  = new SymbolList(bar._SemanticContext)
     {
         Container     = _Bar._SymbolListContainer,
         ContainerType = SymbolListType.NodeList,
         Header        = new StackPanel {
             Margin   = WpfHelper.MenuItemMargin,
             Children =
             {
                 new Separator  {
                     Tag = new ThemedMenuText("Search Declaration")
                 },
                 new StackPanel {
                     Orientation = Orientation.Horizontal,
                     Children    =
                     {
                         ThemeHelper.GetImage(KnownImageIds.SearchContract).WrapMargin(WpfHelper.GlyphMargin),
                         (_FinderBox = new MemberFinderBox()
                         {
                             MinWidth = 150
                         }),
                         (_ScopeBox = new SearchScopeBox{
                             Contents =
                             {
                                 new ThemedButton(KnownImageIds.StopFilter, "Clear filter", ClearFilter).ClearBorder()
                             }
                         }),
                     }
                 },
             }
         },
         Footer = _Note = new TextBlock {
             Margin = WpfHelper.MenuItemMargin
         }
         .ReferenceProperty(TextBlock.ForegroundProperty, EnvironmentColors.SystemGrayTextBrushKey)
     };
     _Bar.SetupSymbolListMenu(_Menu);
     _FinderBox.TextChanged  += SearchCriteriaChanged;
     _ScopeBox.FilterChanged += SearchCriteriaChanged;
     _ScopeBox.FilterChanged += (s, args) => _FinderBox.Focus();
 }
示例#5
0
 public NaviItem(CSharpBar bar, SyntaxNode node, Action <NaviItem> initializer, Action <NaviItem> clickHandler)
 {
     Node         = node;
     ClickHandler = clickHandler;
     _Bar         = bar;
     _ImageId     = node.GetImageId();
     Icon         = ThemeHelper.GetImage(_ImageId);
     initializer?.Invoke(this);
     this.ReferenceCrispImageBackground(EnvironmentColors.MainWindowActiveCaptionColorKey);
     SetResourceReference(ForegroundProperty, VsBrushes.CommandBarTextActiveKey);
     if (Config.Instance.NaviBarOptions.MatchFlags(NaviBarOptions.SymbolToolTip))
     {
         ToolTip         = String.Empty;
         ToolTipOpening += NaviItem_ToolTipOpening;
     }
     Click += NaviItem_Click;
 }
示例#6
0
 public RootItem(CSharpBar bar)
 {
     _Bar = bar;
     Icon = ThemeHelper.GetImage(KnownImageIds.Namespace);
     this.ReferenceCrispImageBackground(EnvironmentColors.MainWindowActiveCaptionColorKey);
     SetResourceReference(ForegroundProperty, VsBrushes.CommandBarTextActiveKey);
     Header        = new ThemedToolBarText();
     SubMenuHeader = new StackPanel {
         Margin   = WpfHelper.MenuItemMargin,
         Children =
         {
             new Separator  {
                 Tag = new ThemedMenuText("Search Declaration")
             },
             new StackPanel {
                 Orientation = Orientation.Horizontal,
                 Children    =
                 {
                     ThemeHelper.GetImage(KnownImageIds.SearchContract).WrapMargin(WpfHelper.GlyphMargin),
                     (_FinderBox = new MemberFinderBox(Items)
                     {
                         MinWidth = 150
                     }),
                     (_ScopeBox = new SearchScopeBox{
                         Contents =
                         {
                             new ThemedButton(KnownImageIds.StopFilter, "Clear filter", ClearFilter).ClearBorder().ClearMargin()
                         }
                     }),
                 }
             },
         }
     };
     SubmenuOpened           += RootItem_SubmenuOpened;
     _FinderBox.TextChanged  += SearchCriteriaChanged;
     _ScopeBox.FilterChanged += SearchCriteriaChanged;
     _ScopeBox.FilterChanged += (s, args) => {
         _FinderBox.Focus();
     };
 }
示例#7
0
            void FindNaviBar(object sender, RoutedEventArgs e)
            {
                var view    = sender as FrameworkElement;
                var naviBar = view
                              ?.GetParent <Border>(b => b.Name == "PART_ContentPanel")
                              ?.GetFirstVisualChild <Border>(b => b.Name == "DropDownBarMargin");

                if (naviBar == null)
                {
                    goto EXIT;
                }
                var dropDown1 = naviBar.GetFirstVisualChild <ComboBox>(c => c.Name == "DropDown1");
                var dropDown2 = naviBar.GetFirstVisualChild <ComboBox>(c => c.Name == "DropDown2");

                if (dropDown1 == null || dropDown2 == null)
                {
                    goto EXIT;
                }
                var container = dropDown1.GetParent <Grid>();

                if (container == null)
                {
                    goto EXIT;
                }
                var bar = new CSharpBar(_View)
                {
                    MinWidth = 200
                };

                bar.SetCurrentValue(Grid.ColumnProperty, 2);
                bar.SetCurrentValue(Grid.ColumnSpanProperty, 3);
                container.Children.Add(bar);
                dropDown1.Visibility = Visibility.Hidden;
                dropDown2.Visibility = Visibility.Hidden;
EXIT:
                UnloadEvents();
            }
示例#8
0
 public NaviItem(CSharpBar bar, SyntaxNode node, bool highlight, bool includeParameterList) : this(bar, node, null, null)
 {
     SetHeader(node, false, highlight, includeParameterList);
 }
示例#9
0
 public NaviItem(CSharpBar bar, SyntaxNode node) : this(bar, node, false, false)
 {
 }