示例#1
0
        private static IDesktopWindow GetLaunchWindow(WindowBehaviour windowBehaviour)
        {
            if (windowBehaviour == WindowBehaviour.Auto)
            {
                return(Application.ActiveDesktopWindow);
            }
            else if (windowBehaviour == WindowBehaviour.Single)
            {
                return(Application.ActiveDesktopWindow);
            }

            IDesktopWindow window;
            string         imageViewerWindow = "ImageViewer";

            // If an image viewer desktop window already exists, use it
            if (Application.DesktopWindows.Contains(imageViewerWindow))
            {
                window = Application.DesktopWindows[imageViewerWindow];
            }
            // If not, create one
            else
            {
                DesktopWindowCreationArgs args = new DesktopWindowCreationArgs("", imageViewerWindow);
                window = Application.DesktopWindows.AddNew(args);
            }

            return(window);
        }
 internal WebDesktopWindow(DesktopWindowCreationArgs args, Application application)
     : base(args, application)
 {
 }
示例#3
0
        protected override void OnStart(StartApplicationRequest request)
        {
            lock (_syncLock)
            {
                Platform.Log(LogLevel.Info, "Viewer Application is starting...");
                if (Application.Instance == null)
                {
                    Platform.StartApp("ClearCanvas.Desktop.Application", new string[] { "-r" });
                }
            }



            if (Platform.IsLogLevelEnabled(LogLevel.Debug))
            {
                Platform.Log(LogLevel.Debug, "Finding studies...");
            }
            var startRequest = (StartViewerApplicationRequest)request;
            IList <StudyRootStudyIdentifier> studies = FindStudies(startRequest);

            List <LoadStudyArgs> loadArgs = CollectionUtils.Map(studies, (StudyRootStudyIdentifier identifier) => CreateLoadStudyArgs(identifier));

            DesktopWindowCreationArgs args   = new DesktopWindowCreationArgs("", Identifier.ToString());
            WebDesktopWindow          window = new WebDesktopWindow(args, Application.Instance);

            window.Open();

            _viewer = CreateViewerComponent(startRequest);

            try
            {
                if (Platform.IsLogLevelEnabled(LogLevel.Debug))
                {
                    Platform.Log(LogLevel.Debug, "Loading study...");
                }
                _viewer.LoadStudies(loadArgs);
            }
            catch (Exception e)
            {
                if (!AnySopsLoaded(_viewer))                 //end the app.
                {
                    throw;
                }

                //Show an error and continue.
                ExceptionHandler.Report(e, window);
            }

            if (Platform.IsLogLevelEnabled(LogLevel.Debug))
            {
                Platform.Log(LogLevel.Info, "Launching viewer...");
            }

            ImageViewerComponent.Launch(_viewer, window, "");

            _viewerHandler = EntityHandler.Create <ViewerEntityHandler>();
            _viewerHandler.SetModelObject(_viewer);
            _app = new Common.ViewerApplication
            {
                Identifier = Identifier,
                Viewer     = (Viewer)_viewerHandler.GetEntity(),

                VersionString = GetProductVersionString()
            };


            // Push the ViewerApplication object to the client
            Event @event = new PropertyChangedEvent
            {
                PropertyName = "Application",
                Value        = _app,
                Identifier   = Guid.NewGuid(),
                SenderId     = request.Identifier
            };

            ApplicationContext.Current.FireEvent(@event);
        }
示例#4
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="args"></param>
 /// <param name="application"></param>
 protected internal RisDesktopWindow(DesktopWindowCreationArgs args, Desktop.Application application)
     : base(args, application)
 {
     // set the current session before attempting to access other services, as these will require authentication
     LoginSession.Create(SessionManager.FacilityCode);
 }
示例#5
0
 /// <summary>
 /// Creates a new desktop window for the specified arguments.
 /// </summary>
 /// <param name="args">Arguments that control the creation of the desktop window.</param>
 /// <param name="application">The application with which the window is associated.</param>
 /// <returns>A new desktop window instance.</returns>
 public DesktopWindow CreateWindow(DesktopWindowCreationArgs args, Desktop.Application application)
 {
     return(new RisDesktopWindow(args, application));
 }