private async void EditClientForm_Load(object sender, EventArgs e)
{
if (clientId != Guid.Empty)
{
Enabled = false;
using (var channel = ChannelManager.CreateChannel())
{
try
{
Client = await taskPool.AddTask(channel.Service.GetClient(clientId));
Enabled = true;
}
catch (OperationCanceledException) { }
catch (CommunicationObjectAbortedException) { }
catch (ObjectDisposedException) { }
catch (InvalidOperationException) { }
catch (FaultException exception)
{
UIHelper.Warning(exception.Reason.ToString());
}
catch (Exception exception)
{
UIHelper.Warning(exception.Message);
}
}
}
else
{
Client = new Client()
{
Surname = "Новый клиент"
};
}
}