示例#1
0
        public Mastervalue GetMastervalueByName(string name)
        {
            Mastervalue mv = null;

            if (MastervalueByName.TryGetValue(name, out mv))
            {
                return(mv);
            }
            else
            {
                return(null);
            }
        }
示例#2
0
        private void FillFromMasterValueList(Dictionary <string, mastervalue[]> masterValueListByChannel)
        {
            if (MastervalueByName == null)
            {
                MastervalueByName = new Dictionary <string, Mastervalue>();
            }

            foreach (var c in Channels)
            {
                c.MasterValues.Clear();

                mastervalue[] raw_mvl = null;

                if (masterValueListByChannel.TryGetValue(c.ISEID, out raw_mvl))
                {
                    foreach (var raw_mv in raw_mvl)
                    {
                        //update channel master values
                        Mastervalue mv = null;
                        if (c.MasterValues.TryGetValue(raw_mv.name, out mv))
                        {
                            mv.Value = raw_mv.value;
                        }
                        else
                        {
                            mv = new Mastervalue(raw_mv, c);
                            c.MasterValues.Add(raw_mv.name, mv);
                        }

                        //update global dict
                        if (!MastervalueByName.ContainsKey(mv.Name))
                        {
                            MastervalueByName.Add(mv.Name, mv);
                        }
                    }
                }
            }
        }