Beispiel #1
0
        private void AddToDictionaryAndWizardPages(DataGridViewRow item)
        {
            FieldGrid        fieldGrid        = new FieldGrid();
            FieldLayerObject fieldLayerObject = new FieldLayerObject();

            foreach (LayerField layerField in AppSingleton.Instance().BufferFieldListesi)
            {
                if (layerField.LayerObject.layer.Name == item.Cells[0].Value.ToString())
                {
                    fieldLayerObject.LayerObject = layerField.LayerObject;
                    fieldGrid.FieldLayerObject   = fieldLayerObject;
                    fieldGrid.FieldName          = layerField.FieldName;
                    break;
                }
            }
            int itemCount = AppSingleton.Instance().BufferItemCount + 1;

            fieldGrid.GridID = itemCount;
            AppSingleton.Instance().BufferItemCount = itemCount;

            IFeatureLayer fLayer = fieldGrid.FieldLayerObject.LayerObject.layer as IFeatureLayer;

            AppSingleton.Instance().BufferDict.Add(fLayer.Name, fieldGrid);
            UpdateFieldList(fieldGrid.FieldName, fLayer.Name);// ((ITable)fLayer.FeatureClass, fieldGrid.FieldName);
            fieldGrid.SetLabel(fLayer.Name);
            AppSingleton.Instance().wizardHost.WizardPages.Add(itemCount, fieldGrid);
        }
Beispiel #2
0
        public void UpdateFieldList(string FieldName, string layerName)
        {
            FieldGrid fieldGrid = AppSingleton.Instance().BufferDict[layerName];
            Dictionary <string, string> fieldList = new Dictionary <string, string>();

            string[] split = FieldName.Split(',');

            foreach (string item in split)
            {
                fieldList.Add(item, "");
            }
            fieldGrid.FieldLayerObject.FieldList = fieldList;
            AppSingleton.Instance().BufferDict[layerName] = fieldGrid;
        }
Beispiel #3
0
        public void CheckDict()
        {
            if (AppSingleton.Instance().BufferDict == null)
            {
                AppSingleton.Instance().BufferDict = new Dictionary <string, FieldGrid>();
            }

            for (int i = AppSingleton.Instance().BufferDict.Count - 1; i >= 0; i--)
            {
                bool kontrol = false;
                KeyValuePair <string, FieldGrid> peer = AppSingleton.Instance().BufferDict.ElementAt(i);

                for (int j = dataGridView1.Rows.Count - 1; j >= 0; j--)
                {
                    if (dataGridView1.Rows[j].Cells[0].Value != null)
                    {
                        string layerName = dataGridView1.Rows[j].Cells[0].Value.ToString();
                        if (peer.Key == layerName)
                        {
                            kontrol = true;
                            FieldGrid fieldGrid = peer.Value;
                            string    fieldName = "";
                            foreach (LayerField layerField in AppSingleton.Instance().BufferFieldListesi)
                            {
                                if (layerField.LayerObject.layer.Name == layerName)
                                {
                                    fieldName = layerField.FieldName;
                                }
                            }
                            if (fieldGrid.FieldName != fieldName)
                            {
                                AppSingleton.Instance().BufferDict[layerName].FieldName = fieldName;
                                UpdateFieldList(fieldName, layerName);
                            }
                            break;
                        }
                    }
                }
                if (kontrol == false)
                {
                    AppSingleton.Instance().BufferDict.Remove(peer.Key);
                    AppSingleton.Instance().wizardHost.WizardPages.Remove(peer.Value.GridID);
                }
            }

            for (int j = dataGridView1.Rows.Count - 1; j >= 0; j--)
            {
                string layerName = "";
                if (dataGridView1.Rows.Count > 0)
                {
                    bool kontrol = false;
                    if (dataGridView1.Rows[j].Cells[0].Value != null)
                    {
                        for (int i = AppSingleton.Instance().BufferDict.Count - 1; i >= 0; i--)
                        {
                            KeyValuePair <string, FieldGrid> peer = AppSingleton.Instance().BufferDict.ElementAt(i);

                            layerName = dataGridView1.Rows[j].Cells[0].Value.ToString();

                            if (peer.Key == layerName)
                            {
                                kontrol = true;
                                break;
                            }
                        }

                        if (kontrol == false)
                        {
                            AddToDictionaryAndWizardPages(dataGridView1.Rows[j]);
                        }
                    }
                }
            }
        }