예제 #1
0
        void RegClient(object videoURI)
        {
            lock (this)
            {
                try
                {
                    if (VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == PeerType.BootStrap || VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == PeerType.SuperNode || VMuktiInfo.CurrentPeer.CurrPeerType == PeerType.NodeWithNetP2P)
                    {
                        ((ClsNetP2PUserVideo)objDirectXVideo).EntsvcJoin       += new ClsNetP2PUserVideo.delsvcJoin(ctlUserVideo_EntsvcJoin);
                        ((ClsNetP2PUserVideo)objDirectXVideo).EntsvcSendStream += new ClsNetP2PUserVideo.delsvcSendStream(ctlUserVideo_EntsvcSendStream);
                        ((ClsNetP2PUserVideo)objDirectXVideo).EntsvcUnJoin     += new ClsNetP2PUserVideo.delsvcUnJoin(ctlUserVideo_EntsvcUnJoin);

                        npcDirectXVideo           = new NetPeerClient();
                        netp2pDirectXVideoChannel = (INetP2PUserVideoChannel)npcDirectXVideo.OpenClient <INetP2PUserVideoChannel>(videoURI.ToString(), videoURI.ToString().Split(':')[2].Split('/')[2], ref objDirectXVideo);
                        netp2pDirectXVideoChannel.svcJoin(MyUserName);
                    }
                    else
                    {
                        int count = 0;
                        while (count < 90)
                        {
                            try
                            {
                                bhcDirectXVideo         = new BasicHttpClient();
                                httpDirectXVideoChannel = (IHttpUserVideo)bhcDirectXVideo.OpenClient <IHttpUserVideo>(videoURI.ToString());
                                httpDirectXVideoChannel.svcJoin(MyUserName);

                                count = 90;

                                if (MyVidType != "Me")
                                {
                                    disptGetImages.Start();
                                }
                            }
                            catch
                            {
                                System.Threading.Thread.Sleep(TimeSpan.FromSeconds(1));
                                count++;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "RegClient", "ctlUserVideo.xaml.cs");
                }
            }
        }
예제 #2
0
        public void RegNetP2pClient(object videoURI)
        {
            try
            {
                object objDirectXVideo = new ClsNetP2PUserVideo();
                ((ClsNetP2PUserVideo)objDirectXVideo).EntsvcJoin       += new ClsNetP2PUserVideo.delsvcJoin(ctlUserVideo_EntsvcJoin);
                ((ClsNetP2PUserVideo)objDirectXVideo).EntsvcSendStream += new ClsNetP2PUserVideo.delsvcSendStream(ctlUserVideo_EntsvcSendStream);
                ((ClsNetP2PUserVideo)objDirectXVideo).EntsvcUnJoin     += new ClsNetP2PUserVideo.delsvcUnJoin(ctlUserVideo_EntsvcUnJoin);

                NetPeerClient npcDirectXVideo = new NetPeerClient();
                netp2pDirectXVideoChannel = (INetP2PUserVideoChannel)npcDirectXVideo.OpenClient <INetP2PUserVideoChannel>(videoURI.ToString(), videoURI.ToString().Split(':')[2].Split('/')[2], ref objDirectXVideo);
                netp2pDirectXVideoChannel.svcJoin("");
            }

            catch (Exception ex)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "RegNetP2PClient", "clsVideoSNode.cs");
            }
        }
예제 #3
0
        public void ClosePod()
        {
            try
            {
                if (capture != null)
                {
                    capture.Stop();
                    capture.Dispose();
                }
                if (VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == PeerType.BootStrap || VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == PeerType.SuperNode || VMuktiInfo.CurrentPeer.CurrPeerType == PeerType.NodeWithNetP2P)
                {
                    if (netp2pDirectXVideoChannel != null)
                    {
                        netp2pDirectXVideoChannel.svcUnJoin(VMuktiInfo.CurrentPeer.DisplayName);
                    }
                }
                else
                {
                    if (httpDirectXVideoChannel != null)
                    {
                        httpDirectXVideoChannel.svcUnJoin(VMuktiInfo.CurrentPeer.DisplayName);
                    }
                }
                if (disptGetImages != null)
                {
                    disptGetImages = null;
                }
                if (netp2pDirectXVideoChannel != null)
                {
                    netp2pDirectXVideoChannel.Close();
                    netp2pDirectXVideoChannel.Dispose();
                    netp2pDirectXVideoChannel = null;
                }

                Dispose();
            }
            catch (Exception ex)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "ClosePod", "ctlUserVideo.xaml.cs");
            }
        }
예제 #4
0
 public void Dispose()
 {
     try
     {
         if (netp2pDirectXVideoChannel != null)
         {
             netp2pDirectXVideoChannel.Close();
             netp2pDirectXVideoChannel.Dispose();
             netp2pDirectXVideoChannel = null;
         }
         if (httpDirectXVideoChannel != null)
         {
             httpDirectXVideoChannel = null;
         }
         GC.Collect();
         GC.WaitForPendingFinalizers();
     }
     catch (Exception exp)
     {
         VMuktiAPI.VMuktiHelper.ExceptionHandler(exp, "Dispose", "ctlUserVideo.xaml.cs");
     }
 }
예제 #5
0
        public void RegNetP2pClient(object NetP2pUri)
        {
            try
            {
                NetPeerClient npcDummyClient = new NetPeerClient();
                objClsNetP2PUserVideo = new ClsNetP2PUserVideo();
                ((ClsNetP2PUserVideo)objClsNetP2PUserVideo).EntsvcJoin       += new ClsNetP2PUserVideo.delsvcJoin(UserVideoDummies_NetP2P_EntsvcJoin);
                ((ClsNetP2PUserVideo)objClsNetP2PUserVideo).EntsvcSendStream += new ClsNetP2PUserVideo.delsvcSendStream(UserVideoDummies_NetP2P_EntsvcSendStream);
                ((ClsNetP2PUserVideo)objClsNetP2PUserVideo).EntsvcUnJoin     += new ClsNetP2PUserVideo.delsvcUnJoin(UserVideoDummies_NetP2P_EntsvcUnJoin);

                //((ClsNetP2PMainVideo)objClsNetP2PUserVideo).EntsvcJoin += new ClsNetP2PUserVideo.delsvcJoin(UserVideoDummies_NetP2P_EntsvcJoin);
                //((ClsNetP2PMainVideo)objClsNetP2PUserVideo).EntsvcSendStream += new ClsNetP2PUserVideo.delsvcSendStream(UserVideoDummies_NetP2P_EntsvcSendStream);
                //((ClsNetP2PMainVideo)objClsNetP2PUserVideo).EntsvcUnJoin += new ClsNetP2PUserVideo.delsvcUnJoin(UserVideoDummies_NetP2P_EntsvcUnJoin);



                objINetP2PChannel = (INetP2PUserVideoChannel)npcDummyClient.OpenClient <INetP2PUserVideoChannel>(NetP2pUri.ToString(), NetP2pUri.ToString().Split(':')[2].Split('/')[2], ref objClsNetP2PUserVideo);

                while (tempcounter < 20)
                {
                    try
                    {
                        objINetP2PChannel.svcJoin(UserName);
                        tempcounter = 20;
                    }
                    catch
                    {
                        tempcounter++;
                        System.Threading.Thread.Sleep(1000);
                    }
                }
            }

            catch (Exception ex)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "RegNetP2PClient", "UserVideoDummies.cs");
            }
        }
예제 #6
0
        //public double[] PreivewWindowLoc()
        //{
        //    try
        //    {
        //        //ClsException.WriteToLogFile("PreivewWindowLoc called");
        //        double[] winXY = new double[2];
        //        winXY = capture.PreviewWidowTag();

        //        return winXY;
        //    }
        //    catch (Exception ex)
        //    {
        //        //MessageBox.Show("PreivewWindowLoc"+ex.Message);
        //        return null;
        //    }
        //}

        //public void ShowVideo()
        //{
        //    capture.showVideo();
        //}

        //public void HideVideo()
        //{
        //    capture.hideVideo();
        //}


        void Current_Exit(object sender, ExitEventArgs e)
        {
            try
            {
                if (capture != null)
                {
                    capture.Stop();
                    capture.Dispose();
                }
                if (netp2pDirectXVideoChannel != null)
                {
                    netp2pDirectXVideoChannel = null;
                }
                if (httpDirectXVideoChannel != null)
                {
                    httpDirectXVideoChannel = null;
                }
                VMuktiAPI.VMuktiHelper.UnRegisterEvent("SignOut");
            }
            catch (Exception ex)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "Current_Exit", "ctlUserVideo.xaml.cs");
            }
        }
예제 #7
0
        public void RegNetP2pClient(object videoURI)
        {
            try
            {
                object objDirectXVideo = new ClsNetP2PUserVideo();
                ((ClsNetP2PUserVideo)objDirectXVideo).EntsvcJoin += new ClsNetP2PUserVideo.delsvcJoin(ctlUserVideo_EntsvcJoin);
                ((ClsNetP2PUserVideo)objDirectXVideo).EntsvcSendStream += new ClsNetP2PUserVideo.delsvcSendStream(ctlUserVideo_EntsvcSendStream);
                ((ClsNetP2PUserVideo)objDirectXVideo).EntsvcUnJoin += new ClsNetP2PUserVideo.delsvcUnJoin(ctlUserVideo_EntsvcUnJoin);

                NetPeerClient npcDirectXVideo = new NetPeerClient();
                netp2pDirectXVideoChannel = (INetP2PUserVideoChannel)npcDirectXVideo.OpenClient<INetP2PUserVideoChannel>(videoURI.ToString(), videoURI.ToString().Split(':')[2].Split('/')[2], ref objDirectXVideo);
                netp2pDirectXVideoChannel.svcJoin("");
            }

            catch (Exception ex)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "RegNetP2PClient", "clsVideoSNode.cs");             
            }
        }
예제 #8
0
        void RegClient(object videoURI)
        {
            lock (this)
            {
                try
                {
                    if (VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == PeerType.BootStrap || VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == PeerType.SuperNode || VMuktiInfo.CurrentPeer.CurrPeerType == PeerType.NodeWithNetP2P)
                    {
                        ((ClsNetP2PUserVideo)objDirectXVideo).EntsvcJoin += new ClsNetP2PUserVideo.delsvcJoin(ctlUserVideo_EntsvcJoin);
                        ((ClsNetP2PUserVideo)objDirectXVideo).EntsvcSendStream += new ClsNetP2PUserVideo.delsvcSendStream(ctlUserVideo_EntsvcSendStream);
                        ((ClsNetP2PUserVideo)objDirectXVideo).EntsvcUnJoin += new ClsNetP2PUserVideo.delsvcUnJoin(ctlUserVideo_EntsvcUnJoin);

                        npcDirectXVideo = new NetPeerClient();
                        netp2pDirectXVideoChannel = (INetP2PUserVideoChannel)npcDirectXVideo.OpenClient<INetP2PUserVideoChannel>(videoURI.ToString(), videoURI.ToString().Split(':')[2].Split('/')[2], ref objDirectXVideo);
                        netp2pDirectXVideoChannel.svcJoin(MyUserName);
                    }
                    else
                    {
                        int count = 0;
                        while (count < 90)
                        {
                            try
                            {
                                bhcDirectXVideo = new BasicHttpClient();
                                httpDirectXVideoChannel = (IHttpUserVideo)bhcDirectXVideo.OpenClient<IHttpUserVideo>(videoURI.ToString());
                                httpDirectXVideoChannel.svcJoin(MyUserName);

                                count = 90;

                                if (MyVidType != "Me")
                                {
                                    disptGetImages.Start();
                                }
                            }
                            catch
                            {
                                System.Threading.Thread.Sleep(TimeSpan.FromSeconds(1));
                                count++;
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "RegClient", "ctlUserVideo.xaml.cs");             
                }
            }
        }
예제 #9
0
        public void ClosePod()
        {
            try
            {
                if (capture != null)
                {
                    capture.Stop();
                    capture.Dispose();
                    
                }
                if (VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == PeerType.BootStrap || VMuktiAPI.VMuktiInfo.CurrentPeer.CurrPeerType == PeerType.SuperNode || VMuktiInfo.CurrentPeer.CurrPeerType == PeerType.NodeWithNetP2P)
                {
                    if (netp2pDirectXVideoChannel != null )
                    {
                        netp2pDirectXVideoChannel.svcUnJoin(VMuktiInfo.CurrentPeer.DisplayName);
						
                    }
                }
                else
                {
                    if (httpDirectXVideoChannel != null)
                    {
                        httpDirectXVideoChannel.svcUnJoin(VMuktiInfo.CurrentPeer.DisplayName);
                    }
                }
                if (disptGetImages != null)
                {
                    disptGetImages = null;
                }
                if (netp2pDirectXVideoChannel != null)
                {
                    netp2pDirectXVideoChannel.Close();
                    netp2pDirectXVideoChannel.Dispose();
                    netp2pDirectXVideoChannel = null;
                }

                Dispose();
            }
            catch (Exception ex)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "ClosePod", "ctlUserVideo.xaml.cs");             
            }
        }
예제 #10
0
        //public double[] PreivewWindowLoc()
        //{
        //    try
        //    {
        //        //ClsException.WriteToLogFile("PreivewWindowLoc called");
        //        double[] winXY = new double[2];
        //        winXY = capture.PreviewWidowTag();

        //        return winXY;
        //    }
        //    catch (Exception ex)
        //    {
        //        //MessageBox.Show("PreivewWindowLoc"+ex.Message);
        //        return null;
        //    }
        //}

        //public void ShowVideo()
        //{
        //    capture.showVideo();
        //}

        //public void HideVideo()
        //{
        //    capture.hideVideo();
        //}
        

        void Current_Exit(object sender, ExitEventArgs e)
        {
            try
            {
                if (capture != null)
                {
                    capture.Stop();
                    capture.Dispose();
                }
                if (netp2pDirectXVideoChannel != null)
                {
                    netp2pDirectXVideoChannel = null;
                }
                if (httpDirectXVideoChannel != null)
                {
                    httpDirectXVideoChannel = null;
                }
                VMuktiAPI.VMuktiHelper.UnRegisterEvent("SignOut");
            }
            catch (Exception ex)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "Current_Exit", "ctlUserVideo.xaml.cs");             
            }
        }
예제 #11
0
        public void Dispose()
        {
            
			try
			{		
                
				if (netp2pDirectXVideoChannel != null)
				{
                    netp2pDirectXVideoChannel.Close();
                    netp2pDirectXVideoChannel.Dispose();
                    netp2pDirectXVideoChannel = null;
				}
				if (httpDirectXVideoChannel != null)
				{
					httpDirectXVideoChannel = null;
				}
                GC.Collect();
                GC.WaitForPendingFinalizers();
                
			}
			catch (Exception exp)
			{
                VMuktiAPI.VMuktiHelper.ExceptionHandler(exp, "Dispose", "ctlUserVideo.xaml.cs");             
			}
        }
예제 #12
0
        public void RegNetP2pClient(object NetP2pUri)
        {
            try
            {
                NetPeerClient npcDummyClient = new NetPeerClient();
                objClsNetP2PUserVideo = new ClsNetP2PUserVideo();
                ((ClsNetP2PUserVideo)objClsNetP2PUserVideo).EntsvcJoin += new ClsNetP2PUserVideo.delsvcJoin(UserVideoDummies_NetP2P_EntsvcJoin);
                ((ClsNetP2PUserVideo)objClsNetP2PUserVideo).EntsvcSendStream += new ClsNetP2PUserVideo.delsvcSendStream(UserVideoDummies_NetP2P_EntsvcSendStream);
                ((ClsNetP2PUserVideo)objClsNetP2PUserVideo).EntsvcUnJoin += new ClsNetP2PUserVideo.delsvcUnJoin(UserVideoDummies_NetP2P_EntsvcUnJoin);

                //((ClsNetP2PMainVideo)objClsNetP2PUserVideo).EntsvcJoin += new ClsNetP2PUserVideo.delsvcJoin(UserVideoDummies_NetP2P_EntsvcJoin);
                //((ClsNetP2PMainVideo)objClsNetP2PUserVideo).EntsvcSendStream += new ClsNetP2PUserVideo.delsvcSendStream(UserVideoDummies_NetP2P_EntsvcSendStream);
                //((ClsNetP2PMainVideo)objClsNetP2PUserVideo).EntsvcUnJoin += new ClsNetP2PUserVideo.delsvcUnJoin(UserVideoDummies_NetP2P_EntsvcUnJoin);

                

                objINetP2PChannel = (INetP2PUserVideoChannel)npcDummyClient.OpenClient<INetP2PUserVideoChannel>(NetP2pUri.ToString(), NetP2pUri.ToString().Split(':')[2].Split('/')[2], ref objClsNetP2PUserVideo);

                while (tempcounter < 20)
                {
                    try
                    {
                        objINetP2PChannel.svcJoin(UserName);
                        tempcounter = 20;
                    }
                    catch
                    {
                        tempcounter++;
                        System.Threading.Thread.Sleep(1000);
                    }
                }
            }

            catch (Exception ex)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "RegNetP2PClient", "UserVideoDummies.cs");             
            }
        }