コード例 #1
0
ファイル: ImageViewer.xaml.cs プロジェクト: hksonngan/Xian
        public ImageViewer(StartViewerApplicationRequest startRequest)
        {
            InitializeComponent();
            ViewModel = new ImageViewerViewModel
            {
                IsLoading = true
            };

            DataContext = ViewModel;

            if (ApplicationContext.Current != null)
            {
                ApplicationContext.Initialize();
                if (ApplicationContext.Current == null)
                {
                    throw new Exception();
                }
            }

            EventMediator = new ServerEventMediator();
            EventMediator.Initialize(ApplicationContext.Current.Parameters);

            EventMediator.CriticalError += ErrorHandler_OnCriticalError;

            EventMediator.RegisterEventHandler(typeof(ApplicationStartedEvent), ApplicationStarted);
            EventMediator.RegisterEventHandler(typeof(SessionUpdatedEvent), OnSessionUpdated);
            EventMediator.RegisterEventHandler(typeof(MessageBoxShownEvent), OnMessageBox);
            EventMediator.ServerApplicationStopped += OnServerApplicationStopped;

            _studyView = new StudyView(EventMediator);
            StudyViewContainer.Children.Add(_studyView);
            MouseHelper.SetBackgroundElement(LayoutRoot);

            if (startRequest == null)
            {
                //TODO: replace this with the custom dialog. For some reason, it doesn't work here.
                System.Windows.MessageBox.Show(ErrorMessages.MissingParameters);
            }
            else
            {
                ToolstripViewComponent.EventDispatcher = EventMediator;

                LayoutRoot.MouseLeftButtonDown  += ToolstripViewComponent.OnLoseFocus;
                LayoutRoot.MouseRightButtonDown += ToolstripViewComponent.OnLoseFocus;

                EventMediator.StartApplication(startRequest);

                TileView.ApplicationRootVisual = _studyView.StudyViewCanvas;

                LayoutRoot.KeyUp += OnKeyUp;
            }
        }
コード例 #2
0
ファイル: ImageViewer.xaml.cs プロジェクト: nhannd/Xian
        public ImageViewer(StartViewerApplicationRequest startRequest)
        {
            InitializeComponent();
            ViewModel = new ImageViewerViewModel
                            {
                                IsLoading = true
                            };
            
            DataContext = ViewModel;

            if (ApplicationContext.Current != null)
            {
                ApplicationContext.Initialize();
                if (ApplicationContext.Current == null) throw new Exception();
            }

            EventMediator = new ServerEventMediator();
            EventMediator.Initialize(ApplicationContext.Current.Parameters);

            EventMediator.CriticalError += ErrorHandler_OnCriticalError;

			EventMediator.RegisterEventHandler(typeof(ApplicationStartedEvent), ApplicationStarted);
            EventMediator.RegisterEventHandler(typeof(SessionUpdatedEvent), OnSessionUpdated);
            EventMediator.RegisterEventHandler(typeof(MessageBoxShownEvent), OnMessageBox);
            EventMediator.ServerApplicationStopped += OnServerApplicationStopped;
            
            _studyView = new StudyView(EventMediator);
			StudyViewContainer.Children.Add(_studyView);
            MouseHelper.SetBackgroundElement(LayoutRoot);

            if (startRequest == null)
            {
                //TODO: replace this with the custom dialog. For some reason, it doesn't work here.
                System.Windows.MessageBox.Show(ErrorMessages.MissingParameters);
            }
            else
            {

                ToolstripViewComponent.EventDispatcher = EventMediator;

                LayoutRoot.MouseLeftButtonDown += ToolstripViewComponent.OnLoseFocus;
                LayoutRoot.MouseRightButtonDown += ToolstripViewComponent.OnLoseFocus;

                EventMediator.StartApplication(startRequest);

                TileView.ApplicationRootVisual = _studyView.StudyViewCanvas;
                
                LayoutRoot.KeyUp += OnKeyUp;
            }
		}
コード例 #3
0
ファイル: ImageViewer.xaml.cs プロジェクト: hksonngan/Xian
        public void Shutdown()
        {
            if (!_shuttingDown)
            {
                _shuttingDown = true;
                EventMediator.StopApplication();

                Visibility = Visibility.Collapsed;

                if (_studyView != null)
                {
                    StudyViewContainer.Children.Clear();

                    MouseHelper.SetBackgroundElement(null);
                    _studyView.Dispose();
                    _studyView = null;
                }
            }
        }
コード例 #4
0
ファイル: ImageViewer.xaml.cs プロジェクト: hksonngan/Xian
        public virtual void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                Shutdown();

                // Must do this beofre we work with the EventMediator
                ToolstripViewComponent.Dispose();

                if (_studyView != null)
                {
                    StudyViewContainer.Children.Clear();
                    if (disposing)
                    {
                        _studyView.Dispose();
                    }
                    _studyView = null;
                }

                if (EventMediator != null)
                {
                    if (_serverApplication != null)
                    {
                        EventMediator.UnregisterEventHandler(typeof(ApplicationStartedEvent), ApplicationStarted);
                        EventMediator.UnregisterEventHandler(_serverApplication.Viewer.Identifier);
                        EventMediator.ServerApplicationStopped -= OnServerApplicationStopped;
                        _serverApplication = null;
                    }

                    EventMediator.Dispose();
                    EventMediator = null;
                }


                _disposed = true;
            }
        }
コード例 #5
0
ファイル: ImageViewer.xaml.cs プロジェクト: nhannd/Xian
        public virtual void Dispose(bool disposing)
        {
            if(!_disposed)
            {
                Shutdown();

                // Must do this beofre we work with the EventMediator
                ToolstripViewComponent.Dispose();

                if (_studyView != null)
                {
                    StudyViewContainer.Children.Clear();
                    if (disposing)
                    {
                        _studyView.Dispose();
                    }
                    _studyView = null;
                }

                if (EventMediator != null)
                {
                    if (_serverApplication != null)
                    {
                        EventMediator.UnregisterEventHandler(typeof(ApplicationStartedEvent), ApplicationStarted);
                        EventMediator.UnregisterEventHandler(_serverApplication.Viewer.Identifier);
                        EventMediator.ServerApplicationStopped -= OnServerApplicationStopped;
                        _serverApplication = null;
                    }

                    EventMediator.Dispose();
                    EventMediator = null;
                }


                _disposed = true;
            }
        }
コード例 #6
0
ファイル: ImageViewer.xaml.cs プロジェクト: nhannd/Xian
        public void Shutdown()
        {
            if (!_shuttingDown)
            {
                _shuttingDown = true;
                EventMediator.StopApplication();

                Visibility = Visibility.Collapsed;

                if (_studyView != null)
                {
                    StudyViewContainer.Children.Clear();
         
                    MouseHelper.SetBackgroundElement(null);
                    _studyView.Dispose();
                    _studyView = null;
                }
            }                      
        }