private void buttonSelectEntity_Click(object sender, EventArgs e)
        {
            if (service == null)
            {
                MessageBox.Show(ParentForm,
                                "You are not connected to an organization! Please connect to an organization and reopen this SubArea item",
                                "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            EntityPicker picker = new EntityPicker(emds);

            picker.StartPosition = FormStartPosition.CenterParent;

            if (picker.ShowDialog() == DialogResult.OK)
            {
                txtSubAreaEntity.Text = picker.SelectedEntity;
            }
        }
示例#2
0
        private void PbAddEntityClick(object sender, EventArgs e)
        {
            var epForm = new EntityPicker(emds);

            if (epForm.ShowDialog(this) == DialogResult.OK)
            {
                foreach (var emd in epForm.EntitiesToAdd)
                {
                    bool doContinue = true;
                    foreach (ListViewItem existingItem in lvEntities.Items)
                    {
                        if (((EntityMetadata)existingItem.Tag).LogicalName == emd.LogicalName)
                        {
                            doContinue = false;
                        }
                    }

                    if (!doContinue)
                    {
                        continue;
                    }

                    UpdateEntityDictionary(emd, ActionState.Added);

                    var item = new ListViewItem {
                        Text = emd.DisplayName.UserLocalizedLabel.Label, Tag = emd
                    };
                    item.SubItems.Add(emd.LogicalName);
                    item.Selected = true;
                    lvEntities.Items.Add(item);

                    // AddEntityAttributesToList(emd);

                    SortGroups(lvAttributes);
                }

                RefreshSorting(lvEntities);
            }
        }