public PresetVoiLutActionContainer(WindowLevelTool ownerTool, string actionSite, PresetVoiLut preset, int index) { _ownerTool = ownerTool; _preset = preset; string actionId = String.Format("apply{0}", _preset.Operation.Name); ActionPlaceholder actionPlaceholder = ownerTool.FindActionPlaceholder(actionSite); _action = actionPlaceholder.CreateMenuAction(actionId, string.Format("presetLut{0}", index), ClickActionFlags.None, ownerTool._resolver); _action.Label = _preset.Operation.Name; _action.KeyStroke = _preset.KeyStroke; _action.SetClickHandler(this.Apply); }
private static IClickAction CreateLoadingPriorsAction(ActionPlaceholder actionPlaceholder, string basePath, int number) { const string actionIdPrefix = "loadingPriors"; Path pathSuffix = new Path(basePath); pathSuffix = pathSuffix.SubPath(1, pathSuffix.Segments.Count - 1); pathSuffix = pathSuffix.Append(new PathSegment(actionIdPrefix)); string actionId = actionIdPrefix + number; var action = actionPlaceholder.CreateMenuAction(actionId, pathSuffix.ToString(), ClickActionFlags.None, null); action.Label = SR.LabelLoadingPriors; action.SetClickHandler(delegate { }); return(action); }
/// <summary> /// Gets an array of <see cref="IAction"/> objects that allow selection of specific display /// sets for display in the currently selected image box. /// </summary> /// <returns></returns> private IActionSet GetDisplaySetActions() { #if TRACEGROUPS TraceGroups(); #endif const string rootPath = _contextMenuSite; _currentPathElements = new List <string>(); List <IAction> actions = new List <IAction>(); FilteredGroup <IImageSet> rootGroup = GetRootGroup(_imageSetGroups.Root); if (rootGroup != null) { var actionPlaceholder = ActionPlaceholder.GetPlaceholderAction(_contextMenuSite, base.Actions, _placeHolderActionId); ActionFactoryContext context = new ActionFactoryContext { DesktopWindow = Context.DesktopWindow, ImageViewer = Context.Viewer, Namespace = GetType().FullName, ActionPlaceholder = actionPlaceholder }; bool showImageSetNames = base.ImageViewer.LogicalWorkspace.ImageSets.Count > 1; int loadingPriorsNumber = 0; foreach (FilteredGroup <IImageSet> group in TraverseImageSetGroups(rootGroup, rootPath)) { string basePath = StringUtilities.Combine(_currentPathElements, "/"); //not incredibly efficient, but there really aren't that many items. List <IImageSet> orderedItems = new List <IImageSet>(group.Items); orderedItems.Sort(_comparer); foreach (IImageSet imageSet in orderedItems) { string imageSetPath; if (showImageSetNames) { imageSetPath = String.Format("{0}/{1}", basePath, imageSet.Name.Replace("/", "-")); } else { imageSetPath = basePath; } context.Initialize(imageSet, imageSetPath); foreach (IActionFactory factory in _actionFactories) { actions.AddRange(factory.CreateActions(context)); } if (actions.Count == 0 || !context.ExcludeDefaultActions) { actions.AddRange(_defaultActionFactory.CreateActions(context)); } } if (group.Items.Count > 0 && base.ImageViewer.PriorStudyLoader.IsActive) { actions.Add(CreateLoadingPriorsAction(actionPlaceholder, basePath, ++loadingPriorsNumber)); } } } return(new ActionSet(actions)); }
private ActionPlaceholder FindActionPlaceholder(string actionSite) { // note that we use base.Actions here because this method is called by CreateActions and we don't want a stack overflow return(ActionPlaceholder.GetPlaceholderAction(actionSite, base.Actions, "auto")); }
private static IClickAction CreateLoadingPriorsAction(ActionPlaceholder actionPlaceholder, string basePath, int number) { const string actionIdPrefix = "loadingPriors"; Path pathSuffix = new Path(basePath); pathSuffix = pathSuffix.SubPath(1, pathSuffix.Segments.Count - 1); pathSuffix = pathSuffix.Append(new PathSegment(actionIdPrefix)); string actionId = actionIdPrefix + number; var action = actionPlaceholder.CreateMenuAction(actionId, pathSuffix.ToString(), ClickActionFlags.None, null); action.Label = SR.LabelLoadingPriors; action.SetClickHandler(delegate { }); return action; }