private void RunConsole() { string programID = "TempoRegiTorihikiReceipt"; System.Uri u = new System.Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase); string filePath = System.IO.Path.GetDirectoryName(u.LocalPath); string Mode = "2"; string depositNo = bbl.SimpleSelect1("52", "", Application.ProductName, "", "").Rows[0]["DepositNO"].ToString(); string cmdLine = InCompanyCD + " " + InOperatorCD + " " + Login_BL.GetHostName() + " " + Mode + " " + depositNo; //parameter try { try { cdo.RemoveDisplay(true); cdo.RemoveDisplay(true); } catch { } if (Base_DL.iniEntity.IsDM_D30Used) { CashDrawerOpen op = new CashDrawerOpen(); //2020_06_24 op.OpenCashDrawer(); //2020_06_24 << PTK } var pro = System.Diagnostics.Process.Start(filePath + @"\" + programID + ".exe", cmdLine + ""); pro.WaitForExit(); Stop_DisplayService(); } catch { } }
private void RunConsole() { string programID = "TempoRegiTorihikiReceipt"; System.Uri u = new System.Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase); string filePath = System.IO.Path.GetDirectoryName(u.LocalPath); string Mode = "5"; dtDepositNO = bbl.SimpleSelect1("52", "", Application.ProductName, "", ""); string DepositeNO = dtDepositNO.Rows[0]["DepositNO"].ToString(); string cmdLine = InCompanyCD + " " + InOperatorCD + " " + Login_BL.GetHostName() + " " + Mode + " " + DepositeNO; try { // MessageBox.Show(filePath + @"\" + programID + ".exe", cmdLine + ""); try { // Stop_DisplayService(); cdo.RemoveDisplay(true); cdo.RemoveDisplay(true); } catch { MessageBox.Show("Error in removing . . . ."); } if (Base_DL.iniEntity.IsDM_D30Used) // Wait { CashDrawerOpen op = new CashDrawerOpen(); //ses <<< PTK op.OpenCashDrawer(); } var pro = System.Diagnostics.Process.Start(filePath + @"\" + programID + ".exe", cmdLine + ""); // cdo.SetDisplay(true, true, Base_DL.iniEntity.DefaultMessage); pro.WaitForExit(); Stop_DisplayService(); // RunDisplay_Service(); } catch (Exception ex) { MessageBox.Show(ex.ToString() + Environment.NewLine + ex.StackTrace.ToString()); } }
private void OpenForm(object sender) { try { var programID = (sender as CKM_Button).Text; var exe_name = menu.Select("ProgramID = '" + programID + "'").CopyToDataTable().Rows[0]["ProgramID_ID"].ToString(); if (Base_DL.iniEntity.IsDM_D30Used && exe_name == "CashDrawerOpen") { try { CashDrawerOpen cdo_open = new CashDrawerOpen(); cdo_open.OpenCashDrawer(); //Base_DL.iniEntity.CDO_DISPLAY = new EPSON_TM30.CashDrawerOpen(); ; //Base_DL.iniEntity.CDO_DISPLAY.OpenCashDrawer(); } catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); } // op.OpenCashDrawer(); } else { //System.Uri u = new System.Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase); //string filePath = System.IO.Path.GetDirectoryName(u.LocalPath); string filePath = ""; //System.Diagnostics.Debug if (Debugger.IsAttached || Login_BL.Islocalized) { System.Uri u = new System.Uri(System.Reflection.Assembly.GetExecutingAssembly().CodeBase); filePath = System.IO.Path.GetDirectoryName(u.LocalPath); } else { filePath = @"C:\\SMS\\AppData"; } string cmdLine = " " + "01" + " " + mse.StaffCD + " " + Login_BL.GetHostName(); //Process[] localByName = Process.GetProcessesByName(exe_name); //if (localByName.Count() > 0) //{ // IntPtr handle = localByName[0].MainWindowHandle; // ShowWindow(handle, SW_SHOWMAXIMIZED); // return; //} //if (exe_name == "TempoRegiHanbaiTouroku" ) //{ // try // { // if (Base_DL.iniEntity.IsDM_D30Used) // { // cdo.RemoveDisplay(); // } // // Base_DL.Ini_Entity_CDP.CDO_DISPLAY.RemoveDisplay(); // } // catch // { // MessageBox.Show("Reclick on HBT"); // } //} RejectDisplay(exe_name); Process[] localByName = Process.GetProcessesByName(exe_name); if (localByName.Count() > 0) { //if (programID.TrimEnd() == "販売登録" || exe_name == "TempoRegiHanbaiTouroku" || exe_name == "TempoRegiHanbaiTouroku.exe") //{ // // Login_BL bbl_1 = new Login_BL(); // // bbl_1.Display_Service_Update(false); //} IntPtr handle = localByName[0].MainWindowHandle; ShowWindow(handle, SW_SHOWMAXIMIZED); SetForegroundWindow(handle); return; } //if (P) // (sender as CKM_Button).Tag = System.Diagnostics.Process.Start(filePath + @"\" + exe_name + ".exe", cmdLine + ""); //original ///ptk /// (sender as CKM_Button).Tag = System.Diagnostics.Process.Start(filePath + @"\" + exe_name + ".exe", cmdLine + ""); //if (programID.TrimEnd() == "販売登録" || exe_name == "TempoRegiHanbaiTouroku") //{ // try // { // using (Process exeProcess = Process.Start(filePath + @"\" + exe_name + ".exe", cmdLine + "")) // { // if (Base_DL.iniEntity.IsDM_D30Used) // { // exeProcess.WaitForExit(); // cdo.SetDisplay(true, true, Base_DL.iniEntity.DefaultMessage); // } // } // } // catch (Exception ex) // { // MessageBox.Show(ex.Message + filePath + @"\" + exe_name + ".exe"); // } //} //else //{ (sender as CKM_Button).Tag = System.Diagnostics.Process.Start(filePath + @"\" + exe_name + ".exe", cmdLine + ""); //} ///ptk } } catch (Exception ex) { MessageBox.Show("The program cannot locate to the specified file!!!"); } }