コード例 #1
0
ファイル: copypage.cs プロジェクト: lzk/windowVOP
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            string strDrvName = "";

            if (false == common.GetPrinterDrvName(m_MainWin.statusPanelPage.m_selectedPrinter, ref strDrvName))
            {
                m_MainWin.statusPanelPage.ShowMessage((string)this.TryFindResource("ResStr_Copy_Fail"), Brushes.Red);

                VOP.Controls.MessageBoxEx.Show(VOP.Controls.MessageBoxExStyle.Simple,
                                               m_MainWin,
                                               (string)this.FindResource("ResStr_can_not_be_carried_out_due_to_software_has_error__please_try__again_after_reinstall_the_Driver_and_Virtual_Operation_Panel_"),
                                               (string)this.FindResource("ResStr_Error"));
            }
            else
            {
                byte byteNin1 = (byte)m_nin1;

                if (true == chkBtnIDCardCopy.IsChecked)
                {
                    ResetValueForIDCardCopy();
                    byteNin1 = 4; // This value present sending ID Card Copy command.
                }

                bool bIsSendCmd = true;

                if (true == chkBtnIDCardCopy.IsChecked && true == m_MainWin.m_popupIDCard)
                {
                    CopyConfirm confirmDlg = new CopyConfirm();
                    confirmDlg.m_title = (string)FindResource("ResStr_ID_Card_Copy");

                    if (0x804 == App.LangId)
                    {
                        confirmDlg.gifs = new string[]
                        {
                            "pack://application:,,,/Media/IDCardCopy1_zh.gif",
                            "pack://application:,,,/Media/IDCardCopy2_zh.gif",
                        };
                    }
                    else
                    {
                        confirmDlg.gifs = new string[]
                        {
                            "pack://application:,,,/Media/IDCardCopy1_en.gif",
                            "pack://application:,,,/Media/IDCardCopy2_en.gif",
                        };
                    }

                    confirmDlg.Owner = m_MainWin;

                    if (true == confirmDlg.ShowDialog())
                    {
                        m_MainWin.m_popupIDCard = confirmDlg.m_popupDlg;
                        bIsSendCmd = true;
                    }
                    else
                    {
                        bIsSendCmd = false;
                    }
                }
                else if ((byte)EnumNin1._1up != m_nin1 && true == m_MainWin.m_popupNIn1)
                {
                    CopyConfirm confirmDlg = new CopyConfirm();
                    confirmDlg.m_title = (string)FindResource("ResStr_N_in_1_Copy");

                    if (0x804 == App.LangId)
                    {
                        confirmDlg.gifs = new string[]
                        {
                            "pack://application:,,,/Media/NIn1Copy1_zh.gif",
                            "pack://application:,,,/Media/NIn1Copy2_zh.gif",
                            "pack://application:,,,/Media/NIn1Copy3_zh.gif",
                        };
                    }
                    else
                    {
                        confirmDlg.gifs = new string[]
                        {
                            "pack://application:,,,/Media/NIn1Copy1_en.gif",
                            "pack://application:,,,/Media/NIn1Copy2_en.gif",
                            "pack://application:,,,/Media/NIn1Copy3_en.gif",
                        };
                    }

                    confirmDlg.Owner = m_MainWin;

                    if (true == confirmDlg.ShowDialog())
                    {
                        m_MainWin.m_popupNIn1 = confirmDlg.m_popupDlg;
                        bIsSendCmd            = true;
                    }
                    else
                    {
                        bIsSendCmd = false;
                    }
                }

                if (true == bIsSendCmd)
                {
                    AsyncWorker worker = new AsyncWorker(Application.Current.MainWindow);


                    dll.OutputDebugStringToFile_("CopyPage Start Invoke()\r\n");

                    EnumCmdResult ret = (EnumCmdResult)worker.InvokeCopyMethod(dll.SendCopyCmd,
                                                                               m_MainWin.statusPanelPage.m_selectedPrinter,
                                                                               m_density,
                                                                               (byte)spinCtlCopies.Value,
                                                                               (byte)m_scanMode,
                                                                               (byte)m_docSize,
                                                                               (byte)m_outputSize,
                                                                               (byte)byteNin1,
                                                                               (byte)m_dpi,
                                                                               (ushort)m_scaling,
                                                                               (byte)m_mediaType);

                    //EnumCmdResult ret = (EnumCmdResult)dll.SendCopyCmd(m_MainWin.statusPanelPage.m_selectedPrinter,
                    //                                                    m_density,
                    //                                                    (byte)spinCtlCopies.Value,
                    //                                                    (byte)m_scanMode,
                    //                                                    (byte)m_docSize,
                    //                                                    (byte)m_outputSize,
                    //                                                    (byte)byteNin1,
                    //                                                    (byte)m_dpi,
                    //                                                    (ushort)m_scaling,
                    //                                                    (byte)m_mediaType);

                    string strText = String.Format("CopyPage End Invoke()  {0} \r\n", ret);
                    dll.OutputDebugStringToFile_(strText);
                    switch (ret)
                    {
                    case EnumCmdResult._Do_not_support_this_function:
                        m_MainWin.statusPanelPage.ShowMessage((string)this.TryFindResource("ResStr_Copy_Fail"), Brushes.Red);

                        VOP.Controls.MessageBoxEx.Show(VOP.Controls.MessageBoxExStyle.Simple,
                                                       m_MainWin,
                                                       (string)this.FindResource("ResStr_Unsupported"),
                                                       (string)this.FindResource("ResStr_Error"));
                        break;

                    case EnumCmdResult._ACK:
                        break;

                    case EnumCmdResult._Printer_busy:
                        m_MainWin.statusPanelPage.ShowMessage((string)this.TryFindResource("ResStr_Copy_Fail"), Brushes.Red);

                        VOP.Controls.MessageBoxEx.Show(VOP.Controls.MessageBoxExStyle.Simple_Busy,
                                                       m_MainWin,
                                                       (string)this.FindResource("ResStr_The_machine_is_busy__please_try_later_"),
                                                       (string)this.FindResource("ResStr_Error"));
                        break;

                    default:
                        m_MainWin.statusPanelPage.ShowMessage((string)this.TryFindResource("ResStr_Copy_Fail"), Brushes.Red);

                        VOP.Controls.MessageBoxEx.Show(VOP.Controls.MessageBoxExStyle.Simple,
                                                       m_MainWin,
                                                       (string)this.FindResource("ResStr_Operation_can_not_be_carried_out_due_to_machine_malfunction_"),
                                                       (string)this.FindResource("ResStr_Error"));
                        break;
                    }
                }
            }
        }
コード例 #2
0
ファイル: AsyncWorker.cs プロジェクト: lzk/windowVOP
 public BaseRecord(string printerName)
 {
     this.printerName = printerName;
     cmdResult        = EnumCmdResult._CMD_invalid;
 }