using Grpc.Core; using Aurora.Proto.Party; using Aurora.Services.Settings; namespace Aurora.Services.Client { public class ClientService : IClientService { private RemotePartyService.RemotePartyServiceClient _remotePartyClient; private Channel _channel; private ISettingsService _settingsService; public ClientService(ISettingsService settingsService) { this._settingsService = settingsService; } public bool IsStarted { get { return _remotePartyClient != null; } } public RemotePartyService.RemotePartyServiceClient RemotePartyServiceClient { get { return this._remotePartyClient; } } public void Start(string hostname, string port) { _channel = new Channel(string.Format("{0}:{1}", hostname, port), ChannelCredentials.Insecure); _remotePartyClient = new RemotePartyService.RemotePartyServiceClient(_channel); } public async void Close() { await _channel.ShutdownAsync(); _remotePartyClient = null; } } }