本文整理汇总了C#中Listener.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# Listener.Dispose方法的具体用法?C# Listener.Dispose怎么用?C# Listener.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Listener
的用法示例。
在下文中一共展示了Listener.Dispose方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DisposedListenersShouldNotBeCalled
public void DisposedListenersShouldNotBeCalled()
{
int calls = 0;
var sideEffectsListener = new Listener<SomeTopic>((x) => calls++);
MessageCenter.Publish(new SomeTopic());
sideEffectsListener.Dispose();
MessageCenter.Publish(new SomeTopic());
Assert.AreEqual(1, calls);
}
示例2: FortsTrade
public FortsTrade()
{
try
{
Plaza = new MPlaza();
Plaza.Init();
if (connection != null)
connection.Dispose();
if (listener != null)
listener.Dispose();
if (pub != null)
pub.Dispose();
connection = new Connection("p2tcp://127.0.0.1:4001;app_name=FT");
pub = new Publisher(connection, "p2mq://FORTS_SRV;category=FORTS_MSG;name=Pub;timeout=5000");
listener = new Listener(connection, "p2mqreply://;ref=Pub;scheme=|FILE|Ini\\FutMsg.ini|FutMsg");
listener.Handler += new Listener.MessageHandler(MessageHandlerAggr);
lisPubReplState = "";
ConnState = State.Closed;
ListState = State.Closed;
PubState = State.Closed;
errMessage = "";
}
catch (Exception err)
{
ConnState = State.Closed;
ListState = State.Closed;
if (pub != null)
pub.Dispose();
if (connection != null)
connection.Dispose();
if (listener != null)
listener.Dispose();
Plaza.Deinit();
errMessage = err.Message;
throw err;
}
}
示例3: CurrDrinks
public CurrDrinks()
{
try
{
Plaza = new MPlaza();
Plaza.Init();
if (connection != null)
connection.Dispose();
if (listener != null)
listener.Dispose();
connection = new Connection("p2tcp://127.0.0.1:4001;app_name=CDR123");
listener = new Listener(connection, "p2repl://MCXCC_AGGR_REPL;scheme=|FILE|Ini\\CurrDrink.ini|CurrDrink");
listener.Handler += new Listener.MessageHandler(MessageHandlerInfo);
listenerReplState = "";
ConnState = State.Closed;
ListState = State.Closed;
errMessage = "";
}
catch (Exception err)
{
ConnState = State.Closed;
ListState = State.Closed;
if (connection != null)
connection.Dispose();
if (listener != null)
listener.Dispose();
Plaza.Deinit();
errMessage = err.Message;
throw err;
}
}
示例4: SpotCommon
public SpotCommon()
{
try
{
Plaza = new MPlaza();
Plaza.Init();
if (connection != null)
connection.Dispose();
if (listener != null)
listener.Dispose();
connection = new Connection("p2tcp://127.0.0.1:4001;app_name=SC321");
listener = new Listener(connection, "p2repl://MCXSPOT_MDCOMMON_REPL");//;scheme=|FILE|Ini\\SpotCommon.ini|SpotCommon");
listener.Handler += new Listener.MessageHandler(MessageHandlerInfo);
listenerReplState = "";
ConnState = State.Closed;
ListState = State.Closed;
errMessage = "";
}
catch (Exception err)
{
ConnState = State.Closed;
ListState = State.Closed;
if (connection != null)
connection.Dispose();
if (listener != null)
listener.Dispose();
Plaza.Deinit();
errMessage = err.Message;
throw err;
}
}
示例5: FortsCommon
public FortsCommon()
{
try
{
Plaza = new MPlaza();
Plaza.Init();
if (connection != null)
connection.Dispose();
if (listener != null)
listener.Dispose();
connection = new Connection("p2tcp://127.0.0.1:4001;app_name=FC");
listener = new Listener(connection, "p2repl://FORTS_FUTCOMMON_REPL;scheme=|FILE|Ini\\FutComm.ini|FutComm");
listener.Handler += new Listener.MessageHandler(MessageHandlerComm);
lisFutCommReplState = "";
ConnState = State.Closed;
ListState = State.Closed;
errMessage = "";
}
catch (Exception err)
{
ConnState = State.Closed;
ListState = State.Closed;
if (connection != null)
connection.Dispose();
if (listener != null)
listener.Dispose();
Plaza.Deinit();
errMessage = err.Message;
throw err;
}
}
示例6: FortsDrinks
public FortsDrinks(int Depth)
{
try
{
Plaza = new MPlaza();
Plaza.Init();
if (connection != null)
connection.Dispose();
if (listener != null)
listener.Dispose();
connection = new Connection("p2tcp://127.0.0.1:4001;app_name=FDR");
listener = new Listener(connection, "p2repl://FORTS_FUTAGGR" + Depth + "_REPL;scheme=|FILE|Ini\\FutAggr.ini|FutAggr");
listener.Handler += new Listener.MessageHandler(MessageHandlerAggr);
lisFutAggrReplState = "";
ConnState = State.Closed;
ListState = State.Closed;
errMessage = "";
}
catch (Exception err)
{
ConnState = State.Closed;
ListState = State.Closed;
if (connection != null)
connection.Dispose();
if (listener != null)
listener.Dispose();
Plaza.Deinit();
errMessage = err.Message;
throw err;
}
}
示例7: FortsInfo
public FortsInfo()
{
try
{
Plaza = new MPlaza();
Plaza.Init();
if (connection != null)
connection.Dispose();
if (lisFutInfo != null)
lisFutInfo.Dispose();
if (lisFutPos != null)
lisFutPos.Dispose();
if (lisFutPart != null)
lisFutPart.Dispose();
if (lisFutVM != null)
lisFutVM.Dispose();
connection = new Connection("p2tcp://127.0.0.1:4001;app_name=FI");
lisFutInfo = new Listener(connection, "p2repl://FORTS_FUTINFO_REPL;scheme=|FILE|Ini\\FutInfo.ini|FutInfo");
lisFutInfo.Handler += new Listener.MessageHandler(MessageHandlerInfo);
lisFutInfoReplState = "";
lisFutPos = new Listener(connection, "p2repl://FORTS_POS_REPL;scheme=|FILE|Ini\\FutPos.ini|FutPos");
lisFutPos.Handler += new Listener.MessageHandler(MessageHandlerPos);
lisFutPosReplState = "";
lisFutPart = new Listener(connection, "p2repl://FORTS_PART_REPL;scheme=|FILE|Ini\\FutPart.ini|FutPart");
lisFutPart.Handler += new Listener.MessageHandler(MessageHandlerPart);
lisFutPartReplState = "";
lisFutVM = new Listener(connection, "p2repl://FORTS_VM_REPL;scheme=|FILE|Ini\\FutVM.ini|FutVM");
lisFutVM.Handler += new Listener.MessageHandler(MessageHandlerVM);
lisFutVMReplState = "";
ConnState = State.Closed;
ListInfoState = State.Closed;
ListPosState = State.Closed;
ListPartState = State.Closed;
ListVMState = State.Closed;
errMessage = "";
}
catch (Exception err)
{
ConnState = State.Closed;
ListInfoState = State.Closed;
ListPosState = State.Closed;
ListPartState = State.Closed;
ListVMState = State.Closed;
if (connection != null)
connection.Dispose();
if (lisFutInfo != null)
lisFutInfo.Dispose();
if (lisFutPos != null)
lisFutPos.Dispose();
if (lisFutPart != null)
lisFutPart.Dispose();
if (lisFutVM != null)
lisFutVM.Dispose();
Plaza.Deinit();
errMessage = err.Message;
throw err;
}
}
示例8: MInfo
public MInfo(string Name = "")
{
try
{
PlazaInit = new MPlazaInit();
PlazaInit.Init();
mtx = new Mutex();
Instruments = new List<Instrument>();
Session = new SessionInfo();
Account = new AccountInfo();
Status = MPlazaStatus.Stoped;
connFutInfo = new Connection("p2tcp://127.0.0.1:4001;app_name=FI" + Name);
lisCurrInfo = new Listener(connFutInfo, "p2repl://MCXCC_INFO_REPL;scheme=|FILE|Ini\\CurrInfo.ini|CurrInfo");
lisCurrInfo.Handler += new Listener.MessageHandler(MessageHandlerInfoCurr);
lisCurrInfoReplState = "";
lisSpotInfo = new Listener(connFutInfo, "p2repl://MCXSPOT_INFO_REPL;scheme=|FILE|Ini\\SpotInfo.ini|SpotInfo");
lisSpotInfo.Handler += new Listener.MessageHandler(MessageHandlerInfoSpot);
lisSpotInfoReplState = "";
lisFutInfo = new Listener(connFutInfo, "p2repl://FORTS_FUTINFO_REPL;scheme=|FILE|Ini\\FutInfo.ini|FutInfo");
lisFutInfo.Handler += new Listener.MessageHandler(MessageHandlerInfo);
lisFutInfoReplState = "";
lisFutPos = new Listener(connFutInfo, "p2repl://FORTS_POS_REPL;scheme=|FILE|Ini\\FutPos.ini|FutPos");
lisFutPos.Handler += new Listener.MessageHandler(MessageHandlerPos);
lisFutPosReplState = "";
lisFutPart = new Listener(connFutInfo, "p2repl://FORTS_PART_REPL;scheme=|FILE|Ini\\FutPart.ini|FutPart");
lisFutPart.Handler += new Listener.MessageHandler(MessageHandlerPart);
lisFutPartReplState = "";
lisFutVM = new Listener(connFutInfo, "p2repl://FORTS_VM_REPL;scheme=|FILE|Ini\\FutVM.ini|FutVM");
lisFutVM.Handler += new Listener.MessageHandler(MessageHandlerVM);
lisFutVMReplState = "";
errMessage = "";
}
catch (Exception err)
{
mtx.Close();
if (lisSpotInfo != null)
lisSpotInfo.Dispose();
if (lisCurrInfo != null)
lisCurrInfo.Dispose();
if (lisFutInfo != null)
lisFutInfo.Dispose();
if (lisFutPos != null)
lisFutPos.Dispose();
if (lisFutPart != null)
lisFutPart.Dispose();
if (lisFutVM != null)
lisFutVM.Dispose();
if (connFutInfo != null)
connFutInfo.Dispose();
PlazaInit.Deinit();
errMessage = err.Message;
throw err;
}
}
示例9: MPlaza
public MPlaza(bool Common, bool Deals, bool Drinks, bool Trade, int Depth = 5)
{
try
{
#region Init
//CGate.Open("ini=Ini/MPlaza.ini;key=IskCq8sT1t1IlrEZjivBT5ZNlOGXoIV");
CGate.Open("ini=Ini/MPlaza.ini;key=11111111");
connFutInfo = new Connection("p2tcp://127.0.0.1:4001;app_name=FI");
lisFutInfo = new Listener(connFutInfo, "p2repl://FORTS_FUTINFO_REPL;scheme=|FILE|Ini\\FutInfo.ini|FutInfo");
lisFutInfo.Handler += new Listener.MessageHandler(MessageHandlerInfo);
lisFutInfoReplState = "";
lisFutPos = new Listener(connFutInfo, "p2repl://FORTS_POS_REPL;scheme=|FILE|Ini\\FutPos.ini|FutPos");
lisFutPos.Handler += new Listener.MessageHandler(MessageHandlerPos);
lisFutPosReplState = "";
lisFutPart = new Listener(connFutInfo, "p2repl://FORTS_PART_REPL;scheme=|FILE|Ini\\FutPart.ini|FutPart");
lisFutPart.Handler += new Listener.MessageHandler(MessageHandlerPart);
lisFutPartReplState = "";
lisFutVM = new Listener(connFutInfo, "p2repl://FORTS_VM_REPL;scheme=|FILE|Ini\\FutVM.ini|FutVM");
lisFutVM.Handler += new Listener.MessageHandler(MessageHandlerVM);
lisFutVMReplState = "";
if (Common)
{
connFutCommon = new Connection("p2tcp://127.0.0.1:4001;app_name=FC");
lisFutCommon = new Listener(connFutCommon, "p2repl://FORTS_FUTCOMMON_REPL;scheme=|FILE|Ini\\FutComm.ini|FutComm");
lisFutCommon.Handler += new Listener.MessageHandler(MessageHandlerComm);
lisFutCommReplState = "";
}
if (Deals)
{
connFutDeals = new Connection("p2tcp://127.0.0.1:4001;app_name=FDE");
lisFutDeals = new Listener(connFutDeals, "p2repl://FORTS_FUTTRADE_REPL;scheme=|FILE|Ini\\FutTrade.ini|FutTrade");
lisFutDeals.Handler += new Listener.MessageHandler(MessageHandlerDeals);
lisFutDealsReplState = "";
}
if (Drinks)
{
connFutDrinks = new Connection("p2tcp://127.0.0.1:4001;app_name=FDR");
lisFutDrinks = new Listener(connFutDrinks, "p2repl://FORTS_FUTAGGR" + Depth + "_REPL;scheme=|FILE|Ini\\FutAggr.ini|FutAggr");
lisFutDrinks.Handler += new Listener.MessageHandler(MessageHandlerDrinks);
lisFutDrinksReplState = "";
}
if (Trade)
{
connFutTrade = new Connection("p2tcp://127.0.0.1:4001;app_name=FT");
pub = new Publisher(connFutTrade, "p2mq://FORTS_SRV;category=FORTS_MSG;name=Pub;timeout=5000");
lisFutTrade = new Listener(connFutTrade, "p2mqreply://;ref=Pub;scheme=|FILE|Ini\\FutMsg.ini|FutMsg");
lisFutTrade.Handler += new Listener.MessageHandler(MessageHandlerTrade);
lisPubReplState = "";
}
#endregion
errMessage = "";
}
catch (Exception err)
{
#region Deinit
if (connFutInfo != null)
connFutInfo.Dispose();
if (connFutCommon != null)
connFutCommon.Dispose();
if (connFutDeals != null)
connFutDeals.Dispose();
if (connFutDrinks != null)
connFutDrinks.Dispose();
if (connFutTrade != null)
connFutTrade.Dispose();
if (pub != null)
pub.Dispose();
if (lisFutInfo != null)
lisFutInfo.Dispose();
if (lisFutPos != null)
lisFutPos.Dispose();
if (lisFutPart != null)
lisFutPart.Dispose();
if (lisFutVM != null)
lisFutVM.Dispose();
if (lisFutCommon != null)
lisFutCommon.Dispose();
if (lisFutDeals != null)
lisFutDeals.Dispose();
if (lisFutDrinks != null)
lisFutDrinks.Dispose();
if (lisFutTrade != null)
lisFutTrade.Dispose();
CGate.Close();
#endregion
errMessage = err.Message;
throw err;
//.........这里部分代码省略.........