static private String GetStrFromPtr(IntPtr Ptr) { if (Ptr != IntPtr.Zero) { StringBuilder strBuilder = new StringBuilder(); TrposxImport.OemToChar(Ptr, strBuilder); return(strBuilder.ToString()); } return(""); }
static public int TrPosXInit(string Path, out string strResp) { strResp = ""; //int i = TrposxImport.TRPOSX_Init(Path, ScShow, ScClose); int i = TrposxImport.CreateTrposxDriver(Path, ScShow, ScClose); strResp = GetResStr(i); return(i); }
static public void ScreenShow(IntPtr ScPar) { int l2 = Marshal.SizeOf(ScPar); object kk = Marshal.PtrToStructure(ScPar, typeof(TrposxImport.ScreenParams)); TrposxImport.ScreenParams tr = (TrposxImport.ScreenParams)kk; Marshal.StructureToPtr(tr, ScPar, true); ScreenParamsOut ScOut = ScreenParamsConvert(tr); Utils.ToCardLog("ScreenShow IDЖ " + ScOut.screenID + " AllStrs " + ScOut.AllStrs); if (tr.screenID == 3) { QFromTrposxForm TrPosXMessageForm = new QFromTrposxForm(ScOut.pTitle, ScOut.AllStrs); TrPosXMessageForm.button1.Text = ScOut.pButton0; TrPosXMessageForm.button2.Text = ScOut.pButton1; TrPosXMessageForm.button1.Visible = true; TrPosXMessageForm.button2.Visible = true; TrPosXMessageForm.button3.Visible = false; //TrPosXMessageForm.Init("Операция на терминале пластиковых карт.", ""); //TrPosXMessageForm.button1.Click += new EventHandler(button1_Click); //TrPosXMessageForm.button2.Click += new EventHandler(button2_Click); //TrPosXClass.RunOperationAsinc(inStr); TrPosXMessageForm.TopMost = true; TrPosXMessageForm.ShowDialog(); if (TrPosXMessageForm.Answ) { //Marshal.WriteInt32( tr.eventKey, 0x30); TrposxImport.SetEventKey(0x30); } else { TrposxImport.SetEventKey(0x31); //Marshal.WriteInt32(tr.eventKey, 0x31); } TrPosXMessageForm.Dispose(); } else { ShowScreenVoid(ScOut, tr.maxInp == 0); } if (tr.screenID == 5) { Thread.Sleep(2000); } //Thread.CurrentThread.Join(); //return 0; }
private static void mRunOperation() { IntPtr _pInt_buffer1 = Marshal.AllocHGlobal(4); IntPtr _pInt_buffer2 = Marshal.AllocHGlobal(4); StringBuilder bufferForResp = new StringBuilder(100000); StringBuilder bufferForReceipt = new StringBuilder(100000); IntPtr bufferForICode2 = Marshal.AllocHGlobal(4); int res = TrposxImport.TrposxDriverRunOper(OperString, bufferForResp, bufferForReceipt, bufferForICode2, 0, 0); string Resp = bufferForResp.ToString(); string Receipt = bufferForReceipt.ToString(); OperInProcess = false; RunOperationAsincComplitedVoid(res, GetResStr(res), Resp, Receipt); }
private static void mRunFoolReport() { StringBuilder bufferForResp = new StringBuilder(100000); StringBuilder bufferForReceipt = new StringBuilder(100000); IntPtr bufferForICode2 = Marshal.AllocHGlobal(4); Utils.ToCardLog("TrposxImport.TrposxDriverRunOper OperString: " + OperString + " "); int res = TrposxImport.TrposxDriverRunOper(OperString, bufferForResp, bufferForReceipt, bufferForICode2, 1, 0); string Resp = bufferForResp.ToString(); string Receipt = bufferForReceipt.ToString(); OperInProcess = false; RunOperationAsincComplitedVoid(res, GetResStr(res), Resp, Receipt); }
public static void RunOperation(string mOperString, out int ress, out string ResStr, out string Resp, out string Receipt) { OperString = mOperString; ress = 0; Resp = ""; Receipt = ""; if (!OperInProcess) { OperInProcess = true; IntPtr _pInt_buffer1 = Marshal.AllocHGlobal(4); IntPtr _pInt_buffer2 = Marshal.AllocHGlobal(4); StringBuilder bufferForResp = new StringBuilder(100000); StringBuilder bufferForReceipt = new StringBuilder(100000); IntPtr bufferForICode2 = Marshal.AllocHGlobal(4); ress = TrposxImport.TrposxDriverRunOper(OperString, bufferForResp, bufferForReceipt, bufferForICode2, 0, 0); Resp = bufferForResp.ToString(); Receipt = bufferForReceipt.ToString(); OperInProcess = false; //RunOperationAsincComplitedVoid(res, GetResStr(res), Resp, Receipt); } ResStr = GetResStr(ress); }