// 刷新电脑状态(开机。下机。认证)
        public void UpdateHomePageData(StructRealTime com)
        {
            this.Invoke(new RefreshUIHandle(delegate {
                //获取所对应的电脑
                List <StructRealTime> coms = new List <StructRealTime>();
                if (areaComsDict.Keys.Contains(com.Area))
                {
                    coms = areaComsDict[com.Area];
                }
                else
                {
                    coms = areaComsDict["-1"];
                }
                //获取电脑所在数组的索引
                int comIndex = -1;
                try
                {
                    comIndex = coms.Select((StructRealTime tem, int
                                            index) => new { tem, index }).Where(a => a.tem.Computerid == com.Computerid).First().index;
                }
                catch (Exception exc)
                {
                    comIndex = -1;
                }

                //通过索引获取电脑
                if (comIndex < 0)
                {
                    return;
                }
                Control[] res = this.comsBg.Controls.Find(string.Format("name_{0}", com.Computerid), true);
                if (res.Count() > 0)
                {
                    coms[comIndex]            = com;
                    AreaComView updateComView = res.First() as AreaComView;
                    updateComView.Tag         = com;
                    COMPUTERSTATUS status     = COMPUTERSTATUS.无;
                    Enum.TryParse <COMPUTERSTATUS>(com.Status, out status);
                    updateComView.ComStatus = status;
                }
                //修改过滤数组的值
                int comindex = HomePageMessageManage.GetComputerIndex(com.Computerid, this.filterComs);
                if (comindex < 0)
                {
                    return;
                }
                this.filterComs[comindex] = com;
                this.comsBg.Refresh();
            }));
        }
Esempio n. 2
0
        //刷新区域电脑
        private void RefreshAreaComsPanel()
        {
            this.currentComsPanel.Controls.Clear();

            for (int i = 0; i < this.areaManage.currentComs.Count; i++)
            {
                StructRealTime time = this.areaManage.currentComs[i];
                AreaComView    view = new AreaComView();

                view.Click += Button_Click;
                view.Title  = time.Computer;
                this.currentComsPanel.Controls.Add(view);
                view.Tag = i.ToString();
            }
        }
Esempio n. 3
0
        //点击区域从属电脑
        private void Button_Click(object sender, EventArgs e)
        {
            AreaComView button = sender as AreaComView;

            if (selectButtons.Contains(button))
            {
                selectButtons.Remove(button);

                button.BackColor = Color.Transparent;
            }
            else
            {
                selectButtons.Add(button);
                button.BackColor = Color.Green;
            }
        }