private async void EditWorkplaceForm_Load(object sender, EventArgs e)
{
if (workplaceId != Guid.Empty)
{
Enabled = false;
try
{
using (var channel = WorkplaceChannelManager.CreateChannel())
{
Workplace = await taskPool.AddTask(channel.Service.GetWorkplace(workplaceId));
}
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
{
Workplace = new Workplace()
{
Number = 1
};
}
}