private async void saveButton_Click(object sender, EventArgs e) { using (var channel = ChannelManager.CreateChannel()) { try { saveButton.Enabled = false; schedule = await taskPool.AddTask(channel.Service.EditSchedule(schedule)); } 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; } } }
private async void EditServiceRenderingForm_Load(object sender, EventArgs e) { Enabled = false; try { using (var channel = ServerUser.CreateChannel()) { operatorControl.Initialize(await taskPool.AddTask(channel.Service.GetUserLinks(UserRole.Operator))); } using (var channel = ChannelManager.CreateChannel()) { schedule = await taskPool.AddTask(channel.Service.GetSchedule(scheduleId)); if (schedule is ServiceSchedule) { var service = (schedule as ServiceSchedule).Service; serviceStepControl.Initialize(await taskPool.AddTask(channel.Service.GetServiceStepLinks(service.Id))); } ServiceRendering = serviceRenderingId != Guid.Empty ? await taskPool.AddTask(channel.Service.GetServiceRendering(serviceRenderingId)) : new ServiceRendering() { Schedule = schedule }; } } 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; } }