Ejemplo n.º 1
0
        /// <summary>
        /// Activate the tool action.
        /// </summary>
        /// <remarks>
        /// This function detects secondary monitor if availible then open the study in separate window and show it in the secondary monitor
        /// </remarks>
        public void Activate()
        {
            //Get Current Selected Study
            StudyItem item = this.Context.SelectedStudy;
            
            if (item != null)
            {
                string[] studyInstanceUids = { "" + item.StudyInstanceUID + "" };
                
                //Create an OpenStudyArgs to be used later to open the study
                //Note that I used WindowBehaviour.Separate to open the study in a separate Form
                OpenStudyArgs args = new OpenStudyArgs(studyInstanceUids, item.Server, item.StudyLoaderName, WindowBehaviour.Separate);
                
                //Open the selected study 
                OpenStudyHelper.OpenStudies(args);
                
                //Move it to secondary screen if only there are more than one screen
                if (System.Windows.Forms.Screen.AllScreens.Length > 1)
                {
                    //Get All System Screens
                    System.Windows.Forms.Screen[] Screens = System.Windows.Forms.Screen.AllScreens;

                    //Create a variable to hold the secondary screen variable and assign it to null
                    System.Windows.Forms.Screen SecScreenVar;
                    SecScreenVar = null;

                    //assign the SecScreenVar to the secondary screen
                    foreach (System.Windows.Forms.Screen SecScreen in Screens)
                    {
                        //if its the secondary assign it
                        if (SecScreen.Primary == false)
                        {
                            SecScreenVar = SecScreen;
                        }
                    }

                    //If a secondary screen found
                    if (SecScreenVar != null)
                    {
                        //Get the newly opened study window
                        Form currentForm = Form.ActiveForm;
                        
                        //Set its start position to manual
                        currentForm.StartPosition = FormStartPosition.Manual;

                        //Set its location to the secondary screen
                        currentForm.Location = SecScreenVar.WorkingArea.Location;

                        //Set its size to the secondary screen size
                        currentForm.Size = new Size(SecScreenVar.WorkingArea.Width, SecScreenVar.WorkingArea.Height);

                        //Reshow it in its new location
                        currentForm.Hide();
                        currentForm.Show();
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public static IImageViewer OpenStudies(OpenStudyArgs openStudyArgs)
        {
            OpenStudyHelper helper = new OpenStudyHelper();

            helper.WindowBehaviour = openStudyArgs.WindowBehaviour;
            foreach (string studyInstanceUid in openStudyArgs.StudyInstanceUids)
            {
                helper.AddStudy(studyInstanceUid, openStudyArgs.Server);
            }

            return(helper.OpenStudies());
        }
Ejemplo n.º 3
0
		public static IImageViewer OpenStudies(OpenStudyArgs openStudyArgs)
		{
			OpenStudyHelper helper = new OpenStudyHelper();
			helper.WindowBehaviour = openStudyArgs.WindowBehaviour;
			foreach (string studyInstanceUid in openStudyArgs.StudyInstanceUids)
				helper.AddStudy(studyInstanceUid, openStudyArgs.Server);

			return helper.OpenStudies();
		}