Beispiel #1
0
        /// <summary>
        /// 丟值到指定直欄的Cell裡
        /// </summary>
        /// <param name="Column"></param>
        /// <param name="value"></param>
        public void SetValue(ColGenre Column, object value)
        {
            switch (Column)
            {
            case ColGenre.Buy:
                m_Buy.SetValue(value);
                break;

            case ColGenre.BL:
                m_BL.SetValue(value);
                break;

            case ColGenre.Price:
                m_Price.SetValue(value);
                break;

            case ColGenre.SL:
                m_SL.SetValue(value);
                break;

            case ColGenre.Sell:
                m_Sell.SetValue(value);
                break;
            }
        }
Beispiel #2
0
        private void Subscriber_OnSubscriptionReply(Event eventObject, Session session)
        {
            Subscribe s = Subscribe.Create(eventObject);

            if (s != null)
            {
                foreach (var security in m_Securities)
                {
                    foreach (var field in m_Fields)
                    {
                        if (String.IsNullOrEmpty(security) || String.IsNullOrEmpty(field))
                        {
                            continue;
                        }
                        //Element element  = s[security, field];
                        //string v = element != null ? element.GetValue().ToString() : string.Empty;
                        object value = s[security, field];

                        //Utility.Log(this, "Update Value", field+ ":" +value);
                        string v = value != null?value.ToString() : string.Empty;

                        //Console.WriteLine("[" + security + "," + field + "] " + v);
                        if (!String.IsNullOrEmpty(v))
                        {
                            CellBase c = m_CellList.Values.FirstOrDefault(e => e.Name == security && e.Tag != null && e.Tag.ToString() == field);
                            if (c != null)
                            {
                                c.SetValue(v);
                            }
                        }
                    }
                }
            }
        }
Beispiel #3
0
        private void Subscriber_OnRequestReply(Event eventObject, Session session)
        {
            Response response = new Response(eventObject);

            //Console.WriteLine("Response");
            if (response.HasError)
            {
                //foreach (var item in response.Errors)
                //{
                //    //Response.ErrorElement(this, "", item);
                //    //Console.WriteLine(item);
                //    Utility.Log(this, "RequestError", item);
                //}
                return;
            }
            foreach (var security in m_Securities)
            {
                foreach (var field in m_Fields)
                {
                    if (String.IsNullOrEmpty(security) || String.IsNullOrEmpty(field))
                    {
                        continue;
                    }
                    //Element element  = s[security, field];
                    //string v = element != null ? element.GetValue().ToString() : string.Empty;
                    object value = response[security, field];
                    //Utility.Log(this, "Update Value", field+ ":" +value);
                    string v = value != null?value.ToString() : string.Empty;

                    //Console.WriteLine("[" + security + "," + field + "] " + v);
                    if (!String.IsNullOrEmpty(v))
                    {
                        CellBase c = m_CellList.Values.FirstOrDefault(e => e.Name == security && e.Tag != null && e.Tag.ToString() == field);
                        if (c != null)
                        {
                            c.SetValue(v);
                        }
                    }
                }
            }
            //Utility.Log(this, "Request", response.ToString());
        }