private void tsbPublish_Click(object sender, EventArgs e) { if (attributeSelector1.SelectedEntity == null) return; WorkAsync("Publishing entity...", evt => { var fm = new FormManager(Service); fm.PublishForm(evt.Argument.ToString()); }, evt => { if (evt.Error != null) { MessageBox.Show(evt.Error.ToString()); } }, attributeSelector1.SelectedEntity.LogicalName); }
private void attributeSelector1_OnEntitySelected(object sender, EntitySelectedEventArgs e) { WorkAsync("Loading forms...", evt => { var formManager = new FormManager(Service); var forms = formManager.GetAllFormsByTypeCode(((EntityMetadata)evt.Argument).ObjectTypeCode.Value, ConnectionDetail); var items = forms.Select(form => new FormInfo(form)).Select(fi => new ListViewItem(fi.ToString()) { Tag = fi }).ToList(); evt.Result = items; }, evt => { if (evt.Error != null) { MessageBox.Show(evt.Error.ToString()); } else { listView1.Items.Clear(); listView1.Items.AddRange(((List<ListViewItem>)evt.Result).ToArray()); // Adds forms list to attribute selector attributeSelector1.EntityForms = ((List<ListViewItem>)evt.Result).Select(i => (FormInfo)i.Tag).ToList(); } }, e.Metadata); }
private void tsbPublish_Click(object sender, EventArgs e) { if (attributeSelector1.SelectedEntity == null) return; WorkAsync(new WorkAsyncInfo { Message = "Publishing entity...", AsyncArgument = attributeSelector1.SelectedEntity.LogicalName, Work = (bw, evt) => { var fm = new FormManager(Service); fm.PublishForm(evt.Argument.ToString()); }, PostWorkCallBack = evt => { if (evt.Error != null) { MessageBox.Show(evt.Error.ToString()); } } }); }