public Lighter.MainService.Model.Client GetCurrentClient() { if (_currentClient == null) { _currentClient = CreateNewClient(); } return(_currentClient); }
private void DisconnectServer() { Lighter.MainService.Model.Client client = GetCurrentClient(); ILighterMainService mainService = FindService(ServiceFactory.MAIN_SERVICE_NAME) as ILighterMainService; if (mainService != null) { mainService.Disconnect(client); } }
private void CreateMainService() { string serverIp = GetServerIp(); int serverPort = -1; if (!Int32.TryParse(GetServerPort(), out serverPort)) { serverPort = 50000; } var builder = new UriBuilder("net.tcp", serverIp, serverPort, ServiceFactory.MAIN_SERVICE_NAME); ILighterMainService mainService = ServiceFactory.CreateService <ILighterMainService>(builder.Uri); Lighter.MainService.Model.Client client = GetCurrentClient(); mainService.Connect(client); AddService(ServiceFactory.MAIN_SERVICE_NAME, mainService); }