void RegPresentationp2pClient(string P2PUri)
        {
            try
            {
                NetPeerClient npcDummyPresentation = new NetPeerClient();
                objNetTcpPresentation = new clsNetTcpPresentation();
                ((clsNetTcpPresentation)objNetTcpPresentation).EntsvcJoin   += new clsNetTcpPresentation.delsvcJoin(P2PPresentationClient_EntsvcJoin);
                ((clsNetTcpPresentation)objNetTcpPresentation).EntsvcUnJoin += new clsNetTcpPresentation.delsvcUnJoin(P2PPresentationClient_EntsvcUnJoin);
                channelNettcpPresentation = (INetTcpPresentationChannel)npcDummyPresentation.OpenClient <INetTcpPresentationChannel>(P2PUri, P2PUri.ToString().Split(':')[2].Split('/')[2], ref objNetTcpPresentation);

                while (tempcounter < 20)
                {
                    try
                    {
                        clsMessageContract objContract = new clsMessageContract();
                        objContract.strFrom = UserName;
                        objContract.strMsg  = "";
                        channelNettcpPresentation.svcJoin(objContract);

                        tempcounter = 20;
                    }
                    catch
                    {
                        tempcounter++;
                        System.Threading.Thread.Sleep(1000);
                    }
                }
            }
            catch (Exception ex)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "RegPresentationp2pClient()", "P2PPresentationClient.cs");
            }
        }
Exemple #2
0
        void RegNetP2PClient(object netP2pUri)
        {
            try
            {
                NetPeerClient npcDummyPresentation = new NetPeerClient();
                objNetTcpPresentation = new clsNetTcpPresentation();
                ((clsNetTcpPresentation)objNetTcpPresentation).EntsvcJoin         += new clsNetTcpPresentation.delsvcJoin(P2PPresentationDummy_EntsvcJoin);
                ((clsNetTcpPresentation)objNetTcpPresentation).EntsvcSetSlide     += new clsNetTcpPresentation.delsvcSetSlide(P2PPresentationDummy_EntsvcSetSlide);
                ((clsNetTcpPresentation)objNetTcpPresentation).EntsvcUnJoin       += new clsNetTcpPresentation.delsvcUnJoin(P2PPresentationDummy_EntsvcUnJoin);
                ((clsNetTcpPresentation)objNetTcpPresentation).EntsvcSetSlideList += new clsNetTcpPresentation.delsvcSetSlideList(P2PPresentationDummy_EntsvcSetSlideList);
                ((clsNetTcpPresentation)objNetTcpPresentation).EntsvcSignOutPPT   += new clsNetTcpPresentation.delsvcSignOutPPT(P2PPresentationDummy_EntsvcSignOutPPT);
                ((clsNetTcpPresentation)objNetTcpPresentation).EntsvcGetUserList  += new clsNetTcpPresentation.delsvcGetUserList(P2PPresentationDummy_EntsvcGetUserList);
                ((clsNetTcpPresentation)objNetTcpPresentation).EntsvcSetUserList  += new clsNetTcpPresentation.delsvcSetUserList(P2PPresentationDummy_EntsvcSetUserList);

                channelNettcpPresentation = (INetTcpPresentationChannel)npcDummyPresentation.OpenClient <INetTcpPresentationChannel>(netP2pUri.ToString(), netP2pUri.ToString().Split(':')[2].Split('/')[2], ref objNetTcpPresentation);

                while (tempcounter < 20)
                {
                    try
                    {
                        clsMessageContract objContract = new clsMessageContract();
                        objContract.strFrom     = UserName;
                        objContract.strMsg      = "";
                        objContract.lstTo       = new List <string>();
                        objContract.slideArr    = new string[0];
                        objContract.SlideID     = 0;
                        objContract.SlideStream = new MemoryStream();
                        channelNettcpPresentation.svcJoin(objContract);
                        tempcounter = 20;
                    }
                    catch
                    {
                        tempcounter++;
                        System.Threading.Thread.Sleep(1000);
                    }
                }
            }
            catch (Exception ex)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "RegNetP2PClient()", "PresentationDummy.cs");
            }
        }
        void RegNetP2PClient(object netP2pUri)
        {
            try
            {
                NetPeerClient npcDummyPresentation = new NetPeerClient();
                objNetTcpPresentation = new clsNetTcpPresentation();
                ((clsNetTcpPresentation)objNetTcpPresentation).EntsvcJoin += new clsNetTcpPresentation.delsvcJoin(P2PPresentationDummy_EntsvcJoin);
                ((clsNetTcpPresentation)objNetTcpPresentation).EntsvcSetSlide += new clsNetTcpPresentation.delsvcSetSlide(P2PPresentationDummy_EntsvcSetSlide);
                ((clsNetTcpPresentation)objNetTcpPresentation).EntsvcUnJoin += new clsNetTcpPresentation.delsvcUnJoin(P2PPresentationDummy_EntsvcUnJoin);
                ((clsNetTcpPresentation)objNetTcpPresentation).EntsvcSetSlideList += new clsNetTcpPresentation.delsvcSetSlideList(P2PPresentationDummy_EntsvcSetSlideList);
                ((clsNetTcpPresentation)objNetTcpPresentation).EntsvcSignOutPPT += new clsNetTcpPresentation.delsvcSignOutPPT(P2PPresentationDummy_EntsvcSignOutPPT);
                ((clsNetTcpPresentation)objNetTcpPresentation).EntsvcGetUserList += new clsNetTcpPresentation.delsvcGetUserList(P2PPresentationDummy_EntsvcGetUserList);
                ((clsNetTcpPresentation)objNetTcpPresentation).EntsvcSetUserList += new clsNetTcpPresentation.delsvcSetUserList(P2PPresentationDummy_EntsvcSetUserList);

                channelNettcpPresentation = (INetTcpPresentationChannel)npcDummyPresentation.OpenClient<INetTcpPresentationChannel>(netP2pUri.ToString(), netP2pUri.ToString().Split(':')[2].Split('/')[2], ref objNetTcpPresentation);

                while (tempcounter < 20)
                {
                    try
                    {
                        clsMessageContract objContract = new clsMessageContract();
                        objContract.strFrom = UserName;
                        objContract.strMsg = "";
                        objContract.lstTo = new List<string>();
                        objContract.slideArr = new string[0];
                        objContract.SlideID = 0;
                        objContract.SlideStream = new MemoryStream();
                        channelNettcpPresentation.svcJoin(objContract);
                        tempcounter = 20;
                    }
                    catch
                    {
                        tempcounter++;
                        System.Threading.Thread.Sleep(1000);
                    }
                }
            }
            catch (Exception ex)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "RegNetP2PClient()", "PresentationDummy.cs");
            }
        }
        void bgHostService_DoWork(object sender, DoWorkEventArgs e)
        {
            List<object> lstTempObj = (List<object>)e.Argument;
            strUri = lstTempObj[1].ToString();
            try
            {
                if ((VMuktiAPI.PeerType)lstTempObj[0] == VMuktiAPI.PeerType.NodeWithNetP2P || (VMuktiAPI.PeerType)lstTempObj[0] == VMuktiAPI.PeerType.BootStrap || (VMuktiAPI.PeerType)lstTempObj[0] == VMuktiAPI.PeerType.SuperNode)
                {
                    NetPeerClient npcPresentation = new NetPeerClient();
                    ((clsNetTcpPresentation)objNetTcpPresentation).EntsvcJoin += new clsNetTcpPresentation.delsvcJoin(UserControl1_EntsvcJoin);
                    ((clsNetTcpPresentation)objNetTcpPresentation).EntsvcSetSlide += new clsNetTcpPresentation.delsvcSetSlide(UserControl1_EntsvcSetSlide);
                    ((clsNetTcpPresentation)objNetTcpPresentation).EntsvcSetSlideList += new clsNetTcpPresentation.delsvcSetSlideList(UserControl1_EntsvcSetSlideList);
                    ((clsNetTcpPresentation)objNetTcpPresentation).EntsvcGetUserList += new clsNetTcpPresentation.delsvcGetUserList(UserControl1_EntsvcGetUserList);
                    ((clsNetTcpPresentation)objNetTcpPresentation).EntsvcSetUserList += new clsNetTcpPresentation.delsvcSetUserList(UserControl1_EntsvcSetUserList);
                    ((clsNetTcpPresentation)objNetTcpPresentation).EntsvcSignOutPPT += new clsNetTcpPresentation.delsvcSignOutPPT(UserControl1_EntsvcSignOutPPT);
                    ((clsNetTcpPresentation)objNetTcpPresentation).EntsvcUnJoin += new clsNetTcpPresentation.delsvcUnJoin(UserControl1_EntsvcUnJoin);

                    channelNetTcp = (INetTcpPresentationChannel)npcPresentation.OpenClient<INetTcpPresentationChannel>(strUri, strUri.ToString().Split(':')[2].Split('/')[2], ref objNetTcpPresentation);

                    while (temp < 20)
                    {
                        try
                        {
                            clsMessageContract objContract = new clsMessageContract();
                            objContract.strFrom = VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName;
                            objContract.strMsg = "";
                            objContract.lstTo = new List<string>();
                            objContract.slideArr = new string[0];
                            objContract.SlideID = 0;
                            objContract.SlideStream = new MemoryStream();
                            channelNetTcp.svcJoin(objContract);

                            temp = 20;

                            clsMessageContract objContract1 = new clsMessageContract();
                            objContract1.strFrom = VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName;
                            objContract1.strMsg = "get";
                            objContract1.lstTo = new List<string>();
                            objContract1.slideArr = new string[0];
                            objContract1.SlideID = 0;
                            objContract1.SlideStream = new MemoryStream();
                            channelNetTcp.svcGetUserList(objContract1);
                        }
                        catch
                        {
                            temp++;
                            System.Threading.Thread.Sleep(1000);
                        }
                    }

                    ClsException.WriteToLogFile("Presentation module:");
                    ClsException.WriteToLogFile("Opened presenation P2P Client");
                    ClsException.WriteToLogFile("Uri for opening the client is : " + strUri);
                    ClsException.WriteToLogFile("MeshId for opening the client is : " + strUri.ToString().Split(':')[2].Split('/')[1]);
                }
                else
                {
                    BasicHttpClient bhcPresentation = new BasicHttpClient();
                    channelHttp = (IHttpPresentation)bhcPresentation.OpenClient<IHttpPresentation>(strUri);

                    while (tempcounter < 20)
                    {
                        try
                        {
                            clsMessageContract objContract = new clsMessageContract();
                            objContract.strFrom = VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName;
                            objContract.strMsg = "";
                            objContract.lstTo = new List<string>();
                            objContract.slideArr = new string[0];
                            objContract.SlideID = 0;
                            objContract.SlideStream = new MemoryStream();
                            channelHttp.svcJoin(objContract);

                            tempcounter = 20;

                            clsMessageContract objContract1 = new clsMessageContract();
                            objContract1.strFrom = VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName;
                            objContract1.strMsg = "get";
                            objContract1.lstTo = new List<string>();
                            objContract1.slideArr = new string[0];
                            objContract1.SlideID = 0;
                            objContract1.SlideStream = new MemoryStream();
                            channelHttp.svcGetUserList(objContract1);
                        }
                        catch
                        {
                            tempcounter++;
                            System.Threading.Thread.Sleep(1000);
                        }
                    }

                    dispTimerControl.Interval = TimeSpan.FromSeconds(2);
                    dispTimerControl.Tick += new EventHandler(dispTimerControl_Tick);
                    dispTimerControl.Start();

                    ClsException.WriteToLogFile("Presentation module:");
                    ClsException.WriteToLogFile("Opened Http Presentation Client with Timers");
                    ClsException.WriteToLogFile("Uri for opening the client is : " + strUri);
                    ClsException.WriteToLogFile("MeshId for opening the client is : " + strUri.ToString().Split(':')[2].Split('/')[1]);
                }


            }
            catch (System.Exception ex)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "bgHostService_DoWork()", "UserControl1.xaml.cs");
            }
        }
        void RegPresentationp2pClient(string P2PUri)
        {
            try
            {
                NetPeerClient npcDummyPresentation = new NetPeerClient();
                objNetTcpPresentation = new clsNetTcpPresentation();
                ((clsNetTcpPresentation)objNetTcpPresentation).EntsvcJoin += new clsNetTcpPresentation.delsvcJoin(P2PPresentationClient_EntsvcJoin);
                ((clsNetTcpPresentation)objNetTcpPresentation).EntsvcUnJoin += new clsNetTcpPresentation.delsvcUnJoin(P2PPresentationClient_EntsvcUnJoin);
                channelNettcpPresentation = (INetTcpPresentationChannel)npcDummyPresentation.OpenClient<INetTcpPresentationChannel>(P2PUri, P2PUri.ToString().Split(':')[2].Split('/')[2], ref objNetTcpPresentation);

                while (tempcounter < 20)
                {
                    try
                    {
                        clsMessageContract objContract = new clsMessageContract();
                        objContract.strFrom = UserName;
                        objContract.strMsg = "";
                        channelNettcpPresentation.svcJoin(objContract); 
                        
                        tempcounter = 20;
                    }
                    catch
                    {
                        tempcounter++;
                        System.Threading.Thread.Sleep(1000);
                    }
                }
            }
            catch (Exception ex)
            {
                VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "RegPresentationp2pClient()", "P2PPresentationClient.cs");
            }
        }