Пример #1
0
        private void btnEdit_Click(object sender, EventArgs e)
        {
            if (!(lstRelates.SelectedItem is TableRelationItem))
            {
                return;
            }

            ITableRelation relation = ((TableRelationItem)lstRelates.SelectedItem).TableRelation;

            AddTableRelationDialog dlg = new AddTableRelationDialog(_mapDocument, _layer);

            dlg.TableRelation = relation;
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                ITableRelation newRelation = dlg.TableRelation;
                if (newRelation != null && newRelation.LeftTable != null && newRelation.RightTable != null)
                {
                    _mapDocument.TableRelations.Remove(relation);
                    _mapDocument.TableRelations.Add(newRelation);

                    if (relation.LeftTable != null && relation.RightTable != null)
                    {
                        relation.LeftTable.FirePropertyChanged();
                        relation.RightTable.FirePropertyChanged();
                    }

                    newRelation.LeftTable.FirePropertyChanged();
                    newRelation.RightTable.FirePropertyChanged();

                    FillList();
                }
            }
        }
Пример #2
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            AddTableRelationDialog dlg = new AddTableRelationDialog(_mapDocument, _layer);

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                ITableRelation relation = dlg.TableRelation;
                if (relation != null && relation.LeftTable != null && relation.RightTable != null)
                {
                    _mapDocument.TableRelations.Add(relation);

                    relation.LeftTable.FirePropertyChanged();
                    relation.RightTable.FirePropertyChanged();

                    FillList();
                }
            }
        }