Results 1 to 3 of 3
  1. #1
    Senior Member
    Join Date
    Oct 2007
    Location
    HoChiMinh
    Posts
    69

    The type or namespace name 'IExternalFeedListener' could not be found

    Hi everybody,
    I'm trying to build an example dataAdapter. I start out creating a new Project (windows application c#) in Visual Studio 2003,and copy DotNetAdapter.dll from "DOCS-SDKs\sdk_adapter_dotnet\lib\dotnet_1.1" into my directory project, add reference "DotNetAdapter.dll", and then I have created 2 class "ExternalFeed.cs", "StockList.cs" (just only copy & paste from source code demo in folder "DOCS-SDKs\sdk_adapter_dotnet\examples\DotNetStockListDe mo\src_data_adapter").

    There are my code :
    ----------------------
    ExternalFeed.cs
    ----------------------
    using System;
    using System.Threading;
    using System.Collections;
    namespace Lightstreamer.Adapters.Data
    {
    ///<summary>
    /// Summary description for ExternalFeed.
    ///</summary>
    publicclass ExternalFeed
    {
    ///<summary>
    /// Used by the Stock List Adapter to receive data from the simulated broadcast feed in an
    /// asynchronous way, through the OnEvent method.
    ///</summary>
    publicinterface IExternalFeedListener
    {

    ///<summary>
    /// Called by the feed for each update event occurrence on some stock.
    /// If isSnapshot is true, then the event contains a full snapshot,
    /// with the current values of all fields for the stock.
    ///</summary>
    void OnEvent(string itemName, IDictionary currentValues, bool isSnapshot);
    }
    ///<summary>
    /// Used to automatically generate the updates for the 30 stocks:
    /// mean and standard deviation of the times between consecutive
    /// updates for the same stock.
    ///</summary>
    privatedouble [] _updateTimeMeans;
    privatedouble [] _updateTimeStdDevs;
    ///<summary>
    /// Used to generate the initial field values for the 30 stocks
    ///</summary>
    privatedouble [] _refprices;
    privatedouble [] _openprices;
    privatedouble [] _minprices;
    privatedouble [] _maxprices;
    privatestring [] _stockNames;

    ///<summary>
    /// Used to keep the contexts of the 30 stocks.
    ///</summary>
    private IDictionary _stockGenerators;
    private IExternalFeedListener _listener;
    private IList _snapshotQueue;
    private Thread _snapshotSender;

    public ExternalFeed()
    {
    _stockGenerators=
    new Hashtable();
    _snapshotQueue=
    new ArrayList();
    _updateTimeMeans =
    newdouble [] {30000, 500, 3000, 90000,
    7000, 10000, 3000, 7000,
    7000, 7000, 500, 3000,
    20000, 20000, 20000, 30000,
    500, 3000, 90000, 7000,
    10000, 3000, 7000, 7000,
    7000, 500, 3000, 20000,
    20000, 20000 };
    ...
    publicclass ExternalFeedProducer
    {
    publicstring _itemName;
    privateint _open, _refer, _last, _min, _max, _other;
    privatedouble _mean, _stddev;
    privatestring _stockName;

    private Random _random;
    privatebool _haveNextNextGaussian;
    privatedouble _nextNextGaussian;
    private IExternalFeedListener _listener;
    private Thread _thread;
    ///<summary>
    /// Initializes stock data based on the already prepared values.
    ///</summary>
    public ExternalFeedProducer(string name,
    double openPrice, double referPrice, double minPrice, double maxPrice,
    double updateTimeMean, double updateTimeStdDev, string stockName)
    {
    _itemName = name;
    _open = (
    int) Math.Round(openPrice * 100);
    _refer = (
    int) Math.Round(referPrice * 100);
    _min = (
    int) Math.Ceiling(minPrice * 100);
    _max = (
    int) Math.Floor(maxPrice * 100);
    _last = _open;
    _mean = updateTimeMean;
    _stddev = updateTimeStdDev;
    _stockName = stockName;

    _random =
    new Random();
    _haveNextNextGaussian=
    false;
    _nextNextGaussian= 0.0;
    ComputeNewValues();
    }
    ...
    publicvoid SetFeedListener(IExternalFeedListener listener)
    {
    lock (this)
    {
    _listener = listener;
    }
    }

    -------------------------
    StockList.cs
    -------------------------
    using System;
    using System.Collections;
    using System.Threading;
    using Lightstreamer.Interfaces.Data;
    namespace Lightstreamer.Adapters.Data
    {
    ///<summary>
    /// Summary description for StockList.
    ///</summary>
    publicclass StockListAdapter : IDataProvider, IExternalFeedListener
    {
    private IDictionary _subscribedItems;
    private ExternalFeed _myFeed;
    private IItemEventListener _listener;
    public StockListAdapter()
    {
    _subscribedItems=
    new Hashtable();

    _myFeed=
    new ExternalFeedSimulator();
    }

    // ////////////////////////////////////////////////////////////////////////
    // IDataProvider methos
    publicvoid Init(IDictionary parameters, string configFile)
    {
    _myFeed.SetFeedListener(
    this);
    _myFeed.Start();
    }
    ...

    Now I build this application, it has error :

    D:\My projects\AnalyzeStockApp\Lightstreamer.Adapters.Da ta\ExternalFeed.cs(218): The type or namespace name 'IExternalFeedListener' could not be found (are you missing a using directive or an assembly reference?) --> (red color line is mark)

    Could anybody help me?

  2. #2
    Administrator
    Join Date
    Jul 2006
    Location
    Milan
    Posts
    1,089
    Hi

    I notice that, in the reported source code, the IExternalFeedListener interface is defined as an inner class of ExternalFeed. This differs from the original source code, where it is defined at top level, before the ExternalFeed(Simulator) class.

    Dario

  3. #3
    Senior Member
    Join Date
    Oct 2007
    Location
    HoChiMinh
    Posts
    69
    Thanks! You right, I fixed it.

 

 

Similar Threads

  1. Replies: 1
    Last Post: January 31st, 2011, 08:47 AM
  2. Replies: 4
    Last Post: February 5th, 2010, 04:12 PM
  3. Replies: 2
    Last Post: March 19th, 2008, 11:19 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT +1. The time now is 06:14 AM.