protected void OpenTranscriptionEditor(ReportingWorklistItemSummary item)
        {
            if (ActivateIfAlreadyOpen(item))
            {
                return;
            }

            if (!TranscriptionSettings.Default.AllowMultipleTranscriptionWorkspaces)
            {
                var documents = DocumentManager.GetAll <TranscriptionDocument>();

                // 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.MessageTranscriptionComponentAlreadyOpened,
                                                TranscriptionDocument.StripTitle(firstDocument.GetTitle()),
                                                TranscriptionDocument.StripTitle(TranscriptionDocument.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 report editor
            var doc = new TranscriptionDocument(item, this.Context);

            doc.Open();

            // Need to re-invalidate folders that open a report document, since cancelling the report
            // can re-insert items into the same folder.
            var selectedFolderType = this.Context.SelectedFolder.GetType();              // use closure to remember selected folder at time tool is invoked.

            doc.Closed += delegate { DocumentManager.InvalidateFolder(selectedFolderType); };
        }
Exemple #2
0
 public override string GetTitle()
 {
     return(TranscriptionDocument.GetTitle(_worklistItem));
 }