Ejemplo n.º 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
           
            System.IO.StreamReader sr = new System.IO.StreamReader("config.txt",System.Text.Encoding.GetEncoding("gb2312"));
            
            while (!sr.EndOfStream)
            {

                //Panel p = new Panel();
                RadioButton p = new RadioButton();
                
                Padding p1 = new Padding();
                p1.Left = 10;
                p1.Top = 10;
                p.Margin = p1;
                flowLayoutPanel1.Controls.Add(p);
                String str=sr.ReadLine();
              //  DHCamera dhc1 = new DHCamera();
                CameraData cd = new CameraData();
                p.Text = str.Split('|')[0];
                cd.Handle = p.Handle;
                cd.IP = str.Split('|')[0];
                cd.Port =Convert.ToInt32( str.Split('|')[1]) ;
                cd.UserName = str.Split('|')[2];
                cd.Pwd = str.Split('|')[3];
                cd.Code= str.Split('|')[4];
                cd.ImagesPath= str.Split('|')[5];
                //dhc1.Init(cd);
                listcamera.Add(cd);
            }
            sr.Close();

        }
Ejemplo n.º 2
0
 public Form1(CameraData cc)
 {
     cd = cc;
     InitializeComponent();
 }
Ejemplo n.º 3
0
        public bool Init(CameraData _cameraData)
        {
            cameraData = _cameraData;
            server.start(Convert.ToInt32(cameraData.Code));
            disConnect = new fDisConnect(DisConnectEvent);
            DHClient.DHInit(disConnect, IntPtr.Zero);
            DHClient.DHSetEncoding((int)LANGUAGE_ENCODING.gb2312);//字符编码格式设置,默认为gb2312字符编码,如果为其他字符编码请设置
            pLoginID = DHClient.DHLogin(cameraData.IP, (ushort)cameraData.Port, cameraData.UserName, cameraData.Pwd, out deviceInfo, out error);
            // cameraData.control.Text = pLoginID + "";
            if (pLoginID != 0)
            {
                // (cameraData.control as UserControl).Text = pLoginID.ToString();
                pPlayBackHandle = new int[deviceInfo.byChanNum];
                //画面按钮有效性控制
                pRealPlayHandle = null;
                //for (int i = 0; i < deviceInfo.byChanNum; i++)
                //{
                //    cmbChannelSelect.Items.Add(i.ToString());
                //    //cmbChannelSelect.Items.Add((i+1).ToString());
                //}
                NET_SDK_CLIENTINFO lsc = new NET_SDK_CLIENTINFO();

                lsc.lChannel = deviceInfo.byChanNum; //预览的通道
                lsc.streamType = 1;// 码流
                lsc.hPlayWnd = cameraData.Handle;//pictureBox.Handle
                lLiveHandle = (IntPtr)DHClient.DHRealPlay(pLoginID, 0, lsc.hPlayWnd);//ID 通道 ,Picture句柄
                
                IntPtr userdata = (IntPtr)Convert.ToInt32(_cameraData.Code);


                DHClient.DHSetRealDataCallBack((int)lLiveHandle, fd, userdata);
                //  DHPlay.PLAY_OpenStream(tongdao, IntPtr.Zero, 0, (UInt32)900 * 1024);
                //播放的部分
                //bool b2 = DHPlay.DHPlayControl(PLAY_COMMAND.OpenStream, tongdao, IntPtr.Zero, 0, 900 * 1024);
                //DHPlay.DHSetStreamOpenMode(tongdao, PLAY_MODE.STREAME_FILE);
                //DHPlay.DHPlayControl(0, tongdao, _cameraData.control.Handle);
                return true;
            }
            else
            {
                return false;
            }
        }