关于连接 providers 的一些代码 (学习QD)
using System;
using System.Collections.Generic;
using System.Text;
using SmartQuant.Providers;
using System.ComponentModel;
namespace DummyProvider
{
public class MyProvider : IProvider, IMarketDataProvider, IExecutionProvider
{
#region IProvider Members
public void Connect(int timeout)
{
this.Connect();
ProviderManager.WaitConnected(this, timeout);
}
public void Connect()
{
isConnected = true;
if (Connected != null)
Connected(this, new EventArgs());
}
public event EventHandler Connected;
public void Disconnect()
{
isConnected = false;
if (Disconnected != null)
Disconnected(this, new EventArgs());
}
public event EventHandler Disconnected;
public event ProviderErrorEventHandler Error;
public byte Id
{
get { return 80; }
}
private bool isConnected = false;
[Category("Information")]
public bool IsConnected
{
get { return isConnected; }
}
[Category("Information")]
public string Name
{
get { return "DummyProvider"; }
}
[Category("Information")]
public ProviderStatus Status
{
get
{
if (!IsConnected)
return ProviderStatus.Disconnected;
else
return ProviderStatus.Connected;
}
}
public event EventHandler StatusChanged;
public string Title
{
get { return "This is a dummy provider."; }
}
public string URL
{
get { return String.Empty; }
}
#endregion
#region IMarketDataProvider Members
#region IExecutionProvider Members
}
}