private IActionSet CreateActions()
        {
            var toolType = typeof (CustomizeViewerActionModelTool);
            var resolver = new ActionResourceResolver(toolType);

            var idPrefix = toolType.FullName + ":";
            var mainMenuAction = new MenuAction(idPrefix + _mainMenuCustomizeId,
                                                new ActionPath("global-menus/MenuTools/MenuCustomizeActionModels", resolver),
                                                ClickActionFlags.None, resolver)
                                     {
                                         GroupHint = new GroupHint(_groupHint),
                                         Label = SR.MenuCustomizeActionModels,
                                         Persistent = true
                                     };
            mainMenuAction.SetClickHandler(Customize);

            var contextMenuAction = new ContextMenuAction(idPrefix + _contextMenuCustomizeId,
                                                   new ActionPath(ImageViewerComponent.ContextMenuSite +"/MenuCustomizeActionModels", resolver),
                                                   ClickActionFlags.None, resolver)
                                        {
                                            GroupHint = new GroupHint(_groupHint),
                                            Label = SR.MenuCustomizeActionModels,
                                            Persistent = true
                                        };

            contextMenuAction.SetClickHandler(Customize);
            contextMenuAction.Initialize(mainMenuAction);

            return new ActionSet(new[] {mainMenuAction, contextMenuAction});
        }
Esempio n. 2
0
			/// <summary>
			/// Gets an appropriate icon overlay to indicate the mouse button assigned to the associated tool.
			/// </summary>
			/// <param name="iconSize">The desired version of the icon overlay.</param>
			/// <returns>The icon overlay as an <see cref="Image"/>.</returns>
			public Image GetButtonOverlay(IconSize iconSize)
			{
				string[] resourceNames;
				switch (_assignedButton)
				{
					case XMouseButtons.Left:
						resourceNames = new string[] {"BaseTools.LeftMouseButtonOverlaySmall.png", "BaseTools.LeftMouseButtonOverlayMedium.png", "BaseTools.LeftMouseButtonOverlayLarge.png"};
						break;
					case XMouseButtons.Right:
						resourceNames = new string[] {"BaseTools.RightMouseButtonOverlaySmall.png", "BaseTools.RightMouseButtonOverlayMedium.png", "BaseTools.RightMouseButtonOverlayLarge.png"};
						break;
					case XMouseButtons.Middle:
						resourceNames = new string[] {"BaseTools.MiddleMouseButtonOverlaySmall.png", "BaseTools.MiddleMouseButtonOverlayMedium.png", "BaseTools.MiddleMouseButtonOverlayLarge.png"};
						break;
					case XMouseButtons.XButton1:
						resourceNames = new string[] {"BaseTools.X1MouseButtonOverlaySmall.png", "BaseTools.X1MouseButtonOverlayMedium.png", "BaseTools.X1MouseButtonOverlayLarge.png"};
						break;
					case XMouseButtons.XButton2:
						resourceNames = new string[] {"BaseTools.X2MouseButtonOverlaySmall.png", "BaseTools.X2MouseButtonOverlayMedium.png", "BaseTools.X2MouseButtonOverlayLarge.png"};
						break;
					case XMouseButtons.None:
					default:
						return null;
				}

				IResourceResolver resourceResolver = new ActionResourceResolver(GetType());
				switch (iconSize)
				{
					case IconSize.Small:
						return new Bitmap(resourceResolver.OpenResource(resourceNames[0]));
					case IconSize.Medium:
						return new Bitmap(resourceResolver.OpenResource(resourceNames[1]));
					case IconSize.Large:
					default:
						return new Bitmap(resourceResolver.OpenResource(resourceNames[2]));
				}
			}
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <remarks>
 /// A no-args constructor is required by the framework.  Do not remove.
 /// </remarks>
 public SegmentationTool()
 {
     _desktopWindow = null;
     _resolver = new ActionResourceResolver(this);
 }