public ConnectivityModel(string umdurl, ushort umdport, string name, string winurl, ushort winport, ReceiveMsgDelegate rmCB, SendMsgDelegate smCB) { this.umdurl = umdurl; this.umdport = umdport; this.name = name; this.winurl = winurl; this.winport = winport; if (rmCB != null) { rm = rmCB; } else { rm = new ReceiveMsgDelegate(MsgProcessor.ReceiveMessage); } if (smCB != null) { sm = smCB; } else { sm = new SendMsgDelegate(MsgProcessor.SendMessage); } InitConnections(); }
public UMBackgroundWorker(ProgressChanged <O> pc, ReceiveMsgDelegate rcvMsg, SendMsgDelegate sm = null, ProcessMsgDelegateRXRaw pm = null) { this.pc = pc; this.rcvMsg = rcvMsg; this.sm = sm; this.pm = pm; }
public void ReInit(ref SendMsgDelegate sm) { if (sm == null) { SendMsgDelegate msgSend = new SendMsgDelegate(SendMessage); sm = msgSend; } smsg = new SendMessages(sm); }
public ViewModelBase(SocketSettings srvSet, string name) { if (srvSet != null) { this.name = name; InitConnections(srvSet); sm = new SendMsgDelegate(SendMessage); socSet = srvSet; } }
public ClientToServerConnection(SocketSettings socSet, ref SendMsgDelegate sm, ReceiveMsgDelegate rm) { Logger.Info($"{name} Client Connectng to server Connection: ws://{url}:{port}"); this.url = socSet.url; this.port = socSet.port; this.name = socSet.name; this.socSet = socSet; this.rm = rm; sm = new SendMsgDelegate(SendCommandToServer); Logger.AppName = socSet.name; }
public FrmMain() { InitializeComponent(); FrmClient1 objFrmClient1 = new FrmClient1(); FrmClient2 objFrmClient2 = new FrmClient2(); //5关联事件关联的处理方法 //SendMsgEvent += objFrmClient1.ReceiveMsg; //SendMsgEvent += objFrmClient2.ReceiveMsg; SendMsgEvent += new SendMsgDelegate(objFrmClient1.ReceiveMsg); SendMsgEvent += new SendMsgDelegate(objFrmClient2.ReceiveMsg); objFrmClient1.Show(); objFrmClient2.Show(); }
public void Init(SocketSettings sockSet, ref SendMsgDelegate sm, ReceiveMsgDelegate rm = null) { Url = sockSet.url; Port = sockSet.port; name = sockSet.name; this.sockSet = sockSet; Logger.Info($"Client Socket Connection Init: {name}"); if (rm == null) { rm = new ReceiveMsgDelegate(MsgProcessor.ReceiveMessage); } srvr = new ClientToServerConnection(sockSet, ref sm, rm); smsg = new SendMessages(sm); }
// static UMBackgroundWorker<IMDMMessage>.ProgressChanged<IMDMMessage> main = null; public ConnectionVM(SocketSettings srvSet = null, ReceiveMsgDelegate rmsg = null, SendMsgDelegate smsg = null)// :base(main, "ConnectionVM") { if (srvSet != null) { srv = srvSet; } if (rmsg != null) { rm = rmsg; } if (smsg != null) { sm = smsg; } connectivityModel = new ConnectivityModel(srv.url, srv.port, srv.name, srv.clienturl, srv.clientport, rm, sm); }
public ManifestDetails(SendMsgDelegate SendMessage, ReceiveMsgDelegate ReceiveMessage, ProcessMsgDelegateRXRaw pm) { sm = SendMessage; rm = ReceiveMessage; }
private void downloadStep() { DataTable worksheet = Utils.GetDataTableFromExcel(inputFilePath, param.WSName); string searchFunc = (searchType == SearchType.EID) ? "EID" : "REFEID"; SendMsgDelegate dg = new SendMsgDelegate(sendMsg); crawler.OpenPage(); int successCount = 0; int failCount = 0; try { foreach (DataRow row in worksheet.Rows) { string EID = row[param.EIDColumnName].ToString(); string code = row[param.CodeColumnName].ToString(); string downloadFileNameSuffix = (searchType == SearchType.EID) ? "_reference" : "_citation"; string downloadFileName = $"{code}{downloadFileNameSuffix}"; MainForm.Mainform.Invoke(dg, $"開始下載檔案: EID '{EID}', 編號 '{code}'"); crawler.Query($"{searchFunc}({EID})"); crawler.Wait(); bool success = crawler.ClickAll(); if (!success) { goto Failed; } if (searchType == SearchType.EID) { crawler.CheckRef(); success = crawler.ClickAll(); if (!success) { goto Failed; } } crawler.DownloadCSV(downloadFileName); successCount += 1; MainForm.Mainform.Invoke(dg, $"下載檔案 {downloadFileName}.csv 完成"); End: crawler.ReturnSearchPage(); crawler.Wait(); continue; Failed: failCount += 1; MainForm.Mainform.Invoke(dg, $"下載檔案 {downloadFileName}.csv 失敗"); goto End; } } catch (Exception ex) { MainForm.Mainform.Invoke(dg, $"錯誤: {ex.Message}"); Close(); return; } MainForm.Mainform.Invoke(dg, $"全部下載完成: 共 {successCount} 份檔案, {failCount} 份無法下載"); Close(); }
public MsgProcessor(SendMsgDelegate sm, isaReceiveMessageCallback cb) //, isaSendMessageCallback sm) { ReceivedMsg += cb.ReceiveMessage; SendMsg += new TxMsg(sm); }
public Bot(SendMsgDelegate sendMsg) { _phrases = new List <string>(); _sendMsg = sendMsg; }
public SendMessages(SendMsgDelegate smd) { cbSendMsg = smd; }
public ClientSocketConnection(SocketSettings sockSet, ref SendMsgDelegate sm, ReceiveMsgDelegate rm = null) { Init(sockSet, ref sm, rm); }