Exemple #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");
                }
            }
        }
Exemple #2
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");
     }
 }
Exemple #3
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");
            }
        }
        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");             
                }
            }
        }
        //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");             
            }
        }
        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");             
			}
        }