示例#1
0
 public CommandContext(SmartBar bar, Control control, RoutedEventArgs eventArgs)
 {
     View      = bar.View;
     _Bar      = bar;
     Sender    = control;
     EventArgs = eventArgs;
 }
示例#2
0
            public SymbolMenuItem(SmartBar bar, ISymbol symbol, string alias, IEnumerable <Location> locations) : base(bar, new CommandItem(symbol, alias))
            {
                Locations = locations;
                Symbol    = symbol;
                var b = UIHelper.GetBrush(Symbol.Name, true);

                if (b != null)
                {
                    var h = Header as TextBlock;
                    h.Inlines.InsertBefore(h.Inlines.FirstInline, new System.Windows.Documents.InlineUIContainer(new System.Windows.Shapes.Rectangle {
                        Height = 16, Width = 16, Fill = b, Margin = WpfHelper.GlyphMargin
                    })
                    {
                        BaselineAlignment = BaselineAlignment.TextTop
                    });
                }
                //todo compatible with symbols having more than 1 locations
                if (locations != null && locations.Any(l => l.SourceTree?.FilePath != null))
                {
                    Click += GotoLocation;
                }
                if (Symbol != null)
                {
                    ToolTip         = "";
                    ToolTipOpening += ShowToolTip;
                }
            }
示例#3
0
 public SymbolMenuItem(SmartBar bar, ISymbol symbol, string alias, IEnumerable <Location> locations) : base(bar, new CommandItem(symbol, alias))
 {
     Locations = locations;
     Symbol    = symbol;
     if (symbol.Kind == SymbolKind.Field)
     {
         var f = symbol as IFieldSymbol;
         if (f.HasConstantValue)
         {
             InputGestureText = f.ConstantValue?.ToString();
         }
         //else {
         //	InputGestureText = f.Type.Name;
         //}
     }
     //else {
     //	InputGestureText = symbol.GetReturnType()?.Name;
     //}
     SetColorPreviewIcon(symbol);
     //todo deal with symbols with multiple locations
     if (locations != null && locations.Any(l => l.SourceTree?.FilePath != null))
     {
         Click += GotoLocation;
     }
     if (Symbol != null)
     {
         ToolTip         = String.Empty;
         ToolTipOpening += ShowToolTip;
     }
 }
示例#4
0
 public CommandMenuItem(SmartBar bar, CommandItem item)
 {
     SmartBar    = bar;
     CommandItem = item;
     Icon        = ThemeHelper.GetImage(item.ImageId);
     Header      = new TextBlock {
         Text = item.Name
     };
     item.ItemInitializer?.Invoke(this);
     // the action is installed only when called by this method
     if (item.Action != null)
     {
         Click += ClickHandler;
     }
 }
示例#5
0
 public CommandContext(SmartBar bar, Control control, RoutedEventArgs eventArgs, bool rightClick) : this(bar, control, eventArgs)
 {
     RightClick = rightClick;
 }
示例#6
0
 public SymbolMenuItem(SmartBar bar, ISymbol symbol, IEnumerable <Location> locations) : this(bar, symbol, symbol.ToDisplayString(__MemberNameFormat), locations)
 {
 }