예제 #1
0
        void SetupModbusProperties(bool bReload, TheProcessMessage pMsg)
        {
            if (MyModConnectForm != null)
            {
                List <TheFieldInfo> tLst = TheNMIEngine.GetFieldsByFunc(s => s.FormID == MyModConnectForm.cdeMID);
                foreach (TheFieldInfo tInfo in tLst)
                {
                    if (tInfo.FldOrder >= 600 && TheCommonUtils.CInt(tInfo.PropBagGetValue("ParentFld")) == 500)
                    {
                        TheNMIEngine.DeleteFieldById(tInfo.cdeMID);
                    }
                }

                List <cdeP> props  = MyBaseThing.GetPropertiesMetaStartingWith("MODPROP");
                int         fldCnt = 600;
                foreach (var p in props)
                {
                    var field = MyModFieldStore.MyMirrorCache.GetEntryByFunc(s => s.PropertyName == p.Name);
                    if (field != null)
                    {
                        TheNMIEngine.AddSmartControl(MyBaseThing, MyModConnectForm, eFieldType.SingleEnded, fldCnt++, field.AllowWrite ? 2 : 0, 0, p.Name, p.Name, new nmiCtrlSingleEnded()
                        {
                            TileWidth = 6, ParentFld = 500
                        });
                    }
                }
                MyModConnectForm.Reload(pMsg, bReload);
            }
        }