示例#1
0
        /// <summary>
        /// Node Values Refresh
        /// </summary>
        protected void OnValuesStoreRefresh(object sender, StoreRefreshDataEventArgs e)
        {
            try {
                var start = Int32.Parse(e.Parameters["start"]);
                var limit = Int32.Parse(e.Parameters["limit"]);
                var end   = start + limit;
                var data  = new List <object>(limit);

                var cacheKey = WebUtility.GetCacheKeyName(UserData, "ai-node-values");
                var nodes    = HttpRuntime.Cache[cacheKey] as List <NodeInfo>;
                if (nodes == null)
                {
                    nodes = AddDataToCache();
                }
                if (nodes != null && nodes.Count > 0)
                {
                    if (end > nodes.Count)
                    {
                        end = nodes.Count;
                    }
                    for (int i = start; i < end; i++)
                    {
                        data.Add(new {
                            ID          = i + 1,
                            LscName     = nodes[i].LscName,
                            Area2Name   = nodes[i].Area2Name,
                            Area3Name   = nodes[i].Area3Name,
                            StaName     = nodes[i].StaName,
                            DevName     = nodes[i].DevName,
                            DevTypeName = nodes[i].DevTypeName,
                            NodeID      = nodes[i].NodeID,
                            NodeName    = nodes[i].NodeName,
                            NodeValue   = String.Format("{0} {1}", nodes[i].Value.ToString("0.000"), nodes[i].Remark),
                            Status      = (int)nodes[i].Status
                        });
                    }
                }

                e.Total = (nodes != null ? nodes.Count : 0);
                ValuesStore.DataSource = data;
                ValuesStore.DataBind();
            } catch (Exception err) {
                WebUtility.WriteLog(EnmSysLogLevel.Error, EnmSysLogType.Exception, err.ToString(), Page.User.Identity.Name);
                WebUtility.ShowMessage(EnmErrType.Error, err.Message);
            }
        }
示例#2
0
        static void Main(string[] args)
        {
            var the_first_store = new ValuesStore <int>();

            the_first_store[0] = 100;
            the_first_store[1] = 200;
            the_first_store[2] = 300;
            the_first_store[3] = 400;
            the_first_store[4] = 500;
            Console.WriteLine(ValuesStore <int> .Counter);
            Console.WriteLine(ValuesStore <int> .LastCreated);
            var the_second_store = new ValuesStore <string>();

            the_second_store[0] = "one hundred";
            the_second_store[1] = "two hundred";
            the_second_store[2] = "three hundred";
            the_second_store[3] = "four hundred";
            the_second_store[4] = "five hundred";
            Console.WriteLine(ValuesStore <string> .Counter);
            Console.WriteLine(ValuesStore <string> .LastCreated);
            Console.ReadKey();
        }