private void ConnectService() { if (this._VirtualRouter == null) { this._VirtualRouter = new VirtualRouterClient.VirtualRouterService.VirtualRouterHostClient(); this._VirtualRouter.InnerChannel.Faulted += new EventHandler(InnerChannel_Faulted); this._VirtualRouter.InnerChannel.Closed += new EventHandler(InnerChannel_Closed); this._VirtualRouter.InnerChannel.Opened += new EventHandler(InnerChannel_Opened); try { this._VirtualRouter.Open(); } catch { } } }
private void ServiceChecker() { while (true) { if (this._VirtualRouter.State == System.ServiceModel.CommunicationState.Faulted) { this._VirtualRouter = null; } if (this._VirtualRouter == null) { this.ConnectService(); } Thread.Sleep(5000); } }