public ActionResult Index()
        {
            ClientDemo cd = new ClientDemo();

            cd.GetDemoResult();

            return(View());
        }
Пример #2
0
        private static void Main(string[] args)
        {
            var server = new ServerDemo();
            server.Setup();
            server.Start();

            var client = new ClientDemo();
            client.RunAsync(server.LocalPort).Wait();

            Console.ReadLine();
        }
Пример #3
0
        private static void Main(string[] args)
        {
            var server = new ServerDemo();

            server.Setup();
            server.Start();

            var client = new ClientDemo();

            client.RunAsync(server.LocalPort).Wait();

            Console.ReadLine();
        }
Пример #4
0
        private void PTZControl(int nCommand, bool bStop, int nSpeed)
        {
            ClientDemo clientForm    = (ClientDemo)this.Owner;
            int        nCurVideoform = clientForm.m_nCurIndex;

            if (nCurVideoform >= 0)
            {
                int nPlayHandel = clientForm.m_videoform[nCurVideoform].m_iPlayhandle;
                if (nPlayHandel > 0)
                {
                    int nLoginID = clientForm.m_videoform[nCurVideoform].m_lLogin;
                    int nChannel = clientForm.m_videoform[nCurVideoform].m_iChannel;
                    NETSDK.H264_DVR_PTZControl(nLoginID, nChannel, (int)nCommand, bStop, nSpeed);
                }
            }
        }
Пример #5
0
        static void Main(string[] args)
        {
            //XML适配器 XMLA To XMLB (XMLB实现XMLA需要的接口方法,但是方法名不同,需要适配器修改)
            XMLAdapter _XMLAdapter = new XMLAdapter();

            _XMLAdapter.XMLRead();

            //电压适配器 需要适配器修改220电压为110电压
            DianYa220     _DianYa220     = new DianYa220();
            DianYaAdapter _DianYaAdapter = new DianYaAdapter(_DianYa220);

            _DianYaAdapter.DianYa220ToDianYa110();

            //类适配器以及对象适配器
            ClientDemo _ClientDemo = new ClientDemo();

            _ClientDemo.TestClassAdapter();  //类适配器
            _ClientDemo.TestObjectAdapter(); //对象适配器
        }
Пример #6
0
            static void Main(string[] args)
            {
                string     ipAdresse = "";
                ClientDemo client;

                if (File.Exists("IP.txt"))
                {
                    ipAdresse = File.ReadAllText("IP.txt");
                }

                if (ipAdresse != string.Empty && File.Exists("IP.txt"))
                {
                    client = new ClientDemo(ipAdresse, 13000);
                }
                else
                {
                    client = new ClientDemo("127.0.0.1", 13000);
                }
            }
Пример #7
0
 public void DeletePlayerFromList(ClientDemo clientToRemove)
 {
     throw new NotImplementedException();
 }
Пример #8
0
 public string Register(ClientDemo clientToRegister)
 {
     throw new NotImplementedException();
 }
Пример #9
0
        public void ReConnect(object source, System.Timers.ElapsedEventArgs e)
        {
            foreach (DEV_INFO devinfo in dictDiscontDev.Values)
            {
                H264_DVR_DEVICEINFO OutDev = new H264_DVR_DEVICEINFO();
                int nError = 0;

                int lLogin = NETSDK.H264_DVR_Login(devinfo.szIpaddress, (ushort)devinfo.nPort, devinfo.szUserName, devinfo.szPsw, out OutDev, out nError, SocketStyle.TCPSOCKET);
                if (lLogin <= 0)
                {
                    int nErr = NETSDK.H264_DVR_GetLastError();
                    if (nErr == (int)SDK_RET_CODE.H264_DVR_PASSWORD_NOT_VALID)
                    {
                        MessageBox.Show(("Password Error"));
                    }
                    else if (nErr == (int)SDK_RET_CODE.H264_DVR_LOGIN_USER_NOEXIST)
                    {
                        MessageBox.Show(("User Not Exist"));
                    }

                    return;
                }
                dictDiscontDev.Remove(devinfo.lLoginID);

                ClientDemo clientForm = new ClientDemo();

                foreach (Form form in Application.OpenForms)
                {
                    if (form.Name == "ClientDemo")
                    {
                        clientForm = (ClientDemo)form;
                        break;
                    }
                }
                DEV_INFO devAdd = new DEV_INFO();
                devAdd          = devinfo;
                devAdd.lLoginID = lLogin;


                foreach (TreeNode node in clientForm.devForm.DevTree.Nodes)
                {
                    if (node.Name == "Device")
                    {
                        DEV_INFO dev = (DEV_INFO)node.Tag;
                        if (dev.lLoginID == devinfo.lLoginID)
                        {
                            node.Text = devAdd.szDevName;
                            node.Tag  = devAdd;
                            node.Name = "Device";

                            foreach (TreeNode channelnode in node.Nodes)
                            {
                                CHANNEL_INFO chInfo = (CHANNEL_INFO)channelnode.Tag;
                                if (chInfo.nWndIndex > -1)
                                {
                                    clientForm.m_videoform[chInfo.nWndIndex].ConnectRealPlay(ref devAdd, chInfo.nChannelNo);
                                    Thread.Sleep(10);
                                }
                            }
                            break;
                        }
                    }
                }

                dictDevInfo.Add(lLogin, devAdd);
                NETSDK.H264_DVR_SetupAlarmChan(lLogin);
            }
            if (0 == dictDiscontDev.Count)
            {
                timerDisconnect.Enabled = false;
                timerDisconnect.Stop();
            }
        }