Beispiel #1
0
 public ToolPaneCommandTarget(ICommandService commandManager, AssetPopup assetPopup)
 {
     this.AddCommand("ToolPane_OpenAssetToolPopup", (Microsoft.Expression.Framework.Commands.ICommand) new ToolPane.ToolPaneCommandTarget.OpenAssetToolPopupCommand(assetPopup));
     commandManager.SetCommandPropertyDefault("ToolPane_OpenAssetToolPopup", "Shortcuts", (object)new KeyBinding[1]
     {
         new KeyBinding()
         {
             Modifiers = ModifierKeys.Control,
             Key       = Key.OemPeriod
         }
     });
 }
Beispiel #2
0
        private void CreateAssetPopupAndButton(DesignerContext designerContext, ToolContext toolContext)
        {
            ToggleButton button = new ToggleButton();

            button.Name    = "AssetToolMoreButton";
            button.ToolTip = (object)StringTable.AssetToolMoreButtonToolTip;
            button.SetResourceReference(FrameworkElement.StyleProperty, (object)"MoreButtonStyle");
            this.currentToolGroupPanel.Children.Add((UIElement)button);
            AssetPopup assetPopup = new AssetPopup(designerContext.AssetLibrary, designerContext.Configuration);

            assetPopup.PlacementTarget = (UIElement)button;
            button.ClickMode           = ClickMode.Press;
            button.Checked            += (RoutedEventHandler)((s, e) => assetPopup.IsOpen = true);
            assetPopup.Closed         += (EventHandler)((s, e) => button.IsChecked = new bool?(false));
            assetPopup.SetBinding(Popup.PlacementProperty, (BindingBase) new Binding()
            {
                Source    = (object)this.ToolsRoot,
                Path      = new PropertyPath("Orientation", new object[0]),
                Converter = (IValueConverter) new InverseOrientationToPopupPlacementConverter(),
                Mode      = BindingMode.OneWay
            });
            ICommandService commandService = this.designerContext.CommandService;

            commandService.AddTarget((ICommandTarget) new ToolPane.ToolPaneCommandTarget(commandService, assetPopup));
            assetPopup.AssetView.SelectedAssetChanged += (EventHandler <AssetEventArgs>)((s, e) => toolContext.AssetMruList.OnSelectAsset(e.Asset));
            assetPopup.AssetView.AssetSingleClicked   += (EventHandler <AssetEventArgs>)((s, e) => assetPopup.IsOpen = false);
            assetPopup.Closed += (EventHandler)((s, e) =>
            {
                toolContext.AssetMruList.ActivateAssetTool();
                if (designerContext.ActiveView == null)
                {
                    return;
                }
                designerContext.ActiveView.ReturnFocus();
            });
        }
Beispiel #3
0
 public OpenAssetToolPopupCommand(AssetPopup assetPopup)
 {
     this.assetPopup = assetPopup;
 }