示例#1
0
 private void Frm_GrpSetting_OnGroupingRoomChanged(string room_no, bool isAdd)
 {
     if (isAdd)
     {
         ButtonExt btn = new ButtonExt();
         btn.BtnContent     = room_no;
         btn.Index          = roomNoList.Count + 1;
         btn.OnButtonClick += Btn_OnButtonClick;
         flowLayoutPanel_Tab.Controls.Add(btn);
         roomNoList.Add(btn);
         Form_Room room_new = new Form_Room();
         room_new.RoomName             = room_no;
         room_new.OnDeviceRoomChanged += Room_OnDeviceRoomChanged;
         roomDic.Add(room_no, room_new);
         foreach (Form_Room frmroom in roomDic.Values)
         {
             frmroom.RoomList = roomDic.Keys.ToList();
         }
     }
     else
     {
         foreach (ButtonExt btn in roomNoList)
         {
             if (btn.BtnContent == room_no)
             {
                 roomNoList.Remove(btn);
                 flowLayoutPanel_Tab.Controls.Remove(btn);
                 Form_Room room = roomDic[room_no];
                 roomDic.Remove(room_no);
                 foreach (Form_Room frmroom in roomDic.Values)
                 {
                     frmroom.RoomList = roomDic.Keys.ToList();
                     frmroom.RoomName = room_no;
                     if (frmroom.RoomName == room_no)
                     {
                         foreach (Form_Show frm in room.devices_list)
                         {
                             frmroom.AddFormShow(frm);
                         }
                     }
                 }
                 foreach (ButtonExt btne in roomNoList)
                 {
                     if (btne.BtnContent == "设置组")
                     {
                         btne.ExecuteButtonClick();
                     }
                 }
                 break;
             }
         }
     }
 }
示例#2
0
        private void Btn_OnButtonClick(object obj)
        {
            ButtonExt btn_ext = (ButtonExt)obj;

            foreach (ButtonExt btn in roomNoList)
            {
                if (btn.BtnContent == btn_ext?.BtnContent)
                {
                    btn.IsSelect = true;
                    Form_Room room = roomDic[btn_ext?.BtnContent];
                    LoadRoom(btn_ext?.BtnContent);
                }
                else
                {
                    btn.IsSelect = false;
                }
            }
        }
示例#3
0
 //房间加载
 private void LoadRoom(string roomName)
 {
     foreach (string name in roomDic.Keys)
     {
         Form_Room room = roomDic[name];
         if (roomName == name)
         {
             room.TopLevel = false;
             room.Parent   = Mainpanel;
             room.Dock     = DockStyle.Fill;
             room.Show();
         }
         else
         {
             room.Hide();
         }
     }
 }
示例#4
0
        public Form_Main()
        {
            InitializeComponent();
            // this.IsMdiContainer = true;
            detailForm = new DeviceDetailList();
            CenterToScreen();
            CheckForIllegalCrossThreadCalls = false;
            ButtonExt btn = new ButtonExt();

            btn.BtnContent     = "设置组";
            btn.IsSelect       = true;
            btn.Index          = 1;
            btn.OnButtonClick += Btn_OnButtonClick;
            flowLayoutPanel_Tab.Controls.Add(btn);
            roomNoList.Add(btn);
            Form_Room room = new Form_Room();

            room.StartScan();
            roomDic.Add("设置组", room);
            room.RoomList             = roomDic.Keys.ToList();
            room.OnDeviceRoomChanged += Room_OnDeviceRoomChanged;
            room.RoomName             = "设置组";
            LoadRoom("设置组");
            CheckForIllegalCrossThreadCalls = false;
            InitObj();
            //测试
            //allAuthorityData = service1Client.getAllAuthorityData("分组2");
            f_main = this;
            //
            LoadTrainForm();
            // LoadRoom("设置组");
            InitGroupForm();

            //for (int i = 0; i < 5; i++)
            //    AddRoom();
            //test
            //TestSockets();
            InitThread();
        }
示例#5
0
        private void Room_OnDeviceRoomChanged(string toRoom, Form_Show device)
        {
            Form_Room room = roomDic[toRoom];

            room.AddFormShow(device);
        }