/// <summary>
        /// 顯示一般對話視窗或是設置結果(測試時),從詩人身上讀取輸入資料
        /// </summary>
        /// <param name="cd">對話視窗實體</param>
        /// <param name="owner">父表單</param>
        /// <returns>結果</returns>
        public static DialogResult ShowDialogOrSetResult(this CommonDialog cd, IWin32Window owner)
        {
            if (!Registered)
            {
                if (owner == null)
                {
                    return(cd.ShowDialog());
                }
                else
                {
                    return(cd.ShowDialog(owner));
                }
            }

            if (Bard.InputInformation == null)
            {
                throw new ArgumentNullException("Text Context Connected Failed");
            }

            string       dialogTypeName = cd.GetType().Name;
            string       record;
            DialogResult dr = DialogResult.OK;

            PropertyInfo[] cdProps = cd.GetType().GetProperties();

            record = $"Open Dialog: \"{cd.GetType().Name}\"";
            Bard.MessageReceived.Add(record);
            Archivist.WriteRecord(record);

            foreach (PropertyInfo pi in cdProps)
            {
                object value = Bard.InputInformation[$"{cd.GetType().Name}.{pi.Name}"] ??
                               Bard.InputInformation[pi.Name];

                if (value != null)
                {
                    pi.SetValue(cd, value);
                    record = $"{dialogTypeName}.{pi.Name} = {value}";
                    Bard.MessageReceived.Add(record);
                    Archivist.WriteRecord(record);
                }
            }

            if (Bard.InputInformation["DialogResult"] != null)
            {
                dr = (DialogResult)Bard.InputInformation["DialogResult"];
            }
            else if (Bard.InputInformation[$"{dialogTypeName}.DialogResult"] != null)
            {
                dr = (DialogResult)Bard.InputInformation[$"{dialogTypeName}.DialogResult"];
            }

            if (dr != DialogResult.OK && dr != DialogResult.Cancel)
            {
                throw new InvalidCastException("DialogResult");
            }

            record = $"DialogResult = [{dr}]";
            Bard.MessageReceived.Add(record);
            Archivist.WriteRecord(record);
            return(dr);
        }