Esempio n. 1
0
        public static void Show(IDesktopWindow desktopWindow, ShelfDisplayHint displayHint)
        {
            if (!KeyImageClipboardComponent.HasViewPlugin)
            {
                return;
            }

            if (!PermissionsHelper.IsInRole(AuthorityTokens.Study.KeyImages))
            {
                throw new PolicyException(SR.ExceptionViewKeyImagePermissionDenied);
            }

            desktopWindow = desktopWindow ?? Application.ActiveDesktopWindow;

            IShelf shelf = GetClipboardShelf(desktopWindow);

            if (shelf != null)
            {
                shelf.Activate();
            }
            else
            {
                Workspace          activeWorkspace = desktopWindow.ActiveWorkspace;
                var                info            = GetKeyImageClipboard(activeWorkspace);
                ClipboardComponent component       = new KeyImageClipboardComponent(info);
                shelf         = ApplicationComponent.LaunchAsShelf(desktopWindow, component, SR.TitleKeyImages, displayHint);
                shelf.Closed += OnClipboardShelfClosed;

                ClipboardShelves[desktopWindow] = shelf;
            }
        }
Esempio n. 2
0
        private static void NewOrder(WorklistItemSummaryBase worklistItem, IDesktopWindow desktopWindow)
        {
            if (worklistItem == null)
            {
                NewOrder(null, "New Order", desktopWindow);
                return;
            }

            PatientProfileSummary summary = null;

            Platform.GetService <IBrowsePatientDataService>(
                service =>
            {
                var response = service.GetData(new GetDataRequest
                {
                    GetPatientProfileDetailRequest = new GetPatientProfileDetailRequest
                    {
                        PatientProfileRef = worklistItem.PatientProfileRef
                    }
                });
                summary = response.GetPatientProfileDetailResponse.PatientProfile.GetSummary();
            });

            NewOrder(summary, desktopWindow);
        }
Esempio n. 3
0
        /// <summary>
        /// Called by the framework when the user clicks the "apply" menu item or toolbar button.
        /// </summary>
        public void Apply()
        {
            // check if a layout component is already displayed
            if (_shelves.ContainsKey(this.Context.DesktopWindow))
            {
                _shelves[this.Context.DesktopWindow].Activate();
            }
            else
            {
                BlockingOperation.Run(delegate
                {
                    _desktopWindow = Context.DesktopWindow;

                    var atsWebBrowserContainer = ATSWebBrowserContainer.Create(_desktopWindow);
                    var atsWebBrowserComponent =
                        atsWebBrowserContainer.Pane1.Component as ATSWebBrowserComponent;
                    var aimAnnotationComponent =
                        atsWebBrowserContainer.Pane2.Component as AimAnnotationComponent;

                    if (atsWebBrowserComponent != null && aimAnnotationComponent != null)
                    {
                        ApplicationComponent.LaunchAsWorkspace(Context.DesktopWindow, atsWebBrowserContainer, SR.WorkspaceName);
                        atsWebBrowserComponent.Url = Configuration.AtsSettings.Default.AtsUrl;
                        atsWebBrowserComponent.AimAnnotationComponent = aimAnnotationComponent;
                        atsWebBrowserComponent.Go();
                    }
                });
            }
        }
 public ExceptionHandlingContext(Exception e, string contextualMessage, IDesktopWindow desktopWindow, AbortOperationDelegate abortOperationDelegate)
 {
     _exception = e;
     ContextualMessage = contextualMessage;
     DesktopWindow = desktopWindow;
     _abortDelegate = abortOperationDelegate;
 }
Esempio n. 5
0
 private void ShowExplorer(IDesktopWindow mainDesktopWindow, bool canShowHome)
 {
     if (!canShowHome || LaunchExplorerAtStartup)
     {
         ExplorerTool.ShowExplorer(mainDesktopWindow);
     }
 }
Esempio n. 6
0
 protected static void Open(EntityRef orderRef, IDesktopWindow window)
 {
     ApplicationComponent.LaunchAsDialog(
         window,
         new WorkflowHistoryComponent(orderRef),
         "Workflow History");
 }
 protected override void OnAfterStartup(IDesktopWindow mainDesktopWindow, bool canShowHome)
 {
     if (!canShowHome || LaunchExplorerAtStartup)
     {
         ExplorerTool.ShowExplorer(mainDesktopWindow);
     }
 }
Esempio n. 8
0
        /// <summary>
        /// Called by the framework when the user clicks the "apply" menu item or toolbar button.
        /// </summary>
        public void ShowAnnotationList()
        {
            if (this.ComponentShelf == null)
            {
                BlockingOperation.Run(delegate
                {
                    try
                    {
                        IDesktopWindow desktopWindow = this.Context.DesktopWindow;

                        IShelf shelf  = AimAnnotationsListComponent.Launch(desktopWindow);
                        shelf.Closed += delegate
                        {
                            _shelves.Remove(desktopWindow);
                        };

                        _shelves[this.Context.DesktopWindow] = shelf;
                    }
                    catch (Exception e)
                    {
                        ExceptionHandler.Report(e, this.Context.DesktopWindow);
                    }
                });
            }
            else
            {
                this.ComponentShelf.Show();
            }
        }
Esempio n. 9
0
        private void Initialize(IDesktopWindow desktopWindow)
        {
            Macro.ImageViewer.IImageViewer imageViewer = CastToImageViewer(desktopWindow.ActiveWorkspace);

            if (!_viewerTrees.Contains(imageViewer))
            {
                var imageSets1 = imageViewer.LogicalWorkspace.ImageSets;
                //ObservableList<IImageSet> imageSets = new ObservableList<IImageSet>();
                //foreach (var imageSet in imageSets1)
                //{
                //    ImageSet tempImageSet = new ImageSet();
                //    foreach (var displaySet in imageSet.DisplaySets)
                //    {
                //        tempImageSet.DisplaySets.Add(displaySet.Clone());
                //    }
                //    imageSets.Add(tempImageSet);
                //}
                string primaryStudyInstanceUid = GetPrimaryStudyInstanceUid(imageViewer.StudyTree);
                if (_displaySetTree == null)
                {
                    _displaySetTree = new DisplaySetTree(imageSets1, new ThumbnailTreeItemBinding(_dicomPrintPreviewComponent, primaryStudyInstanceUid));
                }
                else
                {
                    _displaySetTree.AddTreeItem(imageSets1);
                }

                _viewerTrees.Add(imageViewer);
            }
        }
		/// <summary>
		/// Determines if the PD dialog must be shown upon verification for the specified worklist item, and shows it if needed.
		/// </summary>
		/// <param name="worklistItem"></param>
		/// <param name="desktopWindow"></param>
		/// <param name="continuation">Code block that is executed if the dialog was shown and accepted, or if it was not required. </param>
		/// <returns>True if the dialog was shown and accepted, or if it was not required.  False if the user cancelled out of the dialog.</returns>
		public static bool ShowDialogOnVerifyIfRequired(WorklistItemSummaryBase worklistItem, IDesktopWindow desktopWindow,
			Action<object> continuation)
		{
			if(!NeedDialogOnVerify(worklistItem, desktopWindow))
			{
				// we don't need the dialog, so we can continue
				continuation(null);
				return true;
			}

			// show the pd dialog
			var completed = false;
			ShowDialog(worklistItem, desktopWindow,
				exitCode =>
				{
					if(exitCode == ApplicationComponentExitCode.Accepted)
					{
						// if the dialog was accepted, continue
						continuation(null);
						completed = true;
					}
				});

			return completed;
		}
Esempio n. 11
0
        public static bool ShowReconciliationDialog(EntityRef targetProfile, IDesktopWindow window)
        {
            IList <ReconciliationCandidate> candidates         = null;
            IList <PatientProfileSummary>   reconciledProfiles = null;

            Platform.GetService <IPatientReconciliationService>(
                delegate(IPatientReconciliationService service)
            {
                ListPatientReconciliationMatchesResponse response =
                    service.ListPatientReconciliationMatches(new ListPatientReconciliationMatchesRequest(targetProfile));

                candidates         = response.MatchCandidates;
                reconciledProfiles = response.ReconciledProfiles;
            });

            if (candidates.Count > 0)
            {
                ReconciliationComponent      component = new ReconciliationComponent(targetProfile, reconciledProfiles, candidates);
                ApplicationComponentExitCode exitCode  = ApplicationComponent.LaunchAsDialog(
                    window,
                    component,
                    SR.TitlePatientReconciliation);
                return(exitCode == ApplicationComponentExitCode.Accepted);
            }
            else
            {
                window.ShowMessageBox(SR.MessageNoReconciliationCandidate, MessageBoxActions.Ok);
                return(false);
            }
        }
        public void Startup(IDesktopWindow mainDesktopWindow)
        {
            using (var tool = new GlobalHomeTool())
            {
                tool.SetContext(new StartupActionContext {
                    DesktopWindow = mainDesktopWindow as DesktopWindow
                });
                tool.Initialize();

                var canShowHome = tool.CanShowHome;

                // allow subclasses opportunity to execute actions before the Home workspace is created
                OnBeforeStartup(mainDesktopWindow, canShowHome);

                // create and show the Home workspace
                if (canShowHome)
                {
                    tool.PerformLaunch();
                }

                // allow subclasses opportunity to execute actions after the Home workspace is created
                OnAfterStartup(mainDesktopWindow, canShowHome);

                // reactivate the Home workspace
                if (canShowHome)
                {
                    tool.Launch();
                }
            }
        }
Esempio n. 13
0
 private static void OpenViewer(OrderNoteboxItemSummary item, IDesktopWindow desktopWindow)
 {
     if (item != null)
     {
         OpenViewer(item.AccessionNumber, desktopWindow);
     }
 }
Esempio n. 14
0
 private static void OpenViewer(WorklistItemSummaryBase item, IDesktopWindow desktopWindow)
 {
     if (item != null)
     {
         OpenViewer(item.AccessionNumber, desktopWindow);
     }
 }
Esempio n. 15
0
        private void InitDicomPrint(
            IDesktopWindow deskTopWindow,
            List <ISelectPresentationsInformation> selectPresentations,
            int tilecount,
            bool isAllPages,
            bool isDelete)
        {
            try
            {
                if (_dicomPrintManager == null)
                {
                    _dicomPrintManager             = new DicomPrintManager(deskTopWindow, this);
                    _dicomPrintManager.CloseShelf += ClosePrintManager;
                }

                if (_dicomPrintManager.IsPrinting)
                {
                    DesktopWindow.ShowMessageBox("正在打印....,请稍后", MessageBoxActions.Ok);
                    return;
                }
                _dicomPrintManager.Show();
                _dicomPrintManager.Print(selectPresentations, this.DicomPrinter.Item, tilecount, isAllPages, isDelete);
            }
            catch (Exception exception)
            {
                ExceptionHandler.Report(exception, deskTopWindow);
            }
        }
Esempio n. 16
0
        internal static void Launch(IDesktopWindow desktopWindow, List <IClipboardItem> clipboardItems)
        {
            Platform.CheckForNullReference(desktopWindow, "desktopWindow");
            Platform.CheckForNullReference(clipboardItems, "clipboardItems");

            if (_multipleImageExporter != null)
            {
                desktopWindow.ShowMessageBox(SR.MessageImageExportStillRunning, MessageBoxActions.Ok);
                return;
            }

            int numberOfImagesToExport = GetNumberOfImagesToExport(clipboardItems);

            Platform.CheckPositive(numberOfImagesToExport, "numberOfImagesToExport");

            string title = SR.TitleExportImages;

            if (numberOfImagesToExport == 1)
            {
                title = SR.TitleExportSingleImage;
            }

            //initialize the component.
            ImageExportComponent component = new ImageExportComponent();

            component.ItemsToExport          = clipboardItems;
            component.NumberOfImagesToExport = numberOfImagesToExport;

            // give the width and height values from the first image to be exported
            if (clipboardItems.Count > 0)
            {
                object item = clipboardItems[0].Item;
                if (item is IImageGraphicProvider)
                {
                    IImageGraphicProvider imageGraphicProvider = (IImageGraphicProvider)item;
                    component.Height = imageGraphicProvider.ImageGraphic.Rows;
                    component.Width  = imageGraphicProvider.ImageGraphic.Columns;
                }
                else if (item is IDisplaySet)
                {
                    foreach (IPresentationImage image in ((IDisplaySet)item).PresentationImages)
                    {
                        if (image is IImageGraphicProvider)
                        {
                            IImageGraphicProvider imageGraphicProvider = (IImageGraphicProvider)image;
                            component.Height = imageGraphicProvider.ImageGraphic.Rows;
                            component.Width  = imageGraphicProvider.ImageGraphic.Columns;
                            break;
                        }
                    }
                }
            }

            if (ApplicationComponentExitCode.Accepted != LaunchAsDialog(desktopWindow, component, title))
            {
                return;
            }

            component.Export();
        }
Esempio n. 17
0
        /// <summary>
        /// Shows all <see cref="IConfigurationPage"/>s returned by extensions of <see cref="ConfigurationPageProviderExtensionPoint"/>
        /// in a dialog, with a navigable tree to select the pages.
        /// </summary>
        public static ApplicationComponentExitCode Show(IDesktopWindow desktopWindow, string initialPageIdentifier)
        {
            var container = new ConfigurationDialogComponent(GetPages(), initialPageIdentifier);
            var exitCode  = ApplicationComponent.LaunchAsDialog(desktopWindow, container, SR.TitleMenuOptions);

            return(exitCode);
        }
Esempio n. 18
0
        internal static KeyImageClipboard GetKeyImageClipboard(IDesktopWindow desktopWindow)
        {
            IShelf shelf = GetClipboardShelf(desktopWindow);

            if (shelf == null)
            {
                return(null);
            }

            if (!PermissionsHelper.IsInRole(AuthorityTokens.Study.KeyImages))
            {
                throw new PolicyException(SR.ExceptionViewKeyImagePermissionDenied);
            }

            KeyImageClipboardComponent component = shelf.Component as KeyImageClipboardComponent;

            if (component != null)
            {
                return(component.Clipboard);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 19
0
        /// <summary>
        /// Shows a progress dialog that processes the specified list of items on a background task.
        /// </summary>
        /// <remarks>
        /// This is essentially a convenience method for processing a list of items.  It creates a background task internally.
        /// </remarks>
        /// <typeparam name="T"></typeparam>
        /// <param name="desktopWindow"></param>
        /// <param name="items"></param>
        /// <param name="processor"></param>
        /// <param name="cancelable"></param>
        /// <returns></returns>
        public static int Show <T>(IDesktopWindow desktopWindow, IList <T> items, Func <T, int, string> processor, bool cancelable)
        {
            var totalItems     = items.Count;
            var processedCount = 0;
            var task           = new BackgroundTask(
                context =>
            {
                try
                {
                    foreach (var item in items)
                    {
                        if (context.CancelRequested)
                        {
                            context.Cancel();
                            return;
                        }

                        var msg = processor(item, processedCount);
                        context.ReportProgress(new BackgroundTaskProgress(processedCount, totalItems, msg));
                        processedCount++;
                    }
                    context.Complete();
                }
                catch (Exception e)
                {
                    context.Error(e);
                }
            }, cancelable);

            //note: any exceptions occurring on the background task will be re-thrown from this call
            Show(task, desktopWindow, true);

            return(processedCount);
        }
		protected override void OnAfterStartup(IDesktopWindow mainDesktopWindow, bool canShowHome)
		{
			if (!canShowHome || LaunchExplorerAtStartup)
			{
				ExplorerTool.ShowExplorer(mainDesktopWindow);
			}
		}
Esempio n. 21
0
        public static void Show(IDesktopWindow desktopWindow, ShelfDisplayHint displayHint)
        {
            // TODO (CR Phoenix5 - Med): Clinical as well
            if (!PermissionsHelper.IsInRole(AuthorityTokens.KeyImages))
            {
                throw new PolicyException(SR.ExceptionViewKeyImagePermissionDenied);
            }

            desktopWindow = desktopWindow ?? Application.ActiveDesktopWindow;

            IShelf shelf = GetClipboardShelf(desktopWindow);

            if (shelf != null)
            {
                shelf.Activate();
            }
            else
            {
                Workspace           activeWorkspace = desktopWindow.ActiveWorkspace;
                KeyImageInformation info            = GetKeyImageInformation(activeWorkspace) ?? new KeyImageInformation();
                ClipboardComponent  component       = new KeyImageClipboardComponent(info);
                shelf         = ApplicationComponent.LaunchAsShelf(desktopWindow, component, SR.TitleKeyImages, displayHint);
                shelf.Closed += OnClipboardShelfClosed;

                ClipboardShelves[desktopWindow] = shelf;
            }
        }
Esempio n. 22
0
        internal static IShelf Launch(IDesktopWindow desktopWindow)
        {
            var component = new ThumbnailComponent(desktopWindow);

            //
            ClearCanvas.ImageViewer.Thumbnails.Configuration.ThumbnailsSettings setting = ClearCanvas.ImageViewer.Thumbnails.Configuration.ThumbnailsSettings.Default;
            ShelfDisplayHint hint;

            if (setting.position == true)
            {
                hint = ShelfDisplayHint.DockBottom;
            }
            else
            {
                hint = ShelfDisplayHint.DockLeft;
            }

            var shelf = LaunchAsShelf(
                desktopWindow,
                component,
                SR.TitleThumbnails,
                //"Thumbnails",
                //ShelfDisplayHint.DockTop);
                "ËõÂÔͼ",
                hint);

            return(shelf);
        }
Esempio n. 23
0
        public void Show()
        {
            if (ComponentShelf == null)
            {
                try
                {
                    IDesktopWindow desktopWindow = Context.DesktopWindow;

                    ImagePropertiesApplicationComponent component =
                        new ImagePropertiesApplicationComponent(Context.DesktopWindow);

                    IShelf shelf = ApplicationComponent.LaunchAsShelf(Context.DesktopWindow, component,
                                                                      SR.TitleImageProperties, "ImageProperties", ShelfDisplayHint.DockLeft);

                    Shelves.Add(Context.DesktopWindow, shelf);
                    shelf.Closed += delegate { Shelves.Remove(desktopWindow); };
                }
                catch (Exception e)
                {
                    ExceptionHandler.Report(e, Context.DesktopWindow);
                }
            }
            else
            {
                ComponentShelf.Show();
            }
        }
Esempio n. 24
0
		private static IShelf GetClipboardShelf(IDesktopWindow desktopWindow)
		{
			if (_clipboardShelves.ContainsKey(desktopWindow))
				return _clipboardShelves[desktopWindow];
			else 
				return null;
		}
        private static void GetOwnerWindows(DicomExplorerComponent explorerComponent,
                                            out IDesktopWindow parentDesktopWindow, out IDesktopObject parentShelfOrWorkspace)
        {
            parentDesktopWindow    = null;
            parentShelfOrWorkspace = null;

            foreach (IDesktopWindow desktopWindow in Application.DesktopWindows)
            {
                foreach (IWorkspace workspace in desktopWindow.Workspaces)
                {
                    if (workspace.Component == explorerComponent)
                    {
                        parentDesktopWindow    = desktopWindow;
                        parentShelfOrWorkspace = workspace;
                        return;
                    }
                }

                foreach (IShelf shelf in desktopWindow.Shelves)
                {
                    if (shelf.Component == explorerComponent)
                    {
                        parentDesktopWindow    = desktopWindow;
                        parentShelfOrWorkspace = shelf;
                        return;
                    }
                }
            }
        }
Esempio n. 26
0
        public void Show()
        {
            if (ComponentShelf == null)
            {
                try
                {
                    IDesktopWindow desktopWindow = this.Context.DesktopWindow;

                    IShelf shelf = ThumbnailComponent.Launch(desktopWindow);
                    shelf.Closed += delegate
                    {
                        _shelves.Remove(desktopWindow);
                    };

                    _shelves[this.Context.DesktopWindow] = shelf;
                }
                catch (Exception e)
                {
                    ExceptionHandler.Report(e, this.Context.DesktopWindow);
                }
            }
            else
            {
                ComponentShelf.Show();
            }
        }
Esempio n. 27
0
        private void Open(IDesktopWindow desktopWindow)
        {
            try
            {
                var editor = new PatientProfileEditorComponent();
                var result = ApplicationComponent.LaunchAsDialog(
                    desktopWindow,
                    editor,
                    SR.TitleNewPatient);

                if (result == ApplicationComponentExitCode.Accepted && this.Context is IRegistrationWorkflowItemToolContext)
                {
                    // if patient successfully added, invoke a search on the MRN so that the patient appears in the Home page
                    var searchParams = new WorklistSearchParams(new WorklistItemTextQueryRequest.AdvancedSearchFields()
                    {
                        Mrn = editor.PatientProfile.Mrn.Id
                    });
                    ((IRegistrationWorkflowItemToolContext)this.Context).ExecuteSearch(searchParams);
                }
            }
            catch (Exception e)
            {
                ExceptionHandler.Report(e, desktopWindow);
            }
        }
        public void Show()
        {
            // check if a layout component is already displayed
            if (_shelves.ContainsKey(this.Context.DesktopWindow))
            {
                _shelves[this.Context.DesktopWindow].Activate();
            }
            else
            {
                BlockingOperation.Run(delegate
                {
                    _desktopWindow = this.Context.DesktopWindow;

                    AimAnnotationComponent aimComponent = AimAnnotationComponent.Create(Context.DesktopWindow, false);

                    IShelf shelf = ApplicationComponent.LaunchAsShelf(
                        _desktopWindow,
                        aimComponent,
                        SR.TitleAIMCreater,
                        "AIM Annotation",
                        ShelfDisplayHint.DockRight | ShelfDisplayHint.DockAutoHide);

                    shelf.Closed            += OnShelfClosed;
                    _shelves[_desktopWindow] = shelf;
                });
            }
        }
Esempio n. 29
0
 public ExceptionHandlingContext(Exception e, string contextualMessage, IDesktopWindow desktopWindow, AbortOperationDelegate abortOperationDelegate)
 {
     _exception        = e;
     ContextualMessage = contextualMessage;
     DesktopWindow     = desktopWindow;
     _abortDelegate    = abortOperationDelegate;
 }
Esempio n. 30
0
        private static void LaunchShelf(IDesktopWindow desktopWindow, IApplicationComponent component, ShelfDisplayHint shelfDisplayHint)
        {
            IShelf shelf = ApplicationComponent.LaunchAsShelf(desktopWindow, component, SR.TitleCine, "Cine", shelfDisplayHint);

            Shelves[desktopWindow]         = shelf;
            Shelves[desktopWindow].Closed += OnShelfClosed;
        }
Esempio n. 31
0
        internal static KeyImageInformation GetKeyImageInformation(IDesktopWindow desktopWindow)
        {
            IShelf shelf = GetClipboardShelf(desktopWindow);

            if (shelf == null)
            {
                return(null);
            }

            // TODO (CR Phoenix5 - Med): Clinical as well
            if (!PermissionsHelper.IsInRole(AuthorityTokens.KeyImages))
            {
                throw new PolicyException(SR.ExceptionViewKeyImagePermissionDenied);
            }

            KeyImageClipboardComponent component = shelf.Component as KeyImageClipboardComponent;

            if (component != null)
            {
                return(component.KeyImageInformation);
            }
            else
            {
                return(null);
            }
        }
        public void Show()
        {
            // check if a layout component is already displayed
            if (_shelves.ContainsKey(Context.DesktopWindow))
            {
                _shelves[Context.DesktopWindow].Activate();
            }
            else
            {
                BlockingOperation.Run(delegate
                {
                    _desktopWindow = Context.DesktopWindow;

                    var component =
                        new SegmentationComponent(Context.DesktopWindow);

                    IShelf shelf = ApplicationComponent.LaunchAsShelf(
                        _desktopWindow,
                        component,
                        SR.SegmentationTitle,
                        "DICOM Segmentation",
                        ShelfDisplayHint.DockRight | ShelfDisplayHint.DockAutoHide);

                    shelf.Closed            += OnShelfClosed;
                    _shelves[_desktopWindow] = shelf;
                });
            }
        }
        /// <summary>
        /// Displays the PD dialog.
        /// </summary>
        /// <param name="worklistItem"></param>
        /// <param name="window"></param>
        /// <param name="continuationCode"></param>
        private static void ShowDialog(WorklistItemSummaryBase worklistItem, IDesktopWindow window, Action <ApplicationComponentExitCode> continuationCode)
        {
            var component = CreateComponent(worklistItem);
            var dialog    = ApplicationComponent.LaunchAsWorkspaceDialog(window, component, MakeTitle(worklistItem));

            dialog.Closed += delegate { continuationCode(component.ExitCode); };
        }
Esempio n. 34
0
 /// <summary>
 /// Executes the specified application component in a modal dialog box.  This call will block until
 /// the dialog box is closed.
 /// </summary>
 /// <remarks>
 /// If the specified component throws an exception from its <see cref="Start"/> method, that exception
 /// will be propagate to the caller of this method and the component will not be launched.
 /// </remarks>
 /// <param name="desktopWindow">The desktop window in which the dialog box is centered.</param>
 /// <param name="creationArgs">A <see cref="DialogBoxCreationArgs"/> object.</param>
 /// <returns>The exit code that the component exits with.</returns>
 public static ApplicationComponentExitCode LaunchAsDialog(
     IDesktopWindow desktopWindow,
     DialogBoxCreationArgs creationArgs)
 {
     desktopWindow.ShowDialogBox(creationArgs);
     return(creationArgs.Component.ExitCode);
 }
        public static bool ShowReconciliationDialog(EntityRef targetProfile, IDesktopWindow window)
        {
            IList<ReconciliationCandidate> candidates = null;
            IList<PatientProfileSummary> reconciledProfiles = null;

            Platform.GetService<IPatientReconciliationService>(
                delegate(IPatientReconciliationService service)
                {
                    ListPatientReconciliationMatchesResponse response =
                        service.ListPatientReconciliationMatches(new ListPatientReconciliationMatchesRequest(targetProfile));

                    candidates = response.MatchCandidates;
                    reconciledProfiles = response.ReconciledProfiles;
                });

            if (candidates.Count > 0)
            {
                ReconciliationComponent component = new ReconciliationComponent(targetProfile, reconciledProfiles, candidates);
                ApplicationComponentExitCode exitCode = ApplicationComponent.LaunchAsDialog(
                    window,
                    component,
                    SR.TitlePatientReconciliation);
                return exitCode == ApplicationComponentExitCode.Accepted;
            }
            else
            {
                window.ShowMessageBox(SR.MessageNoReconciliationCandidate, MessageBoxActions.Ok);
                return false;
            }
        }
		public ExternalPractitionerContactPointLookupHandler(
			EntityRef practitionerRef,
			IList<ExternalPractitionerContactPointDetail> contactPoints,
			IDesktopWindow desktopWindow)
		{
			_practitionerRef = practitionerRef;
			_contactPoints = contactPoints;
			_desktopWindow = desktopWindow;
		}
			public static bool Load(StudyFilterComponent component, IDesktopWindow desktopWindow, bool allowCancel, IEnumerable<string> paths, bool recursive)
			{
				bool success = false;

				BackgroundTask task = new BackgroundTask(LoadWorker, allowCancel, new State(component, paths, recursive));
				task.Terminated += delegate(object sender, BackgroundTaskTerminatedEventArgs e) { success = e.Reason == BackgroundTaskTerminatedReason.Completed; };
				ProgressDialog.Show(task, desktopWindow, true, ProgressBarStyle.Continuous);

				return success;
			}
		public PerformingDocumentationDocument(ModalityWorklistItemSummary item, IDesktopWindow desktopWindow)
			: base(item.OrderRef, desktopWindow)
		{
			if(item == null)
			{
				throw new ArgumentNullException("item");
			}

			_item = item;
		}
Esempio n. 39
0
		public PatientBiographyDocument(PatientProfileSummary patientProfile, IDesktopWindow window)
			: base(patientProfile.PatientRef, window)
		{
			Platform.CheckForNullReference(patientProfile.PatientRef, "PatientRef");
			Platform.CheckForNullReference(patientProfile.PatientProfileRef, "PatientProfileRef");

			_patientRef = patientProfile.PatientRef;
			_profileRef = patientProfile.PatientProfileRef;
			_patientName = patientProfile.Name;
			_mrn = patientProfile.Mrn;
		}
		public void Startup(IDesktopWindow mainDesktopWindow)
		{
			if (LicenseInformation.IsFeatureAuthorized(FeatureTokens.RIS.Core))
			{
				new RisViewerStartupActionProvider(this).Startup(mainDesktopWindow);
			}
			else
			{
				ShowExplorer(mainDesktopWindow, false);
			}
		}
		public static void Create(IDesktopWindow desktopWindow, IImageViewer viewer)
		{
			IDisplaySet selectedDisplaySet = viewer.SelectedImageBox.DisplaySet;
			string name = String.Format("{0} - Dynamic TE", selectedDisplaySet.Name);
			IDisplaySet t2DisplaySet = new DisplaySet(name, "");

			double currentSliceLocation = 0.0;

			BackgroundTask task = new BackgroundTask(
				delegate(IBackgroundTaskContext context)
				{
					int i = 0;

					foreach (IPresentationImage image in selectedDisplaySet.PresentationImages)
					{
						IImageSopProvider imageSopProvider = image as IImageSopProvider;

						if (imageSopProvider == null)
							continue;

						ImageSop imageSop = imageSopProvider.ImageSop;
						Frame frame = imageSopProvider.Frame;

						if (frame.SliceLocation != currentSliceLocation)
						{
							currentSliceLocation = frame.SliceLocation;

							try
							{
								DynamicTePresentationImage t2Image = CreateT2Image(imageSop, frame);
								t2DisplaySet.PresentationImages.Add(t2Image);
							}
							catch (Exception e)
							{
								Platform.Log(LogLevel.Error, e);
								desktopWindow.ShowMessageBox("Unable to create T2 series.  Please check the log for details.",
								                             MessageBoxActions.Ok);
								break;
							}

						}

						string message = String.Format("Processing {0} of {1} images", i, selectedDisplaySet.PresentationImages.Count);
						i++;

						BackgroundTaskProgress progress = new BackgroundTaskProgress(i, selectedDisplaySet.PresentationImages.Count, message);
						context.ReportProgress(progress);
					}
				}, false);

			ProgressDialog.Show(task, desktopWindow, true, ProgressBarStyle.Blocks);

			viewer.LogicalWorkspace.ImageSets[0].DisplaySets.Add(t2DisplaySet);
		}
Esempio n. 42
0
		public PatientBiographyDocument(WorklistItemSummaryBase worklistItem, IDesktopWindow window)
			: base(worklistItem.PatientRef, window)
        {
			Platform.CheckForNullReference(worklistItem.PatientRef, "PatientRef");
			Platform.CheckForNullReference(worklistItem.PatientProfileRef, "PatientProfileRef");
			// the worklist item may not have an OrderRef (may represent just a patient)

			_patientRef = worklistItem.PatientRef;
			_profileRef = worklistItem.PatientProfileRef;
			_patientName = worklistItem.PatientName;
			_mrn = worklistItem.Mrn;

			_orderRef = worklistItem.OrderRef;
        }
        public static ATSWebBrowserContainer Create(IDesktopWindow desktopWindow)
        {
            var atsWebBrowserComponent = new ATSWebBrowserComponent();

            var aimAnnotationComponent = AimAnnotationComponent.Create(desktopWindow, true);
            aimAnnotationComponent.Preview = true;

            atsWebBrowserComponent.AimAnnotationComponent = aimAnnotationComponent;

            var leftPane = new SplitPane(SR.TitleWebBrowserPane, atsWebBrowserComponent, 0.75f);
            var rightPane = new SplitPane(SR.TitleAimAnnotationPane, aimAnnotationComponent, 0.25f);

            return new ATSWebBrowserContainer(leftPane, rightPane);
        }
Esempio n. 44
0
			public void Load(string[] files, IDesktopWindow desktop, out bool cancelled)
			{
				Platform.CheckForNullReference(files, "files");

				_total = 0;
				_failed = 0;

				bool userCancelled = false;

				if (desktop != null)
				{
					BackgroundTask task = new BackgroundTask(
						delegate(IBackgroundTaskContext context)
						{
							for (int i = 0; i < files.Length; i++)
							{
								LoadSop(files[i]);

								int percentComplete = (int)(((float)(i + 1) / files.Length) * 100);
								string message = String.Format(SR.MessageFormatOpeningImages, i, files.Length);

								BackgroundTaskProgress progress = new BackgroundTaskProgress(percentComplete, message);
								context.ReportProgress(progress);

								if (context.CancelRequested)
								{
									userCancelled = true;
									break;
								}
							}

							context.Complete(null);

						}, true);

					ProgressDialog.Show(task, desktop, true, ProgressBarStyle.Blocks);
					cancelled = userCancelled;
				}
				else
				{
					foreach (string file in files)
						LoadSop(file);

					cancelled = false;
				}

				if (Failed > 0)
					throw new LoadSopsException(Total, Failed);
			}
		void IActivityMonitorQuickLinkHandler.Handle(ActivityMonitorQuickLink link, IDesktopWindow window)
		{
		    try
		    {
                if (link == ActivityMonitorQuickLink.SystemConfiguration)
                {
                    SharedConfigurationDialog.Show(window);
                }
                if (link == ActivityMonitorQuickLink.LocalStorageConfiguration)
                {
                    SharedConfigurationDialog.Show(window, StorageConfigurationPath);
                }
		    }
		    catch (Exception e)
		    {
		        ExceptionHandler.Report(e, window);
		    }
		}
		/// <summary>
		/// Checks the PD dialog must be shown when verifying the specified worklist item.
		/// </summary>
		/// <param name="worklistItem"></param>
		/// <param name="window"></param>
		/// <returns></returns>
		private static bool NeedDialogOnVerify(WorklistItemSummaryBase worklistItem, IDesktopWindow window)
		{
			var existingConv = ConversationExists(worklistItem.OrderRef);

			// if no existing conversation, may not need to show the dialog
			if (!existingConv)
			{
				// if this is not an emergency order, do not show the dialog
				if (!IsEmergencyOrder(worklistItem.PatientClass.Code))
					return false;

				// otherwise, ask the user if they would like to initiate a PD review
				var msg = string.Format(SR.MessageQueryPrelimDiagnosisReviewRequired, worklistItem.PatientClass.Value);
				var action = window.ShowMessageBox(msg, MessageBoxActions.YesNo);
				if (action == DialogBoxAction.No)
					return false;
			}
			return true;
		}
Esempio n. 47
0
		public static bool CheckIn(EntityRef orderRef, string title, IDesktopWindow desktopWindow)
		{
			List<ProcedureSummary> procedures = null;
			Platform.GetService((IRegistrationWorkflowService service) =>
				procedures = service.ListProceduresForCheckIn(new ListProceduresForCheckInRequest(orderRef)).Procedures);

			if(procedures.Count == 0)
			{
				desktopWindow.ShowMessageBox(SR.MessageNoProceduresCanBeCheckedIn, MessageBoxActions.Ok);
				return false;
			}

			var checkInComponent = new CheckInOrderComponent(procedures);
			var exitCode = ApplicationComponent.LaunchAsDialog(
				desktopWindow,
				checkInComponent,
				title);

			return (exitCode == ApplicationComponentExitCode.Accepted);
		}
Esempio n. 48
0
        public static void Show(IDesktopWindow desktopWindow)
        {
            if (_workspace != null)
            {
                _workspace.Activate();
                return;
            }

            if (!PermissionsHelper.IsInRole(AuthorityTokens.ActivityMonitor.View))
            {
                desktopWindow.ShowMessageBox(SR.WarningActivityMonitorPermission, MessageBoxActions.Ok);
                return;
            }

            var component = new ActivityMonitorComponent();
            _workspace = ApplicationComponent.LaunchAsWorkspace(desktopWindow, component, SR.TitleActivityMonitor);
            _workspace.Closed += ((sender, args) =>
            {
                _workspace = null;
            });
        }
		public void Startup(IDesktopWindow mainDesktopWindow)
		{
			using (var tool = new GlobalHomeTool())
			{
				tool.SetContext(new StartupActionContext {DesktopWindow = mainDesktopWindow as DesktopWindow});
				tool.Initialize();

				var canShowHome = tool.CanShowHome;

				// allow subclasses opportunity to execute actions before the Home workspace is created
				OnBeforeStartup(mainDesktopWindow, canShowHome);

				// create and show the Home workspace
				if (canShowHome) tool.PerformLaunch();

				// allow subclasses opportunity to execute actions after the Home workspace is created
				OnAfterStartup(mainDesktopWindow, canShowHome);

				// reactivate the Home workspace
				if (canShowHome) tool.Launch();
			}
		}
Esempio n. 50
0
		public static bool CancelOrder(EntityRef orderRef, string description, IDesktopWindow desktopWindow)
		{
			// first check for warnings
			QueryCancelOrderWarningsResponse response = null;
			Platform.GetService<IOrderEntryService>(
				service => response = service.QueryCancelOrderWarnings(new QueryCancelOrderWarningsRequest(orderRef)));

			if (response.Errors != null && response.Errors.Count > 0)
			{
				var error = CollectionUtils.FirstElement(response.Errors);
				desktopWindow.ShowMessageBox(error, MessageBoxActions.Ok);
				return false;
			}

			if (response.Warnings != null && response.Warnings.Count > 0)
			{
				var warn = CollectionUtils.FirstElement(response.Warnings);
				var action = desktopWindow.ShowMessageBox(
					warn + "\n\nAre you sure you want to cancel this order?",
					MessageBoxActions.YesNo);
				if (action == DialogBoxAction.No)
					return false;
			}

			var cancelOrderComponent = new CancelOrderComponent(orderRef);
			var exitCode = ApplicationComponent.LaunchAsDialog(
				desktopWindow,
				cancelOrderComponent,
				String.Format(SR.TitleCancelOrder, description));

			if (exitCode == ApplicationComponentExitCode.Accepted)
			{
				Platform.GetService<IOrderEntryService>(
					service => service.CancelOrder(new CancelOrderRequest(orderRef, cancelOrderComponent.SelectedCancelReason)));

				return true;
			}
			return false;
		}
			public static bool Load(StudyFilterComponent component, IDesktopWindow desktopWindow, bool allowCancel, IEnumerable<string> paths, bool recursive)
			{
				BackgroundTaskTerminatedEventArgs evArgs = null;

				try
				{
					using (var task = new BackgroundTask(LoadWorker, allowCancel, new State(component, paths, recursive)))
					{
						task.Terminated += (s, e) => evArgs = e;
						ProgressDialog.Show(task, desktopWindow, true, ProgressBarStyle.Continuous);
					}
				}
				catch (Exception ex)
				{
					ExceptionHandler.Report(ex, desktopWindow);
					return false;
				}

				if (evArgs.Reason == BackgroundTaskTerminatedReason.Exception && evArgs.Exception != null)
					ExceptionHandler.Report(evArgs.Exception, desktopWindow);
				return evArgs.Reason == BackgroundTaskTerminatedReason.Completed;
			}
        public void Show()
        {
            if (_shelves.ContainsKey(Context.DesktopWindow))
            {
                _shelves[Context.DesktopWindow].Activate();
            }
            else
            {
                BlockingOperation.Run(delegate
                                        {
                                            _desktopWindow = Context.DesktopWindow;
                                            var aimComponent = new AimAnnotationComponent(Context.DesktopWindow);
                                            var shelf = ApplicationComponent.LaunchAsShelf(
                                                _desktopWindow,
                                                aimComponent,
                                                SR.TitleAIMCreater,
                                                "AIM Annotation",
                                                ShelfDisplayHint.DockRight | ShelfDisplayHint.DockAutoHide);

                                            shelf.Closed += OnShelfClosed;
                                            _shelves[_desktopWindow] = shelf;
                                        });
            }
        }
Esempio n. 53
0
		internal static void OnDesktopWindowClosed(IDesktopWindow desktopWindow)
		{
			desktopWindow.Workspaces.ItemActivationChanged -= OnWorkspaceActivated;
			_clipboardShelves.Remove(desktopWindow);
		}
Esempio n. 54
0
		internal static void OnDesktopWindowOpened(IDesktopWindow desktopWindow)
		{
			desktopWindow.Workspaces.ItemActivationChanged += OnWorkspaceActivated;
			_clipboardShelves[desktopWindow] = null;
		}
Esempio n. 55
0
		internal static KeyImageInformation GetKeyImageInformation(IDesktopWindow desktopWindow)
		{
			IShelf shelf = GetClipboardShelf(desktopWindow);
			if (shelf == null)
				return null;

			if (!PermissionsHelper.IsInRole(AuthorityTokens.KeyImages))
				throw new PolicyException(SR.ExceptionViewKeyImagePermissionDenied);

			KeyImageClipboardComponent component = shelf.Component as KeyImageClipboardComponent;
			if (component != null)
				return component.KeyImageInformation;
			else
				return null;
		}
Esempio n. 56
0
		/// <summary>
		/// Reports the specified exception to the user, displaying the specified user message first.
		/// </summary>
		/// <remarks>
		/// The exception is also automatically logged.
		/// </remarks>
		/// <param name="e">Exception to report.</param>
		/// <param name="contextualMessage">User-friendly (contextual) message to display, instead of the message contained in the exception.</param>
		/// <param name="desktopWindow">Desktop window that parents the exception dialog.</param>
		/// <param name="abortDelegate">A callback delegate for aborting the exception-causing operation.  Decision as to whether or
		/// not the callback is called is up to the individual <see cref="IExceptionPolicy"/>.</param>
		public static void Report(Exception e, [param : Localizable(true)] string contextualMessage, IDesktopWindow desktopWindow, AbortOperationDelegate abortDelegate)
		{
			ExceptionPolicyFactory.GetPolicy(e.GetType()).
				Handle(e, new ExceptionHandlingContext(e, contextualMessage, desktopWindow, abortDelegate));
		}
Esempio n. 57
0
		/// <summary>
		/// Reports the specified exception to the user, displaying the specified user message first.
		/// </summary>
		/// <remarks>
		/// The exception is also automatically logged.
		/// </remarks>
		/// <param name="e">Exception to report.</param>
		/// <param name="userMessage">User-friendly message to display, instead of the message contained in the exception.</param>
		/// <param name="desktopWindow">Desktop window that parents the exception dialog.</param>
		public static void Report(Exception e, [param : Localizable(true)] string userMessage, IDesktopWindow desktopWindow)
		{
			Report(e, userMessage, desktopWindow, null);
		}
Esempio n. 58
0
		public static void Show(IDesktopWindow desktopWindow)
		{
			Show(desktopWindow, ShelfDisplayHint.DockLeft);
		}
Esempio n. 59
0
		public static void Show(IDesktopWindow desktopWindow, ShelfDisplayHint displayHint)
		{
			if (!PermissionsHelper.IsInRole(AuthorityTokens.KeyImages))
				throw new PolicyException(SR.ExceptionViewKeyImagePermissionDenied);

			desktopWindow = desktopWindow ?? Application.ActiveDesktopWindow;

			IShelf shelf = GetClipboardShelf(desktopWindow);
			if (shelf != null)
			{
				shelf.Activate();
			}
			else
			{
				Workspace activeWorkspace = desktopWindow.ActiveWorkspace;
				KeyImageInformation info = GetKeyImageInformation(activeWorkspace) ?? new KeyImageInformation();
				ClipboardComponent component = new KeyImageClipboardComponent(info);
				shelf = ApplicationComponent.LaunchAsShelf(desktopWindow, component, SR.TitleKeyImages, displayHint);
				shelf.Closed += OnClipboardShelfClosed;

				_clipboardShelves[desktopWindow] = shelf;
			}
		}
Esempio n. 60
0
		/// <summary>
		/// Reports the specified exception to the user, using the <see cref="Exception.Message"/> property value as the
		/// message.
		/// </summary>
		/// <remarks>
		/// The exception is also automatically logged.
		/// </remarks>
		/// <param name="e">Exception to report.</param>
		/// <param name="desktopWindow">Desktop window that parents the exception dialog.</param>
		public static void Report(Exception e, IDesktopWindow desktopWindow)
		{
			Report(e, null, desktopWindow);
		}