コード例 #1
0
ファイル: DataStream.cs プロジェクト: jettblu/brainStorm
        private void SubscribeDataOK(object sender, MultipleResultEventArgs e)
        {
            foreach (JObject ele in e.FailList)
            {
                string streamName   = (string)ele["streamName"];
                int    code         = (int)ele["code"];
                string errorMessage = (string)ele["message"];
                Console.WriteLine("Subscribe stream " + streamName + " unsuccessfully." + " code: " + code + " message: " + errorMessage);
                if (_streams.Contains(streamName))
                {
                    _streams.Remove(streamName);
                }
            }
            Dictionary <string, JArray> header = new Dictionary <string, JArray>();

            foreach (JObject ele in e.SuccessList)
            {
                string streamName = (string)ele["streamName"];
                JArray cols       = (JArray)ele["cols"];
                header.Add(streamName, cols);
            }
            if (header.Count > 0)
            {
                OnSubscribed(this, header);
            }
            else
            {
                Console.WriteLine("No Subscribe Stream Available");
            }
        }
コード例 #2
0
ファイル: DataStream.cs プロジェクト: jettblu/brainStorm
 private void UnSubscribeDataOK(object sender, MultipleResultEventArgs e)
 {
     foreach (JObject ele in e.SuccessList)
     {
         string streamName = (string)ele["streamName"];
         if (_streams.Contains(streamName))
         {
             _streams.Remove(streamName);
         }
     }
     foreach (JObject ele in e.FailList)
     {
         string streamName   = (string)ele["streamName"];
         int    code         = (int)ele["code"];
         string errorMessage = (string)ele["message"];
         Console.WriteLine("UnSubscribe stream " + streamName + " unsuccessfully." + " code: " + code + " message: " + errorMessage);
     }
 }
コード例 #3
0
        private void SubscribeDataOK(object sender, MultipleResultEventArgs e)
        {
            bool found = false;
            Dictionary <string, JArray> header = new Dictionary <string, JArray>();

            foreach (JObject ele in e.SuccessList)
            {
                string streamName = (string)ele["streamName"];
                if (streamName == "sys")
                {
                    found = true;
                    Console.WriteLine(ele);
                }
            }
            if (found)
            {
                // Ready for training
                OnReadyForTraning(this, true);
            }
            else
            {
                Console.WriteLine("Can not subscribe training event");
            }
        }