private void UpdateChildComponents()
        {
            ((BannerComponent)_bannerComponentHost.Component).HealthcareContext            = this.WorklistItem;
            ((ProtocolEditorComponent)_protocolEditorComponentHost.Component).WorklistItem = this.WorklistItem;
            ((ProtocolEditorComponent)_protocolEditorComponentHost.Component).CanEdit      = this.SaveEnabled;
            _priorReportsComponent.SetContext(this.WorklistItem, null);
            _orderDetailViewComponent.Context   = new OrderDetailViewComponent.OrderContext(this.WorklistItem.OrderRef);
            _orderAttachmentsComponent.OrderRef = this.WorklistItem.OrderRef;

            // Load notes for new current item.
            ((OrderNoteSummaryComponent)_orderNotesComponentHost.Component).Notes = _notes;

            // Update title
            this.Host.Title = ProtocolDocument.GetTitle(this.WorklistItem);

            NotifyPropertyChanged("StatusText");
            NotifyPropertyChanged("ProceduresText");
        }
        public override void Start()
        {
            StartProtocollingWorklistItem();

            this.Host.Title = ProtocolDocument.GetTitle(this.WorklistItem);

            _bannerComponentHost = new ChildComponentHost(this.Host, new BannerComponent(this.WorklistItem));
            _bannerComponentHost.StartComponent();

            _orderNotesComponentHost = new ChildComponentHost(this.Host, new OrderNoteSummaryComponent(OrderNoteCategory.Protocol, this.SaveEnabled));
            _orderNotesComponentHost.StartComponent();
            ((OrderNoteSummaryComponent)_orderNotesComponentHost.Component).Notes = _notes;
            _orderNotesComponentHost.Component.ModifiedChanged += ((sender, args) =>
                                                                   this.Modified = this.Modified || _orderNotesComponentHost.Component.Modified);

            _protocolEditorComponentHost = new ChildComponentHost(this.Host, new ProtocolEditorComponent(this.WorklistItem));
            _protocolEditorComponentHost.StartComponent();
            ((ProtocolEditorComponent)_protocolEditorComponentHost.Component).CanEdit = this.SaveEnabled;
            _protocolEditorComponentHost.Component.ModifiedChanged += ((sender, args) =>
                                                                       this.Modified = this.Modified || _protocolEditorComponentHost.Component.Modified);

            _rightHandComponentContainer = new TabComponentContainer();

            _orderDetailViewComponent = new ProtocollingOrderDetailViewComponent(this.WorklistItem.PatientRef, this.WorklistItem.OrderRef);
            _rightHandComponentContainer.Pages.Add(new TabPage(SR.TitleOrder, _orderDetailViewComponent));

            _orderAttachmentsComponent          = new AttachedDocumentPreviewComponent(true, AttachmentSite.Order);
            _orderAttachmentsComponent.OrderRef = this.WorklistItem.OrderRef;
            _rightHandComponentContainer.Pages.Add(new TabPage(SR.TitleOrderAttachments, _orderAttachmentsComponent));

            _additionalInfoComponent = new OrderAdditionalInfoComponent(true);
            _additionalInfoComponent.OrderExtendedProperties = _orderDetail.ExtendedProperties;
            _additionalInfoComponent.Context = new OrderAdditionalInfoComponent.HealthcareContext(this.WorklistItem.OrderRef);
            _rightHandComponentContainer.Pages.Add(new TabPage(SR.TitleAdditionalInfo, _additionalInfoComponent));

            _rightHandComponentContainer.Pages.Add(new TabPage(SR.TitlePriors, _priorReportsComponent = new PriorReportComponent(this.WorklistItem)));

            _rightHandComponentContainerHost = new ChildComponentHost(this.Host, _rightHandComponentContainer);
            _rightHandComponentContainerHost.StartComponent();

            SetInitialProtocollingTabPage();

            base.Start();
        }
        private void OpenProtocolEditor(ReportingWorklistItemSummary item)
        {
            if (ActivateIfAlreadyOpen(item))
            {
                return;
            }

            if (!ProtocollingSettings.Default.AllowMultipleProtocollingWorkspaces)
            {
                var documents = DocumentManager.GetAll <ProtocolDocument>();

                // Show warning message and ask if the existing document should be closed or not
                if (documents.Count > 0)
                {
                    var firstDocument = CollectionUtils.FirstElement(documents);
                    firstDocument.Open();

                    var message = string.Format(SR.MessageProtocollingComponentAlreadyOpened,
                                                ProtocolDocument.StripTitle(firstDocument.GetTitle()),
                                                ProtocolDocument.StripTitle(ProtocolDocument.GetTitle(item)));
                    if (DialogBoxAction.No == this.Context.DesktopWindow.ShowMessageBox(message, MessageBoxActions.YesNo))
                    {
                        return;                                 // Leave the existing document open
                    }
                    // close documents and continue
                    CollectionUtils.ForEach(documents, document => document.SaveAndClose());
                }
            }

            // open the protocol editor
            var protocolDocument = new ProtocolDocument(item, GetMode(item), this.Context);

            protocolDocument.Open();

            var selectedFolderType = this.Context.SelectedFolder.GetType();

            protocolDocument.Closed += delegate { DocumentManager.InvalidateFolder(selectedFolderType); };
        }
		private void OpenProtocolEditor(ReportingWorklistItemSummary item)
		{
			if (ActivateIfAlreadyOpen(item))
				return;

			if (!ProtocollingSettings.Default.AllowMultipleProtocollingWorkspaces)
			{
				var documents = DocumentManager.GetAll<ProtocolDocument>();

				// Show warning message and ask if the existing document should be closed or not
				if (documents.Count > 0)
				{
					var firstDocument = CollectionUtils.FirstElement(documents);
					firstDocument.Open();

					var message = string.Format(SR.MessageProtocollingComponentAlreadyOpened, 
						ProtocolDocument.StripTitle(firstDocument.GetTitle()), 
						ProtocolDocument.StripTitle(ProtocolDocument.GetTitle(item)));
					if (DialogBoxAction.No == this.Context.DesktopWindow.ShowMessageBox(message, MessageBoxActions.YesNo))
						return;		// Leave the existing document open

					// close documents and continue
					CollectionUtils.ForEach(documents, document => document.SaveAndClose());
				}
			}

			// open the protocol editor
			var protocolDocument = new ProtocolDocument(item, GetMode(item), this.Context);
			protocolDocument.Open();

			var selectedFolderType = this.Context.SelectedFolder.GetType();
			protocolDocument.Closed += delegate { DocumentManager.InvalidateFolder(selectedFolderType); };
		}