Beispiel #1
0
        // 设备上线
        void devOnline(DeviceData dev)
        {
            //  TODO : 抢红包,定位app

            // 判断设备数量
            var connected = Program.Repository.Temp["totalDev"] as int?;

            if (connected == null)
            {
                Program.Repository.Temp["totalDev"] = 1;
            }
            else
            {
                var priv       = UAC.Privilege;
                var maxConnect = int.Parse(priv) * 30;
                if (connected > maxConnect)
                {
                    return;
                }
            }

            // 添加屏幕监控
            this.Invoke((ThreadStart)(() =>
            {
                if (Program.Slaves.Get(dev.Serial) == null)
                {
                    Program.Logs.WriteLog($"设备上线:{dev.Serial}");

                    var view = new SlaveViewer();
                    view.ResponseClick = false;
                    view.Margin = new Padding(10);
                    view.ShowMenu = true;
                    view.Parent = layoutPanel;
                    layoutPanel.Controls.Add(view);
                    view.Display(dev);
                    // 设备上线全局事件
                    Program.Events.Raise(view, "dev_online", dev);
                }
            }));
        }
Beispiel #2
0
 public void Display(Slavery.Slave sl)
 {
     view.Display(sl);
     view.Invalidate();
     this.Invalidate();
 }