Ejemplo n.º 1
0
        private void StartWebViewer()
        {
            var rootPanel = RootVisual as Panel;
            
            //TODO (CR May 2010): need the lock?
            lock (_startLock)
            {
                if (_context != null)
                    return;

                _context = ApplicationContext.Initialize();
            }

            string query = HtmlPage.Document.DocumentUri.Query;

            Imageviewer viewer;

            if (!string.IsNullOrEmpty(query))
            {
                var request = new StartViewerApplicationRequest
                {
                    AccessionNumber = new ObservableCollection<string>(),
                    StudyInstanceUid = new ObservableCollection<string>(),
                    PatientId = new ObservableCollection<string>()
                };

                string[] vals = HttpUtility.UrlDecode(query).Split(new[] { '?', ';', '=', ',', '&' });
                for (int i = 0; i < vals.Length - 1; i++)
                {
                    if (String.IsNullOrEmpty(vals[i]))
                        continue;

                    if (vals[i].Equals("study"))
                    {
                        i++;
                        request.StudyInstanceUid.Add(vals[i]);
                    }
                    else if (vals[i].Equals("patientid"))
                    {
                        i++;
                        request.PatientId.Add(vals[i]);
                    }
                    else if (vals[i].Equals("aetitle"))
                    {
                        i++;
                        request.AeTitle = vals[i];
                    }
                    else if (vals[i].Equals("accession"))
                    {
                        i++;
                        request.AccessionNumber.Add(vals[i]);
                    }
                    else if (vals[i].Equals("application"))
                    {
                        i++;
                        request.ApplicationName = vals[i];
                    }
                }

                request.Username = ApplicationContext.Current.Parameters.Username;
                request.SessionId = ApplicationContext.Current.Parameters.SessionToken;
                request.IsSessionShared = ApplicationContext.Current.Parameters.IsSessionShared;

                viewer = new Imageviewer(request);
            }
            else
            {
                viewer = new Imageviewer(null);
            }

            viewer.EventMediator.CriticalError += CriticalError;
            viewer.EventMediator.ServerApplicationStopped += OnServerApplicationStopped;
            viewer.EventMediator.ChannelOpened += OnChannelOpened;
            viewer.EventMediator.ChannelOpening += OnChannelOpening;
            viewer.EventMediator.WarningEvent += OnWarning;

            if (rootPanel != null)
            {
                // Add a Log Panel at the bottom of the screen.  This can be opened by CTRL-ALT-L.
                _logPanel = new LogPanel
                {
                    Visibility = Visibility.Collapsed,
                    Height = 200
                };
                var theGrid = new Grid();
                theGrid.RowDefinitions.Add(new RowDefinition());
                theGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(0, GridUnitType.Auto) });
                _logPanel.SetValue(Grid.RowProperty, 1);
                viewer.SetValue(Grid.RowProperty, 0);
                theGrid.Children.Add(viewer);
                theGrid.Children.Add(_logPanel);
                rootPanel.Children.Add(theGrid);
                rootPanel.KeyUp += OnKeyUp;
                rootPanel.UpdateLayout();
            }
        }
Ejemplo n.º 2
0
		private void ApplicationExit(object sender, EventArgs e)
		{
			if (RootVisual is IDisposable)
			{
				((IDisposable)RootVisual).Dispose();
			}

			if (_context != null)
			{
				// TODO: SL does not support calling web service in Application Exit event
				_context.Dispose();
				_context = null;
			}
		}
Ejemplo n.º 3
0
 static public ApplicationContext Initialize()
 {
     ApplicationContext instance = new ApplicationContext();
     Current = instance;
     return instance;
 }