private async void EditAdditionalServiceForm_Load(object sender, EventArgs e) { using (Channel<IServerTcpService> channel = ChannelManager.CreateChannel()) { try { Enabled = false; if (clientRequestId != Guid.Empty) { clientRequest = await taskPool.AddTask(channel.Service.GetClientRequest(clientRequestId)); } additionalServiceControl.Initialize(await taskPool.AddTask(channel.Service.GetAdditionalServiceLinks())); if (clientRequestAdditionalServiceId != Guid.Empty) { ClientRequestAdditionalService = await taskPool.AddTask(channel.Service.GetClientRequestAdditionalService(clientRequestAdditionalServiceId)); } else { ClientRequestAdditionalService = new ClientRequestAdditionalService() { ClientRequest = clientRequest, Quantity = 1 }; } } catch (OperationCanceledException) { } catch (CommunicationObjectAbortedException) { } catch (ObjectDisposedException) { } catch (InvalidOperationException) { } catch (FaultException exception) { UIHelper.Warning(exception.Reason.ToString()); } catch (Exception exception) { UIHelper.Warning(exception.Message); } finally { Enabled = true; } } }
private async void saveButton_Click(object sender, EventArgs e) { using (Channel<IServerTcpService> channel = ChannelManager.CreateChannel()) { try { saveButton.Enabled = false; clientRequestAdditionalService = await taskPool.AddTask(channel.Service.EditClientRequestAdditionalService(clientRequestAdditionalService)); if (Saved != null) { Saved(this, EventArgs.Empty); } } catch (OperationCanceledException) { } catch (CommunicationObjectAbortedException) { } catch (ObjectDisposedException) { } catch (InvalidOperationException) { } catch (FaultException exception) { UIHelper.Warning(exception.Reason.ToString()); } catch (Exception exception) { UIHelper.Warning(exception.Message); } finally { saveButton.Enabled = true; } } }