示例#1
0
文件: Home.cs 项目: lucha2013/0808hmi
        private void AddTags2Group(Form home, KVGroup homeGroup, KeyencePlcDrive kVDrive)
        {
            Control.ControlCollection controlCollection = home.Controls;
            foreach (Control control in controlCollection)
            {
                //if (control.Controls != null)
                //{
                //    AddGroup(home, homeGroup);
                //}


                if (control.GetType().GetInterface("KVBox") != null)
                {
                    foreach (ITag tag in ((KVBox)control).KVTags)
                    {
                        homeGroup.AddTag(tag);
                        tag.ValueChangeEvent += ((KVBox)control).ValueChange;
                        tag.Parent            = kVDrive;
                    }
                }
                //KVBox box = control as KVBox;
                //if (box!=null)
                //{
                //    foreach(ITag tag in box.KVTags)
                //    {
                //        homeGroup.AddTag(tag);
                //    }

                //}
            }
        }
示例#2
0
文件: Home.cs 项目: lucha2013/0808hmi
        private void Home_Load(object sender, EventArgs e)
        {
            ParaSettingForm = new ParaSetting()
            {
                FromWindow = this
            };
            KeyencePlcDrive kvPLCDrive = new KeyencePlcDrive(1, "KeyencePLCDrive", "192.168.50.211", 5000);

            //将窗口内的 TAG 加到相应的 Group 里面
            AddTags2Group(this, Groups[0]            = new KVGroup(true, 1, "homeGroup", 50, new List <ITag>()), kvPLCDrive);
            AddTags2Group(ParaSettingForm, Groups[1] = new KVGroup(false, 2, "paraSettingGroup", 50, new List <ITag>()), kvPLCDrive);

            kvPLCDrive.Groups = Groups;
            kvPLCDrive.init();
        }