Ejemplo n.º 1
0
        private void ProcessPbData(object sender, TreeNode c)
        {
            PictureBox pbx = sender as PictureBox;

            if (c != null)
            {
                PackageOfPB ppb = new PackageOfPB();
                ppb.Current = (NodeType)Enum.Parse(typeof(NodeType), c.Name);
                ppb.Pbx     = pbx;
                switch (ppb.Current)
                {
                case NodeType.Camera:
                    ppb.Cam = c.Tag as Camera;
                    ppb.Cg  = null;
                    break;

                case NodeType.Group:
                    ppb.Cg  = c.Tag as CameraGroups;
                    ppb.Cam = null;
                    break;

                case NodeType.CameraAtGroup:
                    ppb.Cam = c.Tag as Camera;
                    ppb.Cg  = null;
                    break;
                }
                if (ppb.Current == NodeType.Camera)
                {
                    //MessageBox.Show(c.ToString());
                    Invalidate();
                }
            }
        }
        public async static void SendCameraInfo(Decoder d, PackageOfPB pb)
        {
            string paramList = "http://192.168.0.8/axis-cgi/admin/param.cgi?action=list";

            try
            {
                NetworkCredential credentials = new NetworkCredential("root", "pass");
                HttpClientHandler handler     = new HttpClientHandler {
                    Credentials = credentials
                };
                handler.PreAuthenticate = true;
                HttpClient client = new HttpClient(handler);
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
                HttpResponseMessage response = await client.GetAsync(paramList);

                Task <string> t = response.Content.ReadAsStringAsync();
                Console.WriteLine(t.Result);
                return;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString(), "\nError Message");
                return;
            }
        }
        public async static void SendPanelLayout(Decoder d, PackageOfPB pb)
        {
            Uri       paramList = new Uri("http://192.168.0.8/axis-cgi/admin/param.cgi?action=list");
            WebClient client    = new WebClient();

            client.Credentials = new NetworkCredential("root", "pass");
            var content = await client.DownloadDataTaskAsync(paramList);

            Console.WriteLine(Encoding.Default.GetString(content));
            return;
        }
Ejemplo n.º 4
0
 private void pictureBox1_Resize(object sender, EventArgs e)
 {
     xstep = (int)((pictureBox1.Width / rli.N) * ((float)pictureBox1.Height / (float)pictureBox1.Width));
     ystep = pictureBox1.Height / rli.N;
     // AddCamerasLabels();
     foreach (UserControl uc in uclist)
     {
         PackageOfPB ppb = uc.Tag as PackageOfPB;
         uc.Location = new Point(ppb.Rectitem.X * xstep + 1, ppb.Rectitem.Y * ystep + 1);
         uc.Size     = new Size(ppb.Rectitem.Width * xstep - 1, ppb.Rectitem.Height * ystep - 1);
         uc.Invalidate();
     }
     pictureBox1.Refresh();
 }
Ejemplo n.º 5
0
 private void InitializeUserControls()
 {
     foreach (Rectangle r in rli.GetRectangleList())
     {
         Basic_UIPanels customerContrl = new Basic_UIPanels(1);
         customerContrl.Name     = Guid.NewGuid().ToString();
         customerContrl.Location = new Point(r.X * xstep + 1, r.Y * ystep + 1);
         customerContrl.Size     = new Size(r.Width * xstep - 1, r.Height * ystep - 1);
         PackageOfPB ppb = new PackageOfPB();
         ppb.Rectitem       = new RectItem(r.X, r.Y, r.Width, r.Height);
         ppb.Bui            = customerContrl;
         customerContrl.Tag = ppb;//记下来该控件所需一些参数,包括摄像机、点位、宽与高、隶属的Usercontrol等等;
         uclist.Add(customerContrl);
         packPB.Add(ppb);
         pictureBox1.Controls.Add(customerContrl);
     }
     Invalidate();
 }