示例#1
0
        private void MnuAssignIdFieldClick(object sender, EventArgs e)
        {
            var fl = treFeatures.SelectedNode.Tag as IFeatureLayer;

            if (fl != null)
            {
                var lstBox = new ListBoxDialog();

                var count = fl.DataSet.DataTable.Columns.Count;
                var obj   = new object[count];
                for (var i = 0; i < count; i++)
                {
                    obj[i] = fl.DataSet.DataTable.Columns[i].ColumnName;
                }

                lstBox.Clear();
                lstBox.Add(obj);
                if (lstBox.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }
                if (_featureIdFields.ContainsKey(fl.LegendText) == false)
                {
                    _featureIdFields.Add(fl.LegendText, (string)lstBox.SelectedItem);
                }
                else
                {
                    _featureIdFields[fl.LegendText] = (string)lstBox.SelectedItem;
                }

                SuspendLayout();

                var oldLayers = new List <IFeatureLayer>();
                foreach (TreeNode node in treFeatures.Nodes)
                {
                    oldLayers.Add(node.Tag as IFeatureLayer);
                }

                Clear();
                foreach (var layer in oldLayers)
                {
                    Add(layer, _activeRegion);
                }

                ReSelect();
                ResumeLayout();
            }
        }
示例#2
0
        private void _mnuAssignIdField_Click(object sender, EventArgs e)
        {
            var fl = treFeatures.SelectedNode.Tag as IFeatureLayer;
            if (fl != null)
            {
                var lstBox = new ListBoxDialog();

                var count = fl.DataSet.DataTable.Columns.Count;
                var obj = new object[count];
                for (var i = 0; i < count; i++)
                {
                    obj[i] = fl.DataSet.DataTable.Columns[i].ColumnName;
                }
                lstBox.Clear();
                lstBox.Add(obj);
                if (lstBox.ShowDialog(this) != DialogResult.OK) return;
                if (_featureIDFields.ContainsKey(fl.LegendText) == false)
                {
                    _featureIDFields.Add(fl.LegendText, (string)lstBox.SelectedItem);
                }
                else
                {
                    _featureIDFields[fl.LegendText] = (string)lstBox.SelectedItem;
                }
                SuspendLayout();

                var oldLayers = new List<IFeatureLayer>();
                foreach (TreeNode node in treFeatures.Nodes)
                {
                    oldLayers.Add(node.Tag as IFeatureLayer);
                }

                Clear();
                foreach (var layer in oldLayers)
                {
                    Add(layer, _activeRegion);
                }
                ReSelect();
                ResumeLayout();
            }
        }