/// <summary> /// Gets the cursor token associated with the tool. /// </summary> /// <param name="point">The point in destination (view) coordinates.</param> /// <returns>a <see cref="CursorToken"/> object that is used to construct the cursor in the view.</returns> public bool GetCheckedSync() { ImageViewerComponent view = this.ImageViewer as ImageViewerComponent; ActionModelNode node = view.ToolbarModel; ActionModelNode tempNode = null; IAction[] action = null; foreach (ActionModelNode tempnode in node.ChildNodes) { if (tempnode.PathSegment.ResourceKey == "ToolbarSynchronizeStackingLinkStudies") { tempNode = tempnode; break; } } if (tempNode != null) { action = tempNode.GetActionsInOrder(); } if ((action != null)) { ButtonAction ac = action[0] as ButtonAction; return(ac.Checked); } return(false); }
private void Select() { if (!this.Selected) { //Platform.CheckMemberIsSet(this.DisplaySet, "ImageBox.DisplaySet"); Platform.CheckMemberIsSet(this.ParentPhysicalWorkspace, "ImageBox.ParentPhysicalWorkspace"); Platform.CheckMemberIsSet(this.ImageViewer, "ImageBox.ImageViewer"); this.Selected = true; _parentPhysicalWorkspace.SelectedImageBox = this; this.ImageViewer.EventBroker.OnImageBoxSelected(new ImageBoxSelectedEventArgs(this)); if (_displaySet != null) { _displaySet.Selected = true; } } try { ImageViewerComponent view = this.ImageViewer as ImageViewerComponent; ActionModelNode node = view.ToolbarModel; ActionModelNode tempNode = null; IAction[] action = null; foreach (ActionModelNode tempnode in node.ChildNodes) { if (tempnode.PathSegment.ResourceKey == "ToolbarSynchronizeStacking") { tempNode = tempnode; break; } } if (tempNode != null) { action = tempNode.GetActionsInOrder(); } if ((action != null) && (action.Count() > 0)) { ButtonAction ac = action[0] as ButtonAction; ImageSop sop = ((IImageSopProvider)this.TopLeftPresentationImage).ImageSop; if (sop.Modality == "DX" || sop.Modality == "CR" || sop.Modality == "RF") { ac.Checked = false; } else { ac.Checked = true; } } } catch (Exception ex) { } }
/// <summary> /// Searches <paramref name="actionNode"/> and returns the action (represented as HTML) whose label matches /// <paramref name="labelSearch"/>. /// </summary> /// <param name="actionNode">The node to be searched.</param> /// <param name="labelSearch">The label to match on.</param> /// <param name="actionLabel">The new label to be applied to the action in the returned HTML.</param> /// <returns>The found action represented as HTML, otherwise an empty string.</returns> public string GetHTML(ActionModelNode actionNode, string labelSearch, string actionLabel) { IAction[] actions = actionNode.GetActionsInOrder(); if (actions.Length == 0) { return(""); } // find the action corresponding to the action label, if exist foreach (var action in actions) { if (action.Label == labelSearch) { return(GetHTML(action.Path.LocalizedPath, actionLabel)); } } return(""); }
public void PrintFilm() { ActionModelNode node = ContextMenuModel; ActionModelNode tempNode = null; IAction[] action = null; foreach (ActionModelNode tempnode in node.ChildNodes) { Platform.Log(LogLevel.Error, "the source is " + tempnode.PathSegment.ResourceKey); if (tempnode.PathSegment.ResourceKey == "MenuThirdPrint" || tempnode.PathSegment.ResourceKey == "MenuPrintChooseDisplaySet") { tempNode = tempnode; break; } } if (tempNode != null) { action = tempNode.GetActionsInOrder(); } if ((action != null) && (action.Count() > 0)) { MenuAction ac = action[1] as MenuAction; ac.Click(); } //foreach (ITool tool in _toolSet.Tools) //{ // string strname = tool.GetType().FullName; // if (strname == "ClearCanvas.ImageViewer.Tools.Standard.ThirdPrintTool") // { // } //} }
//private static void AdvanceImage(int increment, IImageBox selectedImageBox) private void AdvanceImage(int increment, IImageBox selectedImageBox) { if (increment > 0) { GlobalData.direct = 1; } else { GlobalData.direct = -1; } int prevTopLeftPresentationImageIndex = selectedImageBox.TopLeftPresentationImageIndex; selectedImageBox.TopLeftPresentationImageIndex += increment; if (selectedImageBox.TopLeftPresentationImageIndex != prevTopLeftPresentationImageIndex) { selectedImageBox.Draw(); } else { ImageViewerComponent view = this.ImageViewer as ImageViewerComponent; ActionModelNode node = view.ToolbarModel; ActionModelNode tempNode = null; IAction [] action = null; foreach (ActionModelNode tempnode in node.ChildNodes) { if (tempnode.PathSegment.ResourceKey == "ToolbarSynchronizeStacking") { tempNode = tempnode; break; } } if (tempNode != null) { action = tempNode.GetActionsInOrder(); } if ((action != null) && (action.Count() > 0)) { ButtonAction ac = action[0] as ButtonAction; if (ac.Checked == true) { return; } } if (selectedImageBox.TopLeftPresentationImage == null) { return; } #if SUINING ImageSop sop = ((IImageSopProvider)selectedImageBox.TopLeftPresentationImage).ImageSop; if (sop.Modality == "CT" || sop.Modality == "MR") { return; } #endif if (increment > 0) { AdvanceDisplaySet(1); } else { AdvanceDisplaySet(-1); } } }