Exemple #1
0
 public CommandContext(SmartBar bar, Control control, RoutedEventArgs eventArgs)
 {
     View      = bar.View;
     _Bar      = bar;
     Sender    = control;
     EventArgs = eventArgs;
 }
Exemple #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;
                }
            }
Exemple #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;
     }
 }
Exemple #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;
     }
 }
Exemple #5
0
 public CommandContext(SmartBar bar, Control control, RoutedEventArgs eventArgs, bool rightClick) : this(bar, control, eventArgs)
 {
     RightClick = rightClick;
 }
Exemple #6
0
 public SymbolMenuItem(SmartBar bar, ISymbol symbol, IEnumerable <Location> locations) : this(bar, symbol, symbol.ToDisplayString(__MemberNameFormat), locations)
 {
 }