Example #1
0
        /// <summary>
        /// 轉點字並預覽明眼字列印結果(只能預覽,不真的印出)。
        /// </summary>
        private void ConvertAndPrintPreview()
        {
            if (!HasDefaultTextPrinter())
            {
                MessageBox.Show("尚未選擇預設印表機!");

                if (!SetDefaultPreviewPrinter())
                {
                    return;
                }
            }

            string brlFileName = null;

            if (!ConvertTextToBraille(rtbOrg.Text, out brlFileName))
            {
                return;
            }

            m_BusyForm = new BusyForm
            {
                Message = "正在載入點字資料..."
            };
            m_BusyForm.Show();
            m_BusyForm.UseWaitCursor = true;
            this.Enabled             = false;

            DualPrintDialog dlg = null;

            try
            {
                dlg = new DualPrintDialog(brlFileName);
            }
            finally
            {
                this.Enabled = true;
                m_BusyForm.Hide();
                m_BusyForm.Close();
            }

            try
            {
                // 一定要讓 main form 變成作用中視窗,否則預覽列印對話窗不會變成 top-level window!!
                this.Activate();
                dlg.PreviewText();
            }
            finally
            {
                this.Show();
                this.BringToFront();
                this.Activate();
            }
        }
Example #2
0
        /// <summary>
        /// 載入雙視檔案,並開啟雙視編輯視窗。
        /// </summary>
        /// <param name="filename">點字檔名。</param>
        private void OpenBrailleFileInEditor(string filename)
        {
            m_BusyForm = new BusyForm
            {
                Message = "正在載入點字資料..."
            };
            m_BusyForm.Show();
            m_BusyForm.UseWaitCursor = true;
            this.Enabled             = false;

            DualEditForm frm = null;

            try
            {
                // 直接開啟雙視編輯視窗
                frm = new DualEditForm(filename);
            }
            finally
            {
                this.Enabled = true;
                m_BusyForm.Hide();
                m_BusyForm.Close();
            }

            this.ShowInTaskbar = false;
            try
            {
                frm.ShowDialog();
            }
            finally
            {
                this.ShowInTaskbar = true;
                this.Show();
                this.BringToFront();
                this.Activate();
            }
        }