private async void EditAdministratorForm_Load(object sender, EventArgs e)
{
if (administratorId != Guid.Empty)
{
Enabled = false;
try
{
using (var channel = UserChannelManager.CreateChannel())
{
Administrator = await taskPool.AddTask(channel.Service.GetUser(administratorId)) as QueueAdministrator;
}
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
{
Administrator = new QueueAdministrator()
{
Surname = "Новый пользователь",
IsActive = true
};
}
}