void RegDesktopp2pClient(string P2PUri)
        {
            try
            {
                NetPeerClient npcDummyDesktop = new NetPeerClient();
                objNetTcpDesktop = new clsNetTcpDesktop();
                ((clsNetTcpDesktop)objNetTcpDesktop).EntsvcJoin += new clsNetTcpDesktop.delsvcJoin(P2PDesktopClient_EntsvcJoin);
                ((clsNetTcpDesktop)objNetTcpDesktop).EntsvcUnJoin += new clsNetTcpDesktop.delsvcUnJoin(P2PDesktopClient_EntsvcUnJoin);

                channelNettcpDesktop = (INetTcpDesktopChannel)npcDummyDesktop.OpenClient<INetTcpDesktopChannel>(P2PUri, P2PUri.ToString().Split(':')[2].Split('/')[2], ref objNetTcpDesktop);

                while (tempcounter < 20)
                {
                    try
                    {
                        //Stream mmsUName = fncStringToStream(UserName);

                        //channelNettcpDesktop.svcJoin(mmsUName);
                        #region msgContract
                        clsMessageContract objContract = new clsMessageContract();
                        objContract.blControl = false;
                        objContract.blView = false;
                        objContract.key = 0;
                        objContract.mouseButton = 0;
                        objContract.stremImage = new MemoryStream();
                        objContract.strFrom = UserName;
                        objContract.strTo = "";
                        objContract.strType = "";
                        objContract.x = 0.0;
                        objContract.y = 0.0;
                        #endregion msgContract

                        channelNettcpDesktop.svcJoin(objContract);

                        tempcounter = 20;
                    }
                    catch
                    {
                        tempcounter++;
                        System.Threading.Thread.Sleep(1000);
                    }
                }
            }
            catch
            {

            }
        }
        private void RegNetP2PClient(string netP2pUri)
        {
            try
            {
                NetPeerClient npcDummyDesktop = new NetPeerClient();
                objNetTcpDesktop = new clsNetTcpDesktop();
                ((clsNetTcpDesktop)objNetTcpDesktop).EntsvcJoin += new clsNetTcpDesktop.delsvcJoin(DesktopDummy_EntsvcJoin);
                ((clsNetTcpDesktop)objNetTcpDesktop).EntsvcSendMessage += new clsNetTcpDesktop.delsvcSendMessage(DesktopDummy_EntsvcSendMessage);
                ((clsNetTcpDesktop)objNetTcpDesktop).EntsvcGetUserList += new clsNetTcpDesktop.delsvcGetUserList(DesktopDummy_EntsvcGetUserList);
                ((clsNetTcpDesktop)objNetTcpDesktop).EntsvcSetUserList += new clsNetTcpDesktop.delsvcSetUserList(DesktopDummy_EntsvcSetUserList);
                ((clsNetTcpDesktop)objNetTcpDesktop).EntsvcSelectedDesktop += new clsNetTcpDesktop.delsvcSelectedDesktop(DesktopDummy_EntsvcSelectedDesktop);
                ((clsNetTcpDesktop)objNetTcpDesktop).EntsvcStopControl += new clsNetTcpDesktop.delsvcStopControl(DesktopDummy_EntsvcStopControl);
                ((clsNetTcpDesktop)objNetTcpDesktop).EntsvcBtnUp += new clsNetTcpDesktop.delsvcBtnUp(DesktopDummy_EntsvcBtnUp);
                ((clsNetTcpDesktop)objNetTcpDesktop).EntsvcBtnDown += new clsNetTcpDesktop.delsvcBtnDown(DesktopDummy_EntsvcBtnDown);
                ((clsNetTcpDesktop)objNetTcpDesktop).EntsvcSendKey += new clsNetTcpDesktop.delsvcSendKey(DesktopDummy_EntsvcSendKey);
                ((clsNetTcpDesktop)objNetTcpDesktop).EntsvcSendXY += new clsNetTcpDesktop.delsvcSendXY(DesktopDummy_EntsvcSendXY);
                ((clsNetTcpDesktop)objNetTcpDesktop).EntsvcAllowView += new clsNetTcpDesktop.delsvcAllowView(DesktopDummy_EntsvcAllowView);
                ((clsNetTcpDesktop)objNetTcpDesktop).EntsvcAllowControl += new clsNetTcpDesktop.delsvcAllowControl(DesktopDummy_EntsvcAllowControl);
                ((clsNetTcpDesktop)objNetTcpDesktop).EntsvcUnJoin += new clsNetTcpDesktop.delsvcUnJoin(DesktopDummy_EntsvcUnJoin);

                channelNettcpDesktop = (INetTcpDesktopChannel)npcDummyDesktop.OpenClient<INetTcpDesktopChannel>(netP2pUri.ToString(), netP2pUri.ToString().Split(':')[2].Split('/')[2], ref objNetTcpDesktop);

                while (tempcounter < 20)
                {
                    try
                    {
                        #region MsgContract
                        clsMessageContract objContract = new clsMessageContract();
                        objContract.blControl = false;
                        objContract.blView = false;
                        objContract.key = 0;
                        objContract.mouseButton = 0;
                        objContract.stremImage = new MemoryStream();
                        objContract.strFrom = UserName;
                        objContract.strTo = "";
                        objContract.strType = "";
                        objContract.x = 0;
                        objContract.y = 0;
                        #endregion MsgContract
                        channelNettcpDesktop.svcJoin(objContract);
                        tempcounter = 20;
                    }
                    catch
                    {
                        tempcounter++;
                        System.Threading.Thread.Sleep(1000);
                    }
                }
            }
            catch(Exception ex)
            {
                VMuktiHelper.ExceptionHandler(ex, "RegNetP2PClient", "DesktopDummy.cs");
            }
        }
        void GlobalVariable()
        {
            try
            {
                objNetTcpDesktop = new clsNetTcpDesktop();
                objHttpDesktop = new clsHttpDesktop();
                hashID_Name = new Hashtable();

                DoWork = true;

                objGetUserList = new DelGetUserList(objDelGetUserList);
                objDelSendMsg = new DelSendMessage(delSendMessage);
                objRemoveUser = new DelRemoveUser(delRemoveUser);
                objDelGetMsg = new DelGetMessage(delGetMessage);
                objDisAllowView = new DelDisAllowView(delDisAllowView);
                objStopControl = new DelStopControl(delStopControl);                
            }
            catch (Exception ex)
            {
                VMuktiHelper.ExceptionHandler(ex, "GlobalVariable", "ctlDesktop_Sharing.xaml.cs");
            }
        }