예제 #1
0
        private void method_5(object sender, RowDeleteEventArgs e)
        {
            if (this.listView2.SelectedIndices.Count != 0)
            {
                if ((ObjectClassShareData.m_IsShapeFile && this.bool_1) && (this.ifields_0.FieldCount == 3))
                {
                    MessageBox.Show("除OID字段和Shape字段外,要素类或表至少包含一个字段!");
                }
                else
                {
                    IField tag = this.listView2.Items[e.Row].Tag as IField;
                    switch (tag.Type)
                    {
                    case esriFieldType.esriFieldTypeOID:
                        MessageBox.Show("不能删除该行", "错误");
                        return;

                    case esriFieldType.esriFieldTypeGeometry:
                        if (!(this.string_0 == tag.Name))
                        {
                            break;
                        }
                        MessageBox.Show("不能删除该行", "错误");
                        return;
                    }
                    if (!tag.Editable)
                    {
                        MessageBox.Show("不能删除该行", "错误");
                    }
                    else
                    {
                        if (this.ifieldsEdit_0.FindField(tag.Name) != -1)
                        {
                            this.ifieldsEdit_0.DeleteField(tag);
                        }
                        else
                        {
                            if (!this.bool_0)
                            {
                                MessageBox.Show("不能删除该行", "错误");
                                return;
                            }
                            (this.ifields_0 as IFieldsEdit).DeleteField(tag);
                            this.ifieldsEdit_1.AddField(tag);
                            this.listView2.LockRowCount--;
                        }
                        this.listView2.Items.RemoveAt(e.Row);
                        if (this.ValueChanged != null)
                        {
                            this.ValueChanged(this, new EventArgs());
                        }
                    }
                }
            }
        }
예제 #2
0
        private void method_7(object sender, RowDeleteEventArgs e)
        {
            if (this.listView2.SelectedIndices.Count != 0)
            {
                IField tag = this.listView2.Items[e.Row].Tag as IField;
                switch (tag.Type)
                {
                case esriFieldType.esriFieldTypeOID:
                    MessageBox.Show("不能删除该行", "错误");
                    return;

                case esriFieldType.esriFieldTypeGeometry:
                    if (!(this.string_0 == tag.Name))
                    {
                        break;
                    }
                    MessageBox.Show("不能删除该行", "错误");
                    return;
                }
                if (!tag.Editable)
                {
                    MessageBox.Show("不能删除该行", "错误");
                }
                else
                {
                    if (this.ifieldsEdit_0.FindField(tag.Name) != -1)
                    {
                        this.ifieldsEdit_0.DeleteField(tag);
                    }
                    else
                    {
                        if (!this.bool_0)
                        {
                            MessageBox.Show("不能删除该行", "错误");
                            return;
                        }
                        (this.ifields_0 as IFieldsEdit).DeleteField(tag);
                        this.ifieldsEdit_1.AddField(tag);
                        this.listView2.LockRowCount--;
                    }
                    this.listView2.Items.RemoveAt(e.Row);
                    this.method_0();
                }
            }
        }