本文整理汇总了C#中Session.Stop方法的典型用法代码示例。如果您正苦于以下问题:C# Session.Stop方法的具体用法?C# Session.Stop怎么用?C# Session.Stop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Session
的用法示例。
在下文中一共展示了Session.Stop方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitialiseSessionAndService
/// <summary>
/// Initialise the Session and the Service
/// </summary>
internal void InitialiseSessionAndService()
{
if (_session == null)
{
var sessionOptions = new SessionOptions
{
ServerHost = _serverHost,
ServerPort = _serverPort
};
//Console.WriteLine("Connecting to {0}:{1}", sessionOptions.ServerHost, sessionOptions.ServerPort);
_session = new Session(sessionOptions);
if (!_session.Start())
throw new Exception("Failed to connect!");
if (!_session.OpenService("//blp/refdata"))
{
_session.Stop();
_session = null;
throw new Exception("Failed to open //blp/refdata");
}
_refDataService = _session.GetService("//blp/refdata");
}
}
示例2: Run
private void Run(string[] args)
{
var commandLineOptions = new CommandLineOptions();
if (!CommandLine.Parser.Default.ParseArguments(args, commandLineOptions))
{
return;
}
Initialize(commandLineOptions);
var sessionOptions = GetSessionOptions();
Logger.InfoFormat("Connecting to [{0}]:[{1}]", _host, _port);
var session = new Session(sessionOptions);
bool sessionStarted = session.Start();
if (!sessionStarted)
{
Logger.Error("Failed to start session.");
return;
}
if (!session.OpenService("//blp/refdata"))
{
Logger.Error("Failed to open //blp/refdata");
return;
}
try
{
SendRefDataRequest(session);
}
catch (InvalidRequestException e)
{
Logger.WarnFormat("Exception occurred: [{0}]", e);
}
// wait for events from session.
EventLoop(session);
session.Stop();
}
示例3: Run
private void Run()
{
var sessionOptions = new SessionOptions {ServerHost = _dHost, ServerPort = _dPort};
Console.WriteLine(@"Connecting to " + _dHost + @":" + _dPort);
var session = new Session(sessionOptions);
bool sessionStarted = session.Start();
if (!sessionStarted)
{
Console.Error.WriteLine("Failed to start session.");
_waitEndOfCollection.Release();
return;
}
if (!session.OpenService("//blp/refdata"))
{
Console.Error.WriteLine("Failed to open //blp/refdata");
_waitEndOfCollection.Release();
return;
}
DataManager.CreateTableForContract(_dSecurity);
DataManager.DeleteTicks(_dSecurity, _startDate, _endDate);
SendIntradayTickRequest(session);
EventLoop(session);
session.Stop();
}