Example #1
0
        private void OnApplicationEvent(object sender, ServerEventArgs e)
        {
            if (!(e.ServerEvent is PropertyChangedEvent))
            {
                return;
            }

            var ev = (PropertyChangedEvent)e.ServerEvent;

            if (ev.PropertyName == "Application")
            {
                ViewModel.IsLoading = false;

                _serverApplication = (ViewerApplication)ev.Value;

                ApplicationContext.Current.ViewerVersion = _serverApplication.VersionString;

                //TODO (CR May 2010): we don't unregister these
                EventMediator.RegisterEventHandler(_serverApplication.Viewer.Identifier, OnViewerEvent);
                ToolstripViewComponent.SetIconSize(_serverApplication.Viewer.ToolStripIconSize);
                ToolstripViewComponent.SetActionModel(_serverApplication.Viewer.ToolbarActions);
                _studyView.SetImageBoxes(_serverApplication.Viewer.ImageBoxes);
                return;
            }
        }
Example #2
0
        private void OnViewerEvent(object sender, ServerEventArgs e)
        {
            if (!(e.ServerEvent is PropertyChangedEvent))
            {
                return;
            }

            var ev = (PropertyChangedEvent)e.ServerEvent;

            //TODO (CR May 2010): this is in the method above, too.  Which one works?
            if (ev.PropertyName == "Application")
            {
                _serverApplication = (ViewerApplication)ev.Value;
                //TODO (CR May 2010): we don't unregister these
                EventMediator.RegisterEventHandler(_serverApplication.Viewer.Identifier, OnViewerEvent);
                ToolstripViewComponent.SetIconSize(_serverApplication.Viewer.ToolStripIconSize);
                ToolstripViewComponent.SetActionModel(_serverApplication.Viewer.ToolbarActions);
                _studyView.SetImageBoxes(_serverApplication.Viewer.ImageBoxes);
                return;
            }

            if (ev.PropertyName == "ImageBoxes")
            {
                var imageBoxes = (Collection <ImageBox>)ev.Value;
                _serverApplication.Viewer.ImageBoxes = imageBoxes;
                _studyView.SetImageBoxes(imageBoxes);
                return;
            }

            if (ev.PropertyName == "ToolbarActions")
            {
                var actionModel = (Collection <WebActionNode>)ev.Value;
                _serverApplication.Viewer.ToolbarActions = actionModel;
                ToolstripViewComponent.SetActionModel(_serverApplication.Viewer.ToolbarActions);
                return;
            }
        }