Beispiel #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            //
            string ComputeStr = "CHN[3,107,2]+30";

            Paser p = new Paser();
            string s = p.Execute("", ComputeStr);
            Response.Write(s);
        }
Beispiel #2
0
        /// <summary>
        /// 根据Screenid查询当前场景下元素的值
        /// </summary>
        /// <param name="mScreenID"></param>
        /// <returns></returns>
        public List<V_ScreenMonitorValue> GetScreenMonitorValue(int mScreenID)
        {
            var v = from f in ObjectContext.V_ScreenMonitorValue where f.ScreenID == mScreenID select f;
            List<V_ScreenMonitorValue> eValue = v.ToList();

            foreach (V_ScreenMonitorValue obj in eValue)
            {
                if (!string.IsNullOrEmpty(obj.ComputeStr))
                {
                    Paser p = new Paser();
                    string s = p.Execute("", obj.ComputeStr.Trim());
                    if (!string.IsNullOrEmpty(s))
                    {
                        float fValue;
                        if (float.TryParse(s, out fValue))
                        {
                            obj.MonitorValue = fValue.ToString();
                        }
                        else
                        {
                            obj.MonitorValue = "-1.0";
                        }
                    }
                    else
                    {
                        obj.MonitorValue = "-1.0";
                    }
                }
            }

            return eValue;
        }