本文整理汇总了C#中IMessage.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# IMessage.Clear方法的具体用法?C# IMessage.Clear怎么用?C# IMessage.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IMessage
的用法示例。
在下文中一共展示了IMessage.Clear方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Release
/// <summary>
/// Returns an element back to the pool.
/// </summary>
/// <param name="rEdge"></param>
public static new void Release(IMessage rInstance)
{
if (rInstance == null) { return; }
// We should never release an instance unless we're
// sure we're done with it. So clearing here is fine
rInstance.Clear();
// Reset the sent flags. We do this so messages are flagged as 'completed'
// and removed by default.
rInstance.IsSent = true;
rInstance.IsHandled = true;
// Make it available to others.
if (rInstance is MyCustomMessage)
{
sPool.Release((MyCustomMessage)rInstance);
}
}
示例2: ClearMessage
private void ClearMessage(IMessage message)
{
message.Clear();
}
示例3: send_to_instrument
//send to instrument by visacom
private string send_to_instrument(string fullcmd,string address,string cmd, IMessage ioDmm,int delay = 0)
{
WriteTraceText(fullcmd);
//IVisaSession basesession = null;
//IMessage talksession = null;
string strRd = "";
string instrumentAddress = address;
//lock
//this.WriteTraceText("\n");
lock (_lock_Instrument)
{
ioDmm.Clear();
ioDmm.WriteString(cmd);
if (delay != 0 && delay > 500)
Thread.Sleep(delay);
else
Thread.Sleep(500);
if (cmd.Contains("?"))
{
for (int i = 0; i < 5; i++)
{
try
{
strRd = ioDmm.ReadString(4069);
break;
}
catch (Exception exp)
{
ioDmm.Clear();
if (i != 9)
{
Thread.Sleep(200);
continue;
}
else
{
WriteErrorText("write/read to instrumen by visacom error: " + exp.Message);
throw new Exception(exp.Message);
}
}
}
}
}
strRd = strRd.TrimEnd('\n');
return strRd;
}