/// <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")); }