public async Task <int> CommitToServer(Signal signal) { var signalDto = Mapper.Map <Signal, SignalService.SignalDto>(signal); try { var client = new SignalService.SignalServiceClient(); var result = await client.SaveAsync(signalDto); if (_SuspendedSignals.Count > 0) { Task.Run(() => { TransferSuspended(); }); } return(result); } catch (CommunicationException ex) { signal.Errors.Add(ex.Message); } catch (Exception ex) { signal.Errors.Add("Can´t connect to server."); } SuspendedSignals.Add(signalDto); return(-1); }
private void TransferSuspended() { var tDel = new List <SignalDto>(); var tclient = new SignalService.SignalServiceClient(); foreach (var tSignal in _SuspendedSignals) { try { var tresult = tclient.SaveAsync(tSignal); tDel.Add(tSignal); } catch { } } foreach (var tSignal in tDel) { _SuspendedSignals.Remove(tSignal); } tDel.Clear(); }
private static System.ServiceModel.EndpointAddress GetDefaultEndpointAddress() { return(SignalServiceClient.GetEndpointAddress(EndpointConfiguration.BasicHttpBinding_ISignalService)); }
private static System.ServiceModel.Channels.Binding GetDefaultBinding() { return(SignalServiceClient.GetBindingForEndpoint(EndpointConfiguration.BasicHttpBinding_ISignalService)); }
public SignalServiceClient(EndpointConfiguration endpointConfiguration, System.ServiceModel.EndpointAddress remoteAddress) : base(SignalServiceClient.GetBindingForEndpoint(endpointConfiguration), remoteAddress) { this.Endpoint.Name = endpointConfiguration.ToString(); ConfigureEndpoint(this.Endpoint, this.ClientCredentials); }
public SignalServiceClient(EndpointConfiguration endpointConfiguration) : base(SignalServiceClient.GetBindingForEndpoint(endpointConfiguration), SignalServiceClient.GetEndpointAddress(endpointConfiguration)) { this.Endpoint.Name = endpointConfiguration.ToString(); ConfigureEndpoint(this.Endpoint, this.ClientCredentials); }
public SignalServiceClient() : base(SignalServiceClient.GetDefaultBinding(), SignalServiceClient.GetDefaultEndpointAddress()) { this.Endpoint.Name = EndpointConfiguration.BasicHttpBinding_ISignalService.ToString(); ConfigureEndpoint(this.Endpoint, this.ClientCredentials); }