Ejemplo n.º 1
0
        private void InfoIPChannel()
        {
            string HCIP       = ConfigurationManager.AppSettings["HCIP"];
            ushort HCPort     = Convert.ToUInt16(ConfigurationManager.AppSettings["HCPort"]);
            string HCUserName = ConfigurationManager.AppSettings["HCUserName"];
            string HCPassWord = ConfigurationManager.AppSettings["HCPassWord"];

            HC_SDKFactory.DVR_NET_INIT();
            int HCUserID = HC_SDKFactory.Login(HCIP, HCPort, HCUserName, HCPassWord);

            uint   dwSize          = (uint)Marshal.SizeOf(m_struIpParaCfgV40);
            IntPtr ptrIpParaCfgV40 = Marshal.AllocHGlobal((Int32)dwSize);

            Marshal.StructureToPtr(m_struIpParaCfgV40, ptrIpParaCfgV40, false);
            uint dwReturn = 0;

            if (!HCNetSDK_X64.NET_DVR_GetDVRConfig(HCUserID, HCNetSDK_X64.NET_DVR_GET_IPPARACFG_V40, 0, ptrIpParaCfgV40, dwSize, ref dwReturn))
            {
                MessageBox.Show("Net NVR Failed! Code :" + HCNetSDK_X64.NET_DVR_GetLastError());
            }
            else
            {
                m_struIpParaCfgV40  = (HCNetSDK_X64.NET_DVR_IPPARACFG_V40)Marshal.PtrToStructure(ptrIpParaCfgV40, typeof(HCNetSDK_X64.NET_DVR_IPPARACFG_V40));
                dwDCStartChannelNum = (int)m_struIpParaCfgV40.dwStartDChan;
            }
        }
Ejemplo n.º 2
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            VGVM = (VideoGroupViewModel)this.DataContext;
            string HCIP       = ConfigurationManager.AppSettings["HCIP"];
            ushort HCPort     = Convert.ToUInt16(ConfigurationManager.AppSettings["HCPort"]);
            string HCUserName = ConfigurationManager.AppSettings["HCUserName"];
            string HCPassWord = ConfigurationManager.AppSettings["HCPassWord"];

            HC_SDKFactory.DVR_NET_INIT();
            HCUserID        = HC_SDKFactory.Login(HCIP, HCPort, HCUserName, HCPassWord);
            dwAChanTotalNum = HC_SDKFactory.lpDeviceInfo_X64.byChanNum;
            if (HC_SDKFactory.lpDeviceInfo_X64.byIPChanNum > 0)
            {
                InfoIPChannel();
            }

            if (HCUserID != -1)
            {
                int  defaultIndex;
                bool b = int.TryParse(ConfigurationManager.AppSettings["DefaultIndex"].ToString(), out defaultIndex);
                if (!b)
                {
                    defaultIndex = 0;
                }
                //VGVM.WestThroatVideoControl = HC_SDKFactory.factory(HCUserID, VGVM.TV.WestThroat.Channel + dwDCStartChannelNum, WestThroatVideo.Handle, 0);
                //VGVM.WestTrackVideoControl = HC_SDKFactory.factory(HCUserID, VGVM.TV.Track[defaultIndex].West.Channel + dwDCStartChannelNum, WestTrackVideo.Handle, 0);
                //VGVM.WestTrackZoomVideoControl = HC_SDKFactory.factory(HCUserID, VGVM.TV.Track[defaultIndex].West.Channel + dwDCStartChannelNum, WestTrackZoomVideo.Handle, 0);
                //VGVM.EastTrackZoomVideoControl = HC_SDKFactory.factory(HCUserID, VGVM.TV.Track[defaultIndex].East.Channel + dwDCStartChannelNum, EastTrackZoomVideo.Handle, 0);
                //VGVM.EastTrackVideoControl = HC_SDKFactory.factory(HCUserID, VGVM.TV.Track[defaultIndex].East.Channel + dwDCStartChannelNum, EastTrackVideo.Handle, 0);
                //VGVM.EastThroatVideoControl = HC_SDKFactory.factory(HCUserID, VGVM.TV.EastThroat.Channel + dwDCStartChannelNum, EastThroatVideo.Handle, 0);
                //VGVM.PlayAll();
            }
        }
Ejemplo n.º 3
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            //return;
            VGVM = (VideoGroupViewModel)this.DataContext;

            rb1.IsChecked = true;

            string HCIP       = ConfigurationManager.AppSettings["HCIP"];
            ushort HCPort     = Convert.ToUInt16(ConfigurationManager.AppSettings["HCPort"]);
            string HCUserName = ConfigurationManager.AppSettings["HCUserName"];
            string HCPassWord = ConfigurationManager.AppSettings["HCPassWord"];

            HC_SDKFactory.DVR_NET_INIT();
            HCUserID        = HC_SDKFactory.Login(HCIP, HCPort, HCUserName, HCPassWord);
            dwAChanTotalNum = HC_SDKFactory.lpDeviceInfo_X64.byChanNum;
            if (HC_SDKFactory.lpDeviceInfo_X64.byIPChanNum > 0)
            {
                InfoIPChannel();
            }

            if (HCUserID != -1)
            {
                VGVM.WestThroatVideoControl    = HC_SDKFactory.factory(HCUserID, VGVM.TV.WestThroat.Channel + dwDCStartChannelNum, WestThroatVideo, 0);
                VGVM.WestTrackVideoControl     = HC_SDKFactory.factory(HCUserID, VGVM.TV.Track[0].West.Channel + dwDCStartChannelNum, WestTrackVideo, 0);
                VGVM.WestTrackZoomVideoControl = HC_SDKFactory.factory(HCUserID, VGVM.TV.Track[0].West.Channel + dwDCStartChannelNum, WestTrackZoomVideo, 0);

                VGVM.EastTrackZoomVideoControl = HC_SDKFactory.factory(HCUserID, VGVM.TV.Track[0].East.Channel + dwDCStartChannelNum, EastTrackZoomVideo, 0);
                VGVM.EastTrackVideoControl     = HC_SDKFactory.factory(HCUserID, VGVM.TV.Track[0].East.Channel + dwDCStartChannelNum, EastTrackVideo, 0);
                VGVM.EastThroatVideoControl    = HC_SDKFactory.factory(HCUserID, VGVM.TV.EastThroat.Channel + dwDCStartChannelNum, EastThroatVideo, 0);
                VGVM.PlayAll();
            }
        }
Ejemplo n.º 4
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     VGVM.CloseAll();
     VGVM.w0 = HC_SDKFactory.factory(HCUserID, 31 + dwDCStartChannelNum, w0.Handle, 0);
     w0.Text = "结束";
     VGVM.w0.Play();
 }
Ejemplo n.º 5
0
        /// <summary>
        /// 弹出视频窗口
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void WestThroatVideo_Click(object sender, EventArgs e)
        {
            if (HCUserID != -1)
            {
                VideoZoomInWindow vziw = new VideoZoomInWindow();
                vziw.HCUserID = this.HCUserID;
                System.Windows.Forms.Control con = ((System.Windows.Forms.Control)sender);
                switch (con.Tag.ToString())
                {
                case "WestThroatVideo":
                    //vziw.Channle = iChannelNum[0];
                    con.Tag = "WestThroatVideo2";
                    VGVM.WestThroatVideoControl.Stop();
                    VGVM.WestThroatVideoControl = HC_SDKFactory.factory(HCUserID, VGVM.TV.WestThroat2.Channel + dwDCStartChannelNum + 1, WestThroatVideo.Handle, 0);
                    VGVM.WestThroatVideoControl.Play();
                    break;

                case "WestThroatVideo2":
                    //vziw.Channle = iChannelNum[0];
                    con.Tag = "WestThroatVideo";
                    VGVM.WestThroatVideoControl.Stop();
                    VGVM.WestThroatVideoControl = HC_SDKFactory.factory(HCUserID, VGVM.TV.WestThroat.Channel + dwDCStartChannelNum + 1, WestThroatVideo.Handle, 0);
                    VGVM.WestThroatVideoControl.Play();
                    break;

                case "EastThroatVideo":
                    //vziw.Channle = iChannelNum[1];
                    con.Tag = "WestThroatVideo2";
                    VGVM.EastThroatVideoControl.Stop();
                    VGVM.EastThroatVideoControl = HC_SDKFactory.factory(HCUserID, VGVM.TV.EastThroat2.Channel + dwDCStartChannelNum + 1, EastThroatVideo.Handle, 0);
                    VGVM.EastThroatVideoControl.Play();
                    break;

                case "EastThroatVideo2":
                    //vziw.Channle = iChannelNum[1];
                    con.Tag = "WestThroatVideo";
                    VGVM.EastThroatVideoControl.Stop();
                    VGVM.EastThroatVideoControl = HC_SDKFactory.factory(HCUserID, VGVM.TV.EastThroat.Channel + dwDCStartChannelNum + 1, EastThroatVideo.Handle, 0);
                    VGVM.EastThroatVideoControl.Play();
                    break;
                }
                //vziw.Show();
            }
        }
Ejemplo n.º 6
0
        private void VideoZoomInWindow_Loaded(object sender, RoutedEventArgs e)
        {
            VZWVM = (VideoZoomInWindowViewModel)this.DataContext;
            //string HCIP = ConfigurationManager.AppSettings["HCIP"];
            //ushort HCPort = Convert.ToUInt16(ConfigurationManager.AppSettings["HCPort"]);
            //string HCUserName = ConfigurationManager.AppSettings["HCUserName"];
            //string HCPassWord = ConfigurationManager.AppSettings["HCPassWord"];
            //VZWVM.TV = new Model.TrackVideo();
            //VZWVM.TV = new MainWindowViewModel().LoadCameraConfig();

            //HC_SDKFactory.DVR_NET_INIT();
            //HCUserID = HC_SDKFactory.Login(HCIP, HCPort, HCUserName, HCPassWord);

            if (HCUserID != -1)
            {
                VZWVM.ZoomInVideoControl = HC_SDKFactory.factory(HCUserID, Channle, ZoomInVideo.Handle, 0);
                VZWVM.ZoomInVideoControl.Play();
            }
        }
Ejemplo n.º 7
0
        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            //return;
            VGVM = (VideoGroupViewModel)this.DataContext;

            rb1.IsChecked = true;

            string HCIP       = ConfigurationManager.AppSettings["HCIP"];
            ushort HCPort     = Convert.ToUInt16(ConfigurationManager.AppSettings["HCPort"]);
            string HCUserName = ConfigurationManager.AppSettings["HCUserName"];
            string HCPassWord = ConfigurationManager.AppSettings["HCPassWord"];

            HC_SDKFactory.DVR_NET_INIT();
            HCUserID        = HC_SDKFactory.Login(HCIP, HCPort, HCUserName, HCPassWord);
            dwAChanTotalNum = HC_SDKFactory.lpDeviceInfo_X64.byChanNum;
            //if (HC_SDKFactory.lpDeviceInfo_X64.byIPChanNum > 0)
            //{
            //    InfoIPChannel();
            //}

            if (HCUserID != -1)
            {
                VGVM.WestThroatVideoControl = HC_SDKFactory.factory(HCUserID, VGVM.TV.WestThroat.Channel + dwDCStartChannelNum + 1, WestThroatVideo.Handle, 0);

                VGVM.WestTrackVideoControl     = HC_SDKFactory.factory(HCUserID, VGVM.TV.Track[0].West.Channel + dwDCStartChannelNum + 1, WestTrackVideo.Handle, 0);
                VGVM.WestTrackZoomVideoControl = HC_SDKFactory.factory(HCUserID, VGVM.TV.Track[0].West.Channel + dwDCStartChannelNum + 1, WestTrackZoomVideo.Handle, 0);

                VGVM.EastTrackZoomVideoControl = HC_SDKFactory.factory(HCUserID, VGVM.TV.Track[0].East.Channel + dwDCStartChannelNum + 1, EastTrackZoomVideo.Handle, 0);
                VGVM.EastTrackVideoControl     = HC_SDKFactory.factory(HCUserID, VGVM.TV.Track[0].East.Channel + dwDCStartChannelNum + 1, EastTrackVideo.Handle, 0);

                VGVM.EastThroatVideoControl = HC_SDKFactory.factory(HCUserID, VGVM.TV.EastThroat.Channel + dwDCStartChannelNum + 1, EastThroatVideo.Handle, 0);
                VGVM.PlayAll();
            }
            //string DVRIPAddress = HCIP; //设备IP地址或者域名
            //Int16 DVRPortNumber = Convert.ToInt16(HCPort);//设备服务端口号
            //string DVRUserName = HCUserName;//设备登录用户名
            //string DVRPassword = HCPassWord;//设备登录密码

            //HCNetSDK_X64.NET_DVR_DEVICEINFO_V30 DeviceInfo = new HCNetSDK_X64.NET_DVR_DEVICEINFO_V30();

            ////登录设备 Login the device
            //HCUserID = HCNetSDK_X64.NET_DVR_Login_V30(DVRIPAddress, DVRPortNumber, DVRUserName, DVRPassword, ref DeviceInfo);
            //if (HCUserID < 0)
            //{
            //    uint iLastErr = HCNetSDK_X64.NET_DVR_GetLastError();

            //    MessageBox.Show("NET_DVR_Login_V30 failed, error code= " + iLastErr);
            //    return;
            //}
            //else
            //{
            //    //登录成功
            //    //MessageBox.Show("Login Success!");
            //    HCNetSDK_X64.NET_DVR_PREVIEWINFO lpPreviewInfo = new HCNetSDK_X64.NET_DVR_PREVIEWINFO();
            //    lpPreviewInfo.hPlayWnd = WestThroatVideo.Handle;//预览窗口
            //    lpPreviewInfo.lChannel = 2;//预te览的设备通道
            //    lpPreviewInfo.dwStreamType = 0;//码流类型:0-主码流,1-子码流,2-码流3,3-码流4,以此类推
            //    lpPreviewInfo.dwLinkMode = 0;//连接方式:0- TCP方式,1- UDP方式,2- 多播方式,3- RTP方式,4-RTP/RTSP,5-RSTP/HTTP
            //    lpPreviewInfo.bBlocked = true; //0- 非阻塞取流,1- 阻塞取流
            //    lpPreviewInfo.dwDisplayBufNum = 1; //播放库播放缓冲区最大缓冲帧数
            //    lpPreviewInfo.byProtoType = 0;
            //    lpPreviewInfo.byPreviewMode = 0;
            //    IntPtr pUser = new IntPtr();//用户数据
            //    //打开预览 Start live view
            //    int m_lRealHandle = HCNetSDK_X64.NET_DVR_RealPlay_V40(HCUserID, ref lpPreviewInfo, null/*RealData*/, pUser);
            //    if (m_lRealHandle < 0)
            //    {
            //        uint iLastErr = HCNetSDK_X64.NET_DVR_GetLastError();
            //        MessageBox.Show("NET_DVR_RealPlay_V40 failed, error code= " + iLastErr);
            //        return;
            //    }
            //}
        }
Ejemplo n.º 8
0
        private void PlayVideo()
        {
            Application.Current.Dispatcher.Invoke(new Action(() =>
            {
                isOver = false;
                for (int i = 0; i < list.Count; i++)
                {
                    string track = list[i].ToString();
                    string[] arr = track.Split(',');
                    if (i == 0)
                    {
                        w0.Visible = true;
                        e0.Visible = true;
                        tb0.Text   = arr[0];
                        VGVM.w0    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[1]) + dwDCStartChannelNum, w0.Handle, 0);
                        VGVM.e0    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[2]) + dwDCStartChannelNum, e0.Handle, 0);
                        VGVM.w0.Play();
                        VGVM.e0.Play();

                        w0.Tag = arr[1];
                        e0.Tag = arr[2];
                    }
                    if (i == 1)
                    {
                        w1.Visible = true;
                        e1.Visible = true;
                        tb1.Text   = arr[0];
                        VGVM.w1    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[1]) + dwDCStartChannelNum, w1.Handle, 0);
                        VGVM.e1    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[2]) + dwDCStartChannelNum, e1.Handle, 0);
                        VGVM.w1.Play();
                        VGVM.e1.Play();

                        w1.Tag = arr[1];
                        e1.Tag = arr[2];
                    }
                    if (i == 2)
                    {
                        w2.Visible = true;
                        e2.Visible = true;
                        tb2.Text   = arr[0];
                        VGVM.w2    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[1]) + dwDCStartChannelNum, w2.Handle, 0);
                        VGVM.e2    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[2]) + dwDCStartChannelNum, e2.Handle, 0);
                        VGVM.w2.Play();
                        VGVM.e2.Play();

                        w2.Tag = arr[1];
                        e2.Tag = arr[2];
                    }
                    if (i == 3)
                    {
                        w3.Visible = true;
                        e3.Visible = true;
                        tb3.Text   = arr[0];
                        VGVM.w3    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[1]) + dwDCStartChannelNum, w3.Handle, 0);
                        VGVM.e3    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[2]) + dwDCStartChannelNum, e3.Handle, 0);
                        VGVM.w3.Play();
                        VGVM.e3.Play();

                        w3.Tag = arr[1];
                        e3.Tag = arr[2];
                    }
                    if (i == 4)
                    {
                        w4.Visible = true;
                        e4.Visible = true;
                        tb4.Text   = arr[0];
                        VGVM.w4    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[1]) + dwDCStartChannelNum, w4.Handle, 0);
                        VGVM.e4    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[2]) + dwDCStartChannelNum, e4.Handle, 0);
                        VGVM.w4.Play();
                        VGVM.e4.Play();

                        w4.Tag = arr[1];
                        e4.Tag = arr[2];
                    }
                    if (i == 5)
                    {
                        w5.Visible = true;
                        e5.Visible = true;
                        tb5.Text   = arr[0];
                        VGVM.w5    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[1]) + dwDCStartChannelNum, w5.Handle, 0);
                        VGVM.e5    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[2]) + dwDCStartChannelNum, e5.Handle, 0);
                        VGVM.w5.Play();
                        VGVM.e5.Play();

                        w5.Tag = arr[1];
                        e5.Tag = arr[2];
                    }
                    if (i == 6)
                    {
                        w6.Visible = true;
                        e6.Visible = true;
                        tb6.Text   = arr[0];
                        VGVM.w6    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[1]) + dwDCStartChannelNum, w6.Handle, 0);
                        VGVM.e6    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[2]) + dwDCStartChannelNum, e6.Handle, 0);
                        VGVM.w6.Play();
                        VGVM.e6.Play();

                        w6.Tag = arr[1];
                        e6.Tag = arr[2];
                    }
                    if (i == 7)
                    {
                        w7.Visible = true;
                        e7.Visible = true;
                        tb7.Text   = arr[0];
                        VGVM.w7    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[1]) + dwDCStartChannelNum, w7.Handle, 0);
                        VGVM.e7    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[2]) + dwDCStartChannelNum, e7.Handle, 0);
                        VGVM.w7.Play();
                        VGVM.e7.Play();

                        w7.Tag = arr[1];
                        e7.Tag = arr[2];
                    }
                }
                isOver = true;
                thread.Abort();
            }));
        }
Ejemplo n.º 9
0
        private void RadioButton_Cick(object sender, RoutedEventArgs e)
        {
            RadioButton radioButton = (RadioButton)sender;

            if (btnList.Contains(radioButton))
            {
                radioButton.Background = new SolidColorBrush(Color.FromRgb(107, 123, 128));
                btnList.Remove(radioButton);
            }
            else
            {
                radioButton.Background = new SolidColorBrush(Color.FromRgb(58, 155, 176));
                btnList.Add(radioButton);
                if (btnList.Count > 8)
                {
                    RadioButton firstRadioButton = btnList[0];
                    firstRadioButton.Background = new SolidColorBrush(Color.FromRgb(107, 123, 128));
                    btnList.RemoveAt(0);
                }
            }

            if (VGVM != null)
            {
                tb0.Text = "";
                tb1.Text = "";
                tb2.Text = "";
                tb3.Text = "";

                tb4.Text = "";
                tb5.Text = "";
                tb6.Text = "";
                tb7.Text = "";
                object tag = (radioButton).Tag;
                if (!list.Contains(tag.ToString()))
                {
                    list.Add(tag.ToString());
                    if (list.Count > 8)
                    {
                        list.RemoveAt(0);
                    }
                }
                else
                {
                    list.Remove(tag.ToString());
                }

                w0.Visible = false;
                w1.Visible = false;
                w2.Visible = false;
                w3.Visible = false;
                w4.Visible = false;
                w5.Visible = false;
                w6.Visible = false;
                w7.Visible = false;

                e0.Visible = false;
                e1.Visible = false;
                e2.Visible = false;
                e3.Visible = false;
                e4.Visible = false;
                e5.Visible = false;
                e6.Visible = false;
                e7.Visible = false;

                VGVM.CloseAll();

                //if (isOver)
                //{
                //    thread = new Thread(PlayVideo);
                //    thread.IsBackground = true;
                //    thread.Start();
                //}
                //else
                //{
                //    MessageBox.Show("加载中...");
                //}
                for (int i = 0; i < list.Count; i++)
                {
                    string   track = list[i].ToString();
                    string[] arr   = track.Split(',');
                    if (i == 0)
                    {
                        w0.Visible = true;
                        e0.Visible = true;
                        tb0.Text   = arr[0];
                        VGVM.w0    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[1]) + dwDCStartChannelNum, w0.Handle, 0);
                        VGVM.e0    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[2]) + dwDCStartChannelNum, e0.Handle, 0);
                        VGVM.w0.Play();
                        VGVM.e0.Play();

                        w0.Tag = arr[1];
                        e0.Tag = arr[2];
                    }
                    if (i == 1)
                    {
                        w1.Visible = true;
                        e1.Visible = true;
                        tb1.Text   = arr[0];
                        VGVM.w1    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[1]) + dwDCStartChannelNum, w1.Handle, 0);
                        VGVM.e1    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[2]) + dwDCStartChannelNum, e1.Handle, 0);
                        VGVM.w1.Play();
                        VGVM.e1.Play();

                        w1.Tag = arr[1];
                        e1.Tag = arr[2];
                    }
                    if (i == 2)
                    {
                        w2.Visible = true;
                        e2.Visible = true;
                        tb2.Text   = arr[0];
                        VGVM.w2    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[1]) + dwDCStartChannelNum, w2.Handle, 0);
                        VGVM.e2    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[2]) + dwDCStartChannelNum, e2.Handle, 0);
                        VGVM.w2.Play();
                        VGVM.e2.Play();

                        w2.Tag = arr[1];
                        e2.Tag = arr[2];
                    }
                    if (i == 3)
                    {
                        w3.Visible = true;
                        e3.Visible = true;
                        tb3.Text   = arr[0];
                        VGVM.w3    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[1]) + dwDCStartChannelNum, w3.Handle, 0);
                        VGVM.e3    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[2]) + dwDCStartChannelNum, e3.Handle, 0);
                        VGVM.w3.Play();
                        VGVM.e3.Play();

                        w3.Tag = arr[1];
                        e3.Tag = arr[2];
                    }
                    if (i == 4)
                    {
                        w4.Visible = true;
                        e4.Visible = true;
                        tb4.Text   = arr[0];
                        VGVM.w4    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[1]) + dwDCStartChannelNum, w4.Handle, 0);
                        VGVM.e4    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[2]) + dwDCStartChannelNum, e4.Handle, 0);
                        VGVM.w4.Play();
                        VGVM.e4.Play();

                        w4.Tag = arr[1];
                        e4.Tag = arr[2];
                    }
                    if (i == 5)
                    {
                        w5.Visible = true;
                        e5.Visible = true;
                        tb5.Text   = arr[0];
                        VGVM.w5    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[1]) + dwDCStartChannelNum, w5.Handle, 0);
                        VGVM.e5    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[2]) + dwDCStartChannelNum, e5.Handle, 0);
                        VGVM.w5.Play();
                        VGVM.e5.Play();

                        w5.Tag = arr[1];
                        e5.Tag = arr[2];
                    }
                    if (i == 6)
                    {
                        w6.Visible = true;
                        e6.Visible = true;
                        tb6.Text   = arr[0];
                        VGVM.w6    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[1]) + dwDCStartChannelNum, w6.Handle, 0);
                        VGVM.e6    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[2]) + dwDCStartChannelNum, e6.Handle, 0);
                        VGVM.w6.Play();
                        VGVM.e6.Play();

                        w6.Tag = arr[1];
                        e6.Tag = arr[2];
                    }
                    if (i == 7)
                    {
                        w7.Visible = true;
                        e7.Visible = true;
                        tb7.Text   = arr[0];
                        VGVM.w7    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[1]) + dwDCStartChannelNum, w7.Handle, 0);
                        VGVM.e7    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[2]) + dwDCStartChannelNum, e7.Handle, 0);
                        VGVM.w7.Play();
                        VGVM.e7.Play();

                        w7.Tag = arr[1];
                        e7.Tag = arr[2];
                    }
                }
            }
        }
Ejemplo n.º 10
0
        private void RadioButton_Cick(object sender, RoutedEventArgs e)
        {
            RadioButton rb = (RadioButton)sender;

            if (btnList.Contains(rb))
            {
                rb.Background = new SolidColorBrush(Color.FromRgb(107, 123, 128));
                btnList.Remove(rb);
            }
            else
            {
                rb.Background = new SolidColorBrush(Color.FromRgb(58, 155, 176));
                btnList.Add(rb);
                if (btnList.Count > 4)
                {
                    RadioButton firstRadioButton = btnList[0];
                    firstRadioButton.Background = new SolidColorBrush(Color.FromRgb(107, 123, 128));
                    btnList.RemoveAt(0);
                }
            }

            if (VGVM != null)
            {
                tb0.Text = "";
                tb1.Text = "";
                tb2.Text = "";
                tb3.Text = "";
                object tag = (rb).Tag;
                if (!list.Contains(tag.ToString()))
                {
                    list.Add(tag.ToString());
                    if (list.Count > 4)
                    {
                        list.RemoveAt(0);
                    }
                }
                else
                {
                    list.Remove(tag.ToString());
                }

                w0.Visible = false;
                w1.Visible = false;
                w2.Visible = false;
                w3.Visible = false;


                e0.Visible = false;
                e1.Visible = false;
                e2.Visible = false;
                e3.Visible = false;

                //w0.Refresh();
                //w1.Refresh();
                //w2.Refresh();
                //w3.Refresh();
                //e0.Refresh();
                //e1.Refresh();
                //e2.Refresh();
                //w3.Refresh();
                VGVM.CloseAll();

                for (int i = 0; i < list.Count; i++)
                {
                    string   track = list[i].ToString();
                    string[] arr   = track.Split(',');
                    if (i == 0)
                    {
                        w0.Visible = true;
                        e0.Visible = true;
                        tb0.Text   = arr[0];
                        VGVM.w0    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[1]) + dwDCStartChannelNum, w0.Handle, 0);
                        VGVM.e0    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[2]) + dwDCStartChannelNum, e0.Handle, 0);
                        VGVM.w0.Play();
                        VGVM.e0.Play();

                        w0.Tag = arr[1];
                        e0.Tag = arr[2];
                    }
                    if (i == 1)
                    {
                        w1.Visible = true;
                        e1.Visible = true;
                        tb1.Text   = arr[0];
                        VGVM.w1    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[1]) + dwDCStartChannelNum, w1.Handle, 0);
                        VGVM.e1    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[2]) + dwDCStartChannelNum, e1.Handle, 0);
                        VGVM.w1.Play();
                        VGVM.e1.Play();

                        w1.Tag = arr[1];
                        e1.Tag = arr[2];
                    }
                    if (i == 2)
                    {
                        w2.Visible = true;
                        e2.Visible = true;
                        tb2.Text   = arr[0];
                        VGVM.w2    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[1]) + dwDCStartChannelNum, w2.Handle, 0);
                        VGVM.e2    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[2]) + dwDCStartChannelNum, e2.Handle, 0);
                        VGVM.w2.Play();
                        VGVM.e2.Play();

                        w2.Tag = arr[1];
                        e2.Tag = arr[2];
                    }
                    if (i == 3)
                    {
                        w3.Visible = true;
                        e3.Visible = true;
                        tb3.Text   = arr[0];
                        VGVM.w3    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[1]) + dwDCStartChannelNum, w3.Handle, 0);
                        VGVM.e3    = HC_SDKFactory.factory(HCUserID, int.Parse(arr[2]) + dwDCStartChannelNum, e3.Handle, 0);
                        VGVM.w3.Play();
                        VGVM.e3.Play();

                        w3.Tag = arr[1];
                        e3.Tag = arr[2];
                    }
                }
            }
        }