예제 #1
0
			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);
			}
        public override IActionSet GetExportedActions(string site, ClearCanvas.ImageViewer.InputManagement.IMouseInformation mouseInformation)
        {
            IResourceResolver resolver = new ResourceResolver(GetType(), true);
            var @namespace = GetType().FullName;
            var hideAction = new MenuAction(@namespace + ":toggle", new ActionPath(site + "/MenuSetMarkupColorForUser", resolver), ClickActionFlags.None, resolver);
            hideAction.Label = "Set User Markup Color";
            hideAction.Persistent = true;
            hideAction.SetClickHandler(OpenAimMarkupColorOptions);

            IActionSet actions = new ActionSet(new IAction[] { hideAction });
            var other = base.GetExportedActions(site, mouseInformation);
            if (other != null)
                actions = actions.Union(other);

            return actions;
        }
예제 #3
0
		private static IAction CreateAction(
			string actionID,
			string path,
			WebBrowserComponent webBrowser)
		{
			string url = ExtractUrlFromFavourite(path);
			string menuPath = CreateMenuPath(path);

			// Create the menu action
			ActionPath actionPath = new ActionPath(menuPath, null);
			MenuAction action = new MenuAction(actionID, actionPath, ClickActionFlags.None, null);
			action.Label = actionPath.LastSegment.LocalizedText;

			// Set what we're supposed to do when the menu item is clicked
			action.SetClickHandler(
				delegate
				{
					// Navigate to the URL
					webBrowser.Url = url;
					webBrowser.Go();
				});

			return action;
		}
예제 #4
0
		/// <summary>
		/// Gets a set of exported <see cref="IAction"/>s.
		/// </summary>
		/// <param name="site">The action model site at which the actions should reside.</param>
		/// <param name="mouseInformation">The mouse input when the action model was requested, such as in response to a context menu request.</param>
		/// <returns>A set of exported <see cref="IAction"/>s.</returns>
		public override IActionSet GetExportedActions(string site, IMouseInformation mouseInformation)
		{
			IResourceResolver resolver = new ApplicationThemeResourceResolver(this.GetType(), true);
			string @namespace = typeof(RoiCalloutGraphic).FullName;

			List<IAction> actions = new List<IAction>();
			MenuAction hideAction = new MenuAction(@namespace + ":toggle", new ActionPath(site + "/MenuShowAnalysis", resolver), ClickActionFlags.None, resolver);
			hideAction.GroupHint = new GroupHint("Tools.Measurements.Display");
			hideAction.Label = SR.MenuShowAnalysis;
			hideAction.Checked = this.ShowAnalysis;
			hideAction.Persistent = true;
			hideAction.SetClickHandler(this.ToggleShowAnalysis);
			actions.Add(hideAction);

			if (AllowRename)
			{
				MenuAction renameAction = new MenuAction(@namespace + ":rename", new ActionPath(site + "/MenuRename", resolver), ClickActionFlags.None, resolver);
				renameAction.GroupHint = new GroupHint("Tools.Measurements.Properties");
				renameAction.Label = SR.MenuRename;
				renameAction.Persistent = true;
				renameAction.SetClickHandler(this.Rename);
				actions.Add(renameAction);
			}

			IActionSet actionSet = new ActionSet(actions);

			if (this.ShowAnalysis)
            {
                var analyzerActionSets = GetAnalyzersExportedActions(site, mouseInformation);

                if (analyzerActionSets != null)
                {
                    foreach(var set in analyzerActionSets)
                    {
                        actionSet = actionSet.Union(set);
                    } 
                }
                   
            }

			IActionSet other = base.GetExportedActions(site, mouseInformation);
			if (other != null)
				actionSet = actionSet.Union(other);

			return actionSet;
		}
 private IActionSet GetContextMenuActionSet()
 {
     var aimUserGraphics = GetAimUserGraphics();
     var actionsList = new List<IAction>();
     const string path = "imageviewer-contextmenu/Visible AIM Users/";
     var resolver = new ResourceResolver(GetType(), true);
     foreach (var aimUser in aimUserGraphics.Keys)
     {
         if (aimUserGraphics.Count > 0)
         {
             var user = aimUser;
             var action = new MenuAction(aimUser, new ActionPath(path + aimUser, resolver), ClickActionFlags.CheckAction, resolver);
             action.Checked = aimUserGraphics[aimUser][0].Visible;
             action.Enabled = true;
             action.Persistent = false;
             action.Label = aimUser;
             actionsList.Add(action);
             action.SetClickHandler(
                 delegate
                 {
                     var visible = !action.Checked;
                     _displayMarkupPerUser[user] = visible;
                     action.Checked = visible;
                     SelectedPresentationImage.Draw();
                 });
         }
     }
     return new ActionSet(actionsList);
 }
예제 #6
0
		/// <summary>
		/// Gets a set of exported <see cref="IAction"/>s.
		/// </summary>
		/// <param name="site">The action model site at which the actions should reside.</param>
		/// <param name="mouseInformation">The mouse input when the action model was requested, such as in response to a context menu request.</param>
		/// <returns>A set of exported <see cref="IAction"/>s.</returns>
		public override IActionSet GetExportedActions(string site, IMouseInformation mouseInformation)
		{
			IActionSet actions = base.GetExportedActions(site, mouseInformation);
			_lastContextMenuPoint = mouseInformation.Location;

			if (!_canAddRemoveVertices)
				return actions;

			if (!base.Subject.HitTest(Point.Round(_lastContextMenuPoint)))
				return actions;

			int count = this.Subject.Points.Count;
			bool hit = base.ControlPoints.HitTest(Point.Round(_lastContextMenuPoint));

			IResourceResolver resolver = new ApplicationThemeResourceResolver(this.GetType(), true);
			string @namespace = typeof (VerticesControlGraphic).FullName;

			MenuAction insertAction = new MenuAction(@namespace + ":insert", new ActionPath(site + "/MenuInsertVertex", resolver), ClickActionFlags.None, resolver);
			insertAction.GroupHint = new GroupHint("Tools.Graphics.Edit");
			insertAction.Label = SR.MenuInsertVertex;
			insertAction.Persistent = true;
			insertAction.SetClickHandler(this.PerformInsertVertex);

			MenuAction deleteAction = new MenuAction(@namespace + ":delete", new ActionPath(site + "/MenuDeleteVertex", resolver), ClickActionFlags.None, resolver);
			deleteAction.GroupHint = new GroupHint("Tools.Graphics.Edit");
			deleteAction.Label = SR.MenuDeleteVertex;
			deleteAction.Visible = hit && count > 1;
			deleteAction.Persistent = true;
			deleteAction.SetClickHandler(this.PerformDeleteVertex);

			return actions.Union(new ActionSet(new IAction[] {insertAction, deleteAction}));
		}
예제 #7
0
		/// <summary>
		/// Gets a set of exported <see cref="IAction"/>s.
		/// </summary>
		/// <param name="site">The action model site at which the actions should reside.</param>
		/// <param name="mouseInformation">The mouse input when the action model was requested, such as in response to a context menu request.</param>
		/// <returns>A set of exported <see cref="IAction"/>s.</returns>
		public override IActionSet GetExportedActions(string site, IMouseInformation mouseInformation)
		{
            if (!HitTest(mouseInformation.Location))
                return new ActionSet();

			IResourceResolver resolver = new ApplicationThemeResourceResolver(this.GetType(), true);
			string @namespace = typeof(TextEditControlGraphic).FullName;
			MenuAction action = new MenuAction(@namespace + ":edit", new ActionPath(site + "/MenuEditText", resolver), ClickActionFlags.None, resolver);
			action.GroupHint = new GroupHint("Tools.Graphics.Edit");
			action.Label = SR.MenuEditText;
			action.Persistent = true;
			action.SetClickHandler(delegate { this.StartEdit(); });
			return base.GetExportedActions(site, mouseInformation).Union(new ActionSet(new IAction[] {action}));
		}
예제 #8
0
        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});
        }
            public SegmentationActionContainer(SegmentationTool ownerTool, SegmentationMenuInfo info, int index)
            {
                _ownerTool = ownerTool;
                _info = info;

                StringBuilder pathStringBuilder = new StringBuilder();
                pathStringBuilder.AppendFormat("{0}/", ImageViewerComponent.ContextMenuSite);
                // Multiple patients
                if (_ownerTool.Context.Viewer.StudyTree.Studies.Any(study => study.ParentPatient.PatientId != info.PatientId))
                {
                    pathStringBuilder.AppendFormat("{0} · {1}/", info.PatientsName, info.PatientId);
                }
                // Multiple Studies
                if (_ownerTool.Context.Viewer.StudyTree.Studies.Any(study => study.StudyInstanceUid != info.StudyInstanceUid))
                {
                    // We are trying to replicate what ImageSetDescriptior.GetName() does here:
                    string modalitiesInStudy = StringUtilities.Combine(CollectionUtils.Sort(
                        _ownerTool.Context.Viewer.StudyTree.Studies.First(
                        study => study.StudyInstanceUid == info.StudyInstanceUid).ModalitiesInStudy), ", ");

                    DateTime studyDate;
                    DateParser.Parse(info.StudyDate, out studyDate);
                    DateTime studyTime;
                    TimeParser.Parse(info.StudyTime, out studyTime);

                    pathStringBuilder.AppendFormat("{0} {1}", studyDate.ToString(Format.DateFormat), studyTime.ToString(Format.TimeFormat));
                    if (!string.IsNullOrEmpty(info.StudyAccessionNumber))
                        pathStringBuilder.AppendFormat(", A#: {0}", info.StudyAccessionNumber);
                    pathStringBuilder.AppendFormat(", [{0}] {1}/", modalitiesInStudy ?? "", info.StudyDescription);
                }
                pathStringBuilder.AppendFormat("SEG{0}", index);

                string actionId = String.Format("{0}:apply{1}", typeof (SegmentationTool).FullName, index);
                var actionPath = new ActionPath(pathStringBuilder.ToString(), _ownerTool._resolver);
                _action = new MenuAction(actionId, actionPath, ClickActionFlags.None, _ownerTool._resolver);
                _action.GroupHint = new GroupHint("DisplaySets");

                _action.Label = String.Format("{0} SEG: {1}", _info.SeriesNumber, _info.DisplayLabel);
                _action.SetClickHandler(Apply);
            }