private async void CouponConfigControl_Load(object sender, EventArgs e) { if (designtime) { return; } using (var channel = ChannelManager.CreateChannel()) { try { Config = await taskPool.AddTask(channel.Service.GetCouponConfig()); } catch (OperationCanceledException) { } catch (CommunicationObjectAbortedException) { } catch (ObjectDisposedException) { } catch (InvalidOperationException) { } catch (FaultException exception) { UIHelper.Warning(exception.Reason.ToString()); } catch (Exception exception) { UIHelper.Warning(exception.Message); } } }
public CouponConfigControl() { InitializeComponent(); config = new CouponConfig(); if (designtime) { return; } sectionsControl.Initialize<CouponSection>(); taskPool = new TaskPool(); taskPool.OnAddTask += taskPool_OnAddTask; taskPool.OnRemoveTask += taskPool_OnRemoveTask; }
private async void saveButton_Click(object sender, EventArgs e) { using (var channel = ChannelManager.CreateChannel()) { try { saveButton.Enabled = false; config = await taskPool.AddTask(channel.Service.EditCouponConfig(config)); } 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; } } }