static CheDaoInterface create(LocalChePackage p) { Trace.WriteLineIf(Program.trace_sw.TraceVerbose, String.Format("incomming package {0:d} {1:s}", p.msg_type, p.rawXML), "message"); if (p.msg_type == CheDaoInterface.data_validation) { Invoice_Request_Count++; return(CheRequest.create(p.rawXML, p.time_ticks)); } if (p.msg_type == CheDaoInterface.scan_print || p.msg_type == CheDaoInterface.manual_print) { Print_Request_Count++; return(ChePrintRequest.create(p.msg_type, p.rawXML, p.time_ticks)); } if (p.msg_type == CheDaoInterface.print_confirm) { Print_Act_Count++; return(ChePActionRequest.create(p.rawXML, p.time_ticks));//it is just a string } if (p.msg_type == CheDaoInterface.delete_cmd) { Print_Act_Count++; return(CheDeleteActionRequest.create(p.rawXML, p.time_ticks));//it is just a string } return(new SimpleRequest(p.msg_type)); }
public void AddRequest(CheDaoInterface req) { switch (req.message_type) { case CheDaoInterface.data_validation: CheRequest c_item = (CheRequest)req; this.Invoke((MethodInvoker) delegate { this._AddRequest(c_item); // run in UI thread }); break; case CheDaoInterface.print_confirm: ChePActionRequest p_item = (ChePActionRequest)req; this.Invoke((MethodInvoker) delegate { this.MoveToDoneList(p_item.Order_Number, p_item.Printed_Time, p_item.message_type); // run in UI thread }); break; case CheDaoInterface.delete_cmd: CheDeleteActionRequest d_item = (CheDeleteActionRequest)req; this.Invoke((MethodInvoker) delegate { this.MoveToDoneList(d_item.Order_Number, d_item.Printed_Time, d_item.message_type); // run in UI thread }); break; default: Trace.WriteLineIf(Program.trace_sw.TraceError, "incorrect message request received " + req.message_type.ToString()); break; } }