示例#1
0
 public static Dispatcher Instance(RtCore rtdCore, ConcurrentDictionary <string, YwCommodity> commodities)
 {
     if (_instance == null)
     {
         _instance = new Dispatcher(rtdCore, commodities);
     }
     return(_instance);
 }
示例#2
0
        private Dispatcher(RtCore rtdCore, ConcurrentDictionary <string, YwCommodity> commodities)
        {
            this._rtdCore          = rtdCore;
            this._commodities      = commodities;
            this._symbolToGrids    = new Dictionary <string, ConcurrentDictionary <string, DataGridView> >();
            this._gridNameToType   = new Dictionary <string, Type>();
            this._symbolOnceFields = new Dictionary <string, List <string> >();

            this._updateEventQueue      = new ConcurrentQueue <ChangeData>();
            this._bufferEventQueue      = new ConcurrentQueue <ChangeData>();
            this._bufferRearResetEvent  = new AutoResetEvent(false);
            this._bufferFrontResetEvent = new AutoResetEvent(false);
            this._updateEventThread     = new Thread(DoUpdateWork);
            this._bufferFrontThread     = new Thread(DoFrontWork);
            this._bufferRearThread      = new Thread(DoRearWork);
            this._updateEventThread.Start();
            this._bufferRearThread.Start();
            this._bufferFrontThread.Start();
        }
示例#3
0
        static void Main(string[] args)
        {
            //Type t = typeof(YwField);
            //Type ut = t.UnderlyingSystemType;
            //string[] enumValues = System.Enum.GetNames(t);
            //foreach (var p in enumValues)
            //{
            //    Console.WriteLine("{0}", p);
            //}
            //Console.Read();

            RtCore rtd = YwRtdLib.RtCore.Instance();

            rtd.CommodityChangeHandler += DataChangeHandler;
            rtd.AddSymbol("2317");
            rtd.AddSymbol("2498");
            rtd.AddSymbol("2330");
            Console.Read();
            rtd.Terminate();
        }