void Current_Exit(object sender, ExitEventArgs e) { try { if (channelHttp != null) { channelHttp = null; } if (channelNetTcp != null && channelNetTcp.State == CommunicationState.Opened) { channelNetTcp = null; } if (dispTimerControl != null) { dispTimerControl.Stop(); } VMuktiAPI.VMuktiHelper.UnRegisterEvent("SignOut"); } catch (System.Exception ex) { VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "Current_Exit()", "UserControl1.xaml.cs"); } }
private void Dispose(bool disposing) { if (!this.disposed) { if (disposing) { try { if (channelHttp != null) { channelHttp = null; } if (channelNetTcp != null) { channelNetTcp.Close(); channelNetTcp.Dispose(); channelNetTcp = null; } if (msBuffer != null) { msBuffer = null; } if (dispTimerControl != null) { dispTimerControl = null; } } catch (System.Exception ex) { VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "Dispose(bool disposing)", "UserControl1.xaml.cs"); } } disposed = true; } GC.SuppressFinalize(this); }
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"); } }
public void ClosePod() { try { clsMessageContract objContract = new clsMessageContract(); objContract.strFrom = VMuktiAPI.VMuktiInfo.CurrentPeer.DisplayName; objContract.lstTo = lstName; objContract.slideArr = new string[0]; objContract.SlideID = 0; objContract.SlideStream = new MemoryStream(); objContract.strMsg = ""; if (channelNetTcp != null) { channelNetTcp.svcSignOutPPT(objContract); } else if (channelHttp != null) { channelHttp.svcSignOutPPT(objContract); } if (channelNetTcp != null) { channelNetTcp.Close(); channelNetTcp.Dispose(); channelNetTcp = null; } if (channelHttp != null) { channelHttp = null; } if (dispTimerControl != null) { dispTimerControl.Stop(); } } catch (System.Exception ex) { VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "ClosePod()", "UserControl1.xaml.cs"); } }