本文整理汇总了C#中RequestMessage类的典型用法代码示例。如果您正苦于以下问题:C# RequestMessage类的具体用法?C# RequestMessage怎么用?C# RequestMessage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RequestMessage类属于命名空间,在下文中一共展示了RequestMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleRequest
protected override void HandleRequest(RequestMessage request, PeerState peer)
{
if (!peer.IsChoked && request.Length <= Global.Instance.BlockSize)
{
BlockManager.GetBlock(new byte[request.Length], request.Index, request.Offset, request.Length, BlockRead, peer);
}
}
示例2: call_NSPRFSH01
public void call_NSPRFSH01()
{
string errortxt = this.Vaildate();
if (errortxt != string.Empty)
{
MessageBox.Show(errortxt);
this.focusControl.Focus();
return;
}
string[] tmp = this.toid.Text.Split(new char[] { ' ' });
string toidstr = tmp[0];
sh01_req.Utility sh01req = sh01_req.Utility.CreateSH(toidstr);
sh01req.UtilityHeader.userid = this.LoginUser.UserName;
RequestMessage requestmessage = new RequestMessage(enumRequestType.MessageProcessor,
enumMessageType.Utility,
enumRequestMethod.functionOperation, this.LoginUser,
enumSendSysId.EXceed,
sh01req);
ResponseMessage response = ThreadHelper.Execute(requestmessage);
string errormsg = response.GetErrorMessage();
if (errormsg != string.Empty)
{
MessageBox.Show(response.GetErrorMessage());
}
else
{
MessageBox.Show("发运完成");
}
}
示例3: loadReason
private void loadReason()
{
RFDeviceAPP.Common.TaskReason.Request.TaskReason request = RFDeviceAPP.Common.TaskReason.Request.TaskReason.Craete(this.LoginUser.UserName);
RequestMessage requestmessage = new RequestMessage(enumRequestType.MessageProcessor,
enumMessageType.TaskReason,
enumRequestMethod.list, this.LoginUser,
enumSendSysId.EXceed,
request);
RequestWorkItem workitem = new RequestWorkItem(requestmessage, 1);
//threadhelper.AddWorkItem(workitem);
ResponseMessage Response = ThreadHelper.Execute(requestmessage);
string errormsg = Response.GetErrorMessage();
if (errormsg != string.Empty)
{
MessageBox.Show(errormsg);
}
else
{
RFDeviceAPP.Common.TaskReason.Response.TaskReason tasklist = Response.Deserialize<RFDeviceAPP.Common.TaskReason.Response.TaskReason>();
foreach (RFDeviceAPP.Common.TaskReason.Response.TaskReasonHeader header in tasklist.TaskReasonHeaders)
{
string line = header.TASKMANAGERREASONKEY;
this.listBox1.Items.Add(line);
}
this.listBox1.SelectedIndex = 0;
}
}
示例4: submitMove
public void submitMove(string sku, string fromloc, string fromid, string toid, string qty, string actloc)
{
string errortxt = this.Vaildate();
if (errortxt != string.Empty)
{
MessageBox.Show(errortxt);
this.focusControl.Focus();
return;
}
reqitem = req.Utility.Create( sku, fromloc, fromid, toid, qty, actloc);
reqitem.UtilityHeader.userid = this.loginuser.UserName;
RequestMessage request = new RequestMessage(enumRequestType.MessageProcessor,
enumMessageType.Utility,
enumRequestMethod.functionOperation, this.loginuser,
enumSendSysId.EXceed,
reqitem);
//RequestWorkItem workitem = new RequestWorkItem(request, 1);
ResponseMessage response = ThreadHelper.Execute(request);
string errormsg = response.GetErrorMessage();
if (errormsg != string.Empty)
{
MessageBox.Show(response.GetErrorMessage());
}
else
{
MessageBox.Show("移动完成");
Clean();
}
}
示例5: ExchangeAsClient
public ResponseMessage ExchangeAsClient(RequestMessage request)
{
PrepareExchangeAsClient();
stream.Send(request);
return stream.Receive<ResponseMessage>();
}
示例6: call_NSPRFIQ01
private void call_NSPRFIQ01()
{
this.request.UtilityHeader.userid = this.LoginUser.UserName;
RequestMessage query = new RequestMessage(enumRequestType.MessageProcessor,
enumMessageType.Utility,
enumRequestMethod.functionOperation, this.LoginUser,
enumSendSysId.EXceed,
this.request);
ResponseMessage response = ThreadHelper.Execute(query);
string errormsg = response.GetErrorMessage();
if (errormsg != string.Empty)
{
MessageBox.Show(response.GetErrorMessage());
}
else
{
RFDeviceAPP.Common.NSPRFIQ01.Response.Utility result = response.Deserialize<RFDeviceAPP.Common.NSPRFIQ01.Response.Utility>();
//Console.Write(result);
//FrmStockResult resultfrm = new FrmStockResult(result);
FrmStockResultDetail resultfrm = new FrmStockResultDetail(result);
resultfrm.ShowDialog();
this.Activate();
this.storerkey.SetFocus();
}
}
示例7: SecureClientClearsPoolWhenAllConnectionsCorrupt
public void SecureClientClearsPoolWhenAllConnectionsCorrupt()
{
var pool = new ConnectionPool<ServiceEndPoint, IConnection>();
var stream = Substitute.For<IMessageExchangeStream>();
stream.When(x => x.IdentifyAsClient()).Do(x => { throw new ConnectionInitializationFailedException(""); });
for (int i = 0; i < SecureClient.RetryCountLimit; i++)
{
var connection = Substitute.For<IConnection>();
connection.Protocol.Returns(new MessageExchangeProtocol(stream));
pool.Return(endpoint, connection);
}
var request = new RequestMessage
{
Destination = endpoint,
ServiceName = "IEchoService",
MethodName = "SayHello",
Params = new object[] { "Fred" }
};
var secureClient = new SecureClient(endpoint, Certificates.Octopus, log, pool);
ResponseMessage response = null;
secureClient.ExecuteTransaction((mep) => response = mep.ExchangeAsClient(request));
// The pool should be cleared after the second failure
stream.Received(2).IdentifyAsClient();
// And a new valid connection should then be made
Assert.AreEqual("Fred...", response.Result);
}
示例8: call_UserData
private void call_UserData(string username, string password)
{
userinforeq = fllg_req.Utility.Create(username, password);
RequestMessage searchrequest = new RequestMessage(enumRequestType.MessageProcessor,
enumMessageType.Utility,
enumRequestMethod.functionOperation, this._user,
enumSendSysId.EXceed,
userinforeq);
RequestWorkItem workitem = new RequestWorkItem(searchrequest, 1);
//threadhelper.AddWorkItem(workitem);
ResponseMessage Response = ThreadHelper.Execute(searchrequest);
if (Response.GetErrorMessage() != string.Empty)
{
MessageBox.Show(Response.GetErrorMessage());
this.usernametxt.Focus();
}
else
{
this.userinfores = Response.Deserialize<fllg_res.Utility>();
if (this._user.UserName == string.Empty)
{
MessageBox.Show("用户名不存在");
this.usernametxt.Focus();
}
else
{
this.screen = this.userinfores.UtilityHeader[0].Screen.Split(new char[] { ';' });
//InvokeHelper.Set(this, "DialogResult", DialogResult.OK);
DialogResult = DialogResult.OK;
}
}
}
示例9: OnNewUpdate
private void OnNewUpdate(
IRequestManager<ConfigurationUpdate, ConfigurationUpdateAnswer> sender,
RequestMessage<ConfigurationUpdate> request)
{
var newConfiguration = request.request.update;
//Not the most efficient code, but premature optimisation is root of evil.
lock (internalLock)
{
var existing = allConfigurations.FirstOrDefault(o =>
o.Instance == newConfiguration.Instance &&
o.Key == newConfiguration.Key
);
if (existing != null)
{
existing.Value = newConfiguration.Value;
}
else
{
allConfigurations.Add(newConfiguration);
}
}
this.persister.Persist(allConfigurations);
//Todo here broadcast the update?
sender.Send(new AnwserMessage<ConfigurationUpdateAnswer>()
{
id = request.id,
answer = new ConfigurationUpdateAnswer()
{
result = true
}
});
}
示例10: call_asnlist01
public void call_asnlist01(string pier)
{
//this.Start();
//this.portlist.Items.Clear();
//this.portlist.Enabled = false;
asnlist01req = asnlist01_req.AdvancedShipNotice.Create(pier);
RequestMessage request = new RequestMessage(enumRequestType.MessageProcessor,
enumMessageType.AdvancedShipNotice,
enumRequestMethod.listHead, this.loginuser,
enumSendSysId.EXceed,
asnlist01req);
//RequestWorkItem workitem = new RequestWorkItem(request, 2);
//threadhelper.AddWorkItem(workitem);
ResponseMessage Response = ThreadHelper.Execute(request);
string errormsg = Response.GetErrorMessage();
if (errormsg != string.Empty)
{
MessageBox.Show(Response.GetErrorMessage());
}
else
{
asnlist01res = Response.Deserialize<asnlist01_res.AdvancedShipNotice>();
foreach (asnlist01_res.AdvancedShipNoticeHeader body in asnlist01res.AdvancedShipNoticeHeaders)
{
if (!string.IsNullOrEmpty(body.ReceiptKey))
{
this.addasnlist(body.ReceiptKey + " " + body.StorerKey + " " + body.Status);
}
//InvokeHelper.Invoke(this, "addasnlist", body.ReceiptKey + " " + body.StorerKey + " " + body.Status);
}
}
}
示例11: RawRequestMessage
public RawRequestMessage(RequestMessage rm, int commandCount)
{
var prefix = (rm.Prefix ?? "");
Id = prefix + (prefix.Length>0?"_":"") + commandCount;
Type = rm.Type??"request";
Uri = rm.Uri;
Payload = rm.Payload;
}
示例12: GetRequestMessage
private static RequestMessage<ConfigurationSubscription> GetRequestMessage(int requestId, string goodInstance)
{
var request = new RequestMessage<ConfigurationSubscription>()
{
id = requestId,
request = new ConfigurationSubscription() {instance = goodInstance}
};
return request;
}
示例13: Execute
public override ResponseMessage Execute (RequestMessage req)
{
// Start the shutdown process in a separate thread
// to avoid a deadlock: BeginShutdown() waits until
// all worker process are finished, but this method
// itself is part of a worker.
ExceptionHandlingThread.Start (new ThreadStart (DoShutdown));
return new EmptyResponse ();
}
示例14: InvokeAndWrapAnyExceptions
static ResponseMessage InvokeAndWrapAnyExceptions(RequestMessage request, Func<RequestMessage, ResponseMessage> incomingRequestProcessor)
{
try
{
return incomingRequestProcessor(request);
}
catch (Exception ex)
{
return ResponseMessage.FromException(request, ex);
}
}
示例15: Publish
public override void Publish(RequestMessage request)
{
try
{
Write(request);
}
catch (Exception e)
{
OnChannelError(e);
}
}