private async void saveButton_Click(object sender, EventArgs e) { using (var channel = ChannelManager.CreateChannel()) { try { saveButton.Enabled = false; ServiceStep = await taskPool.AddTask(channel.Service.EditServiceStep(serviceStep)); 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; } } }
private async void EditServiceStepForm_Load(object sender, EventArgs e) { Enabled = false; using (var channel = ChannelManager.CreateChannel()) { try { if (serviceId != Guid.Empty) { service = await taskPool.AddTask(channel.Service.GetService(serviceId)); } ServiceStep = serviceStepId != Guid.Empty ? await taskPool.AddTask(channel.Service.GetServiceStep(serviceStepId)) : new ServiceStep() { Service = service, Name = "Новый этап" }; 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); } } }
private void RenderStepsGridViewRow(DataGridViewRow row, ServiceStep serviceStep) { row.Cells["nameColumn"].Value = serviceStep.Name; row.Tag = serviceStep; }