Beispiel #1
0
        /// <summary>
        /// This method will initiate a custom user selection by showing the export 
        /// selection dialog, then parse the selections and return the sequence object.
        /// This method is for any sequence data other than BED.
        /// </summary>
        /// <param name="callbackAfterComplete">
        /// Method to call after the selection and parsing process is complete.
        /// </param>
        /// <param name="argsForCallback">Callback arguments</param>
        public void GetSequencesForExport(
                SequenceSelectionComplete callbackAfterComplete,
                params object[] argsForCallback)
        {
            this.inputSequenceSelectionComplete = callbackAfterComplete;
            this.argsForCallback = argsForCallback;

            Globals.ThisAddIn.Application.Cursor = XlMousePointer.xlWait;
            ExportSelectionDialog selectionDialog = new ExportSelectionDialog(ShowSelectionHelper, maxSeqCount);
            selectionDialog.Activated += new EventHandler(OnWPFWindowActivated);
            selectionDialog.IsSequenceNameVisible = true;

            if (argsForCallback[0] is Bio.IO.FastA.FastAFormatter)
            {
                selectionDialog.IsMetadataVisible = false;
            }
            else if (argsForCallback[0] is Bio.IO.FastQ.FastQFormatter)
            {
                selectionDialog.IsQualityScoresVisible = true;
            }
            else
            {
                selectionDialog.IsMetadataVisible = true;
            }

            selectionDialog.Initialize();

            selectionDialog.SelectedItem.SequenceAddress = GetRangeAddress(Globals.ThisAddIn.Application.Selection);
            System.Windows.Interop.WindowInteropHelper helper = new System.Windows.Interop.WindowInteropHelper(selectionDialog);
            helper.Owner = (IntPtr)Globals.ThisAddIn.Application.Hwnd;
            selectionDialog.InputSelectionDialogSubmitting += new SequenceSelectionDialogSubmit(OnExportSequenceDialogSubmit);
            selectionDialog.ShowDialog(); // this call will exit when selection window is shown as this dialog will be hidden.
        }